cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ComputerHabit2
Resolver III
Resolver III

Test for Empty Date Field

I've been searching for a way to verify if a date field is empty.  It seems like there are many answers but none seems to work.  It's truly maddening.  I've been on this all day and can't tell if a date field is empty.  

 

if(empty(@{triggerBody()['date']}),@{body('Get_file_current_properties')?['forDueDate']},@{triggerBody()['date']})

 

I'm trying empty() but that doesn't work.  

 

1 ACCEPTED SOLUTION

Accepted Solutions
Hardesh15
Super User
Super User

@ComputerHabit2 

 

please remove all @, {,} from your expression.

if(empty(triggerBody()?['date']),body('Get_file_current_properties')?['forDueDate'],triggerBody()?['date'])

 

Thanks

Hardesh

View solution in original post

7 REPLIES 7
Hardesh15
Super User
Super User

@ComputerHabit2 

 

please remove all @, {,} from your expression.

if(empty(triggerBody()?['date']),body('Get_file_current_properties')?['forDueDate'],triggerBody()?['date'])

 

Thanks

Hardesh

It still gives me an error.

 

I rebuilt it a few times.

 

I'm new to using these functions so maybe I'm missing some syntax somewhere.  

I am having trouble using the functions all together.  Even on text or numbers.

 

The if function is:  if(empty(),,)

 

None of these work

 

if(empty(triggerBody()['date']),body('Get_file_current_properties')?['forDueDate'],triggerBody()['date'])


if(empty(triggerBody()['text_1']),body('Get_file_current_properties')?['Title'],triggerBody()['text_1'])


if(empty(triggerBody()['number']),body('Get_file_current_properties')?['qaDatabaseID0'],triggerBody()['number'])

@ComputerHabit2 

Do one thing..use compose action and add individual field from dynamic content. Copy compose input - do select all and copy. Then paste in notepad. This way you will get actual field expression. In notepad remove only @ sign and middle bracket from each expression. Now you will get each field expression then use formula.

 

Thanks

Hardesh

@ComputerHabit2 

Please check my previous expression. In your expressions question mark is missing. Please match bit by bit.

 

Thanks

Hardesh

I'm testing now.  Took a little while to come back to this.  🙂

Works on string:

if(empty(triggerBody()['text_1']),body('Get_file_current_properties')?['Title'],triggerBody()['text_1'])

 

Fails on a number.  

if(empty(triggerBody()['number']),body('Get_file_current_properties')?['qaDatabaseID'],triggerBody()['number'])

 

It says empty expects a string,array,object.

 

Know how to test for an empty 'number'?

ComputerHabit2
Resolver III
Resolver III

Marked as answer but still fails.

 

if(empty(triggerBody()['text_1']),body('Get_file_current_properties')?['Title'],triggerBody()['text_1'])

 

 

It fails because it says there is no value called [text_1] but it works when the value is populated.

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

New Process Advisor Capabilities carousel.png

Read the blog for the latest news

Read the latest about new experiences and capabilities in the Power Automate product blog.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

PA Survey Carousel Image.png

We want to hear from you!

If you are a small business ISV/Reseller, share your thoughts with our research team.

Users online (2,048)