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

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 II
Super User II

@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 II
Super User II

@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

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 I
Resolver I

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
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (60,737)