cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
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
Highlighted
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

Highlighted

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'])

Highlighted

@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

Highlighted

@ComputerHabit2 

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

 

Thanks

Hardesh

Highlighted

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

Highlighted

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'?

Highlighted
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
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 Solution Authors
Top Kudoed Authors
Users online (9,693)