cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

If null return value, If not null return formatdatetime

Hello,

 

I am scratching my head trying to find an expression to return a null value as TBC but if the value is not null return a date with date formatting.

 

Any suggestions?

 

I want to avoid using a condition if possible.

 

Many thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @kcg633755 ,

 

I have made a test on my side to create a "DueDateW" column, you could refer to my flow with expression as below:

1.png

The expression in the Compose as below:

if(empty(triggerBody()?['DueDateW']),'TBC',formatdatetime(triggerBody()?['DueDateW'],'dd/MM/yyyy'))

When I create a item in the list and the "DueDateW" column's value is null, the flow would run successfully as below:

2.png

When I create a item in the list and have value in the "DueDateW" column, the flow would run successfully as below:

3.png

 

 

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

3 REPLIES 3
Highlighted
Frequent Visitor

This is the expression I am using at the moment, it is causing the flow to crash...

 

if(equals(coalesce(triggerOutputs()?['body/12 - Date of Event:'],null),null),'00/00/0000',formatdatetime(triggerOutputs()?['body/12 - Date of Event:'],'dd/MM/yyyy'))
 
Any ideas?

@kcg633755 wrote:

Hello,

 

I am scratching my head trying to find an expression to return a null value as TBC but if the value is not null return a date with date formatting.

 

Any suggestions?

 

I want to avoid using a condition if possible.

 

Many thanks in advance.



Highlighted

Screen Shot 2019-08-29 at 17.45.31.png

This is the message I get Smiley Mad

Highlighted
Community Support
Community Support

Hi @kcg633755 ,

 

I have made a test on my side to create a "DueDateW" column, you could refer to my flow with expression as below:

1.png

The expression in the Compose as below:

if(empty(triggerBody()?['DueDateW']),'TBC',formatdatetime(triggerBody()?['DueDateW'],'dd/MM/yyyy'))

When I create a item in the list and the "DueDateW" column's value is null, the flow would run successfully as below:

2.png

When I create a item in the list and have value in the "DueDateW" column, the flow would run successfully as below:

3.png

 

 

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Kudoed Authors
Users online (8,077)