cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
n8greene
Level: Powered On

Formatting a date value from a column that might have a null value

Scenario: I am creating a CSV from a SharePoint list. One of the columns, StartDate, is sometimes blank. The date needs to be formatted. 

 

To get around the NULL error this works: Coalesce(item()?['StartDate']) BUT I need to format the date. 

I can format the date this way: formatDateTime(item()?['StartDate'],'yyyy-MM-dd') BUT then I get NULL errors. 

 

I cannot figure out how to avoid NULL errors AND format the date. Any suggestions?

 

These do NOT work: 

formatDateTime(coalesce(item()?['StartDate']),'yyyy-MM-dd')

coalesce(formatDateTime(item()?['StartDate'],'yyyy-MM-dd'))

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
n8greene
Level: Powered On

Re: Formatting a date value from a column that might have a null value

I kept experementing with different approaches and this worked:

 

if(equals(item()?['StartDate'], null), '', formatDateTime(item()?['StartDate'],'yyyy-MM-dd'))

 

(note that the '' in the formula is two single quotes)

1 REPLY 1
n8greene
Level: Powered On

Re: Formatting a date value from a column that might have a null value

I kept experementing with different approaches and this worked:

 

if(equals(item()?['StartDate'], null), '', formatDateTime(item()?['StartDate'],'yyyy-MM-dd'))

 

(note that the '' in the formula is two single quotes)

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

thirdImage

New Flow Community Board!

Check out the new Microsoft Flow Community Blog Topic Suggestion board!

fourthImage

Australia Summit

Travel to Melbourne and network with thousands of peers!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 273 members 3,695 guests
Please welcome our newest community members: