Feature reports: Can you get utcOffset from attribute?

1233
7
03-07-2020 11:14 AM
RobBlash
Occasional Contributor III

I use pulldata to store the utc offset as an attribute in my surveys. Since we now have the ability to specify an offset in feature reports, the logical progression is to use my attribute to calculate the time offset in my reports. However, I can't seem to get this to work. Any suggestions?

Happy Daylight Savings!

0 Kudos
7 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Rob,

Apologies for the delay.  You would be able to make use of the UTC offset data via the ArcGIS API for Python.  It currently isn't supported in the template syntax itself, but I've noted this as a potential enhancement. You may also want to post this to https://ideas.arcgis.com  

0 Kudos
RobBlash
Occasional Contributor III

Hi James,

Is there any chance this may be an enhancement we would see before the next time change?

Thanks,

Rob

0 Kudos
RobBlash
Occasional Contributor III

Hi James Tedrick I'm wondering if there are any updates on this as an enhancement? If there is any possibility of implementing this before DST (November 1st) that would be a huge help to my workflows.

My idea below (thought I created this months ago...)

Survey123 Feature reports: Calculate utcOffset from attribute 

0 Kudos
RobBlash
Occasional Contributor III

James Tedrick‌ this seems like it should be possible now with variables, can you confirm? I am having trouble getting it working. I have 2 existing fields in my survey:

${remark_date} - date/time question populated by user

${formutcoffset} - calc field in survey which populates the utc offset

However, this syntax in my report is not working:

${#remarks}${remark_date | utcOffset: formutcoffset}

${/remarks}

I should note that ${remark_date} is in a repeat, and ${formutcoffset} is outside of the repeat. I seem to remember that accessing parameters outside of a repeat are not possible, is this true?

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Rob,

If the formutcoffset is out of the repeat, you should specify it as <layername>.formutcoffset , where <layername> is the name of the parent layer.

0 Kudos
RobertAnderson3
MVP Regular Contributor

@JamesTedrick 

I'm attempting to use this functionality in a report that I'm creating using Power Automate and I can't seem to get it to work, the ${enddatetime | utcOffset:"-3"} is not changing the time when it's created this way. The time works properly when I generate it manually through the Survey123 website however (even without the offset value).

EDIT: So I found that if I put "-03:00" in it works, but the pulldata attribute for utcOffset only gives "-3"?

Any insights? Thanks!

Tim-Woodfield
Occasional Contributor

Hey not sure if you figured out a solution but I found something that worked for me. I wanted to add my workaround in case anyone else came across this. It uses a nested if to concat a usable string depending on negative or not and single or double digit.

I started with a calculate field called {UTC} to pull in the UTC using the calculation: 

pulldata("@property", 'utcOffset')

 

Then a second field called {UTCoffset} that concats the string:

if(${UTC}<0 and ${UTC}>-10, concat("-0",(${UTC}*-1),":00"),if(${UTC}<=-10 or ${UTC}>=10, concat(${UTC},":00"),if(${UTC}>=0 and ${UTC}<10, concat("0",${UTC},":00"),"00:00")))

 

Then in the report template, I put:

${CreationDate | utcOffset:UTCoffset}