if statement for null values and date/time conversion

735
0
07-19-2023 08:11 AM
elpinguino
Occasional Contributor III

Hi Automaters,

Context

I have a Flow set up so whenever a record is submitted from a Survey123 a new row gets added into an Excel spreadsheet table in Sharepoint. From previous ESRI forum postings I've found this expression for converting the date/time into my desired format.

 

addseconds('1970-1-1', Div(triggerOutputs()?['body/feature/attributes/TargetDates'],1000) , 'dd/MM/yyyy')

 

Problem

However there's another problem. The date/time question in the survey sometimes gets answered. It isn't required, and it's not always necessary. From the Flow error feedback I gather I need to add in a null if statement similar to the below format, but with my lack of coding experience I can't figure out how to combine the two. I'm getting an invalid expression when I try to combine them.

 

if(equals(triggerOutputs()?['body/feature/attributes/InspDate'],null), 'No inspection date recorded', convertTimeZone(addSeconds('1970-01-01',div(triggerOutputs()?['body/feature/attributes/InspDate'],1000)),'UTC','Pacific Standard Time','D'))

 

I found the above expression here - https://community.esri.com/t5/arcgis-survey123-blog/managing-time-and-date-from-survey123-in-microso...

Error feedback from Microsoft Automate - https://learn.microsoft.com/en-US/troubleshoot/power-platform/power-automate/getting-errors-null-fie...

Is it possible to add a Condition Connector with Null expression at the start of the flow? The field is Null sometimes though, not always.

I wonder if there are better/easier/more simple ways to get to my end goal. Either way the above are what I've found so far, but am not sure how to combine them. Possibly I could break them into two connectors like format any incoming date/times at the start or check for nulls, but still let them pass through at the start?

0 Kudos
0 Replies