-1

In ArcGIS Pro I have a dynamic text box (I believe it's XML or python..??) which currently contains some static text regarding the current version of our dataset and the date it was released. The text string looks like this:

Official Licensed Data: V1_60_20170226

I need this to dynamically update.
'V1' will always stay the same.
'60' will always change by increments of 1 every time the string updates
'20170226' will change every 7 days, on the day.

So in 7 days time, I want the text string to read:

Official Licensed Data: V1_61_20170305
How can I go about acheiving what I want?

I know that to import the current date it is:

<dyn type="date" format=""/>
Theo F
  • 1,197
  • 1
  • 11
  • 18
  • Do you want the 60 to 61 to occur once in 7 days? Or its independent of that? – nj2237 Feb 26 '18 at 17:54
  • @nj2237 Yes 60 to 61 will happen ONCE every 7 days, like the date part. V1_60_20170226 V1_61_20170305 V1_62_20170312 – Theo F Feb 26 '18 at 17:58

1 Answers1

0

If you know the day this begins, set a var =(0 for Monday to 6 for Sunday) for that day.

You can then have an import datetime at the top, and then get the day in a variable like, now = datetime.datetime.now and check if now.today().weekday() equals to your var. Whenever its equal, it means seven days have passed, since the above function returns a value between 0 to 6. So if yes, then do:

  • Get the string in str, split it at underscores _ like so: a = str.split("_"). So in a[1] you will have the number 60. Now increment it and assign it back to str after joining V1
  • join the string with today's date at the end. You have the date in now already, you can format it accordingly before putting it in str.

Hope this helps!

nj2237
  • 1,220
  • 3
  • 21
  • 25
  • Is that python or XML you've written there? – Theo F Feb 26 '18 at 18:30
  • If you were looking for the code in XML, I found the `DateTimeOffset` useful - check how they get current date and set new date according to the offset here https://stackoverflow.com/a/22190455/6089653 – nj2237 Feb 26 '18 at 18:39