cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tiarna_Wynne
Regular Visitor

Condition inside apply to each not evaluating correctly

Hi all,

 

I am trying to set up daily email notifications based on an excel spreadsheet that is attached to Power Apps. Sport Directors will use the app to supply coach information (name, d.o.b, etc.). I need daily email notifications with details of all new entries for approval. I am trying to use the column 'Steve Approved' as a condition for including the row of data in the notification. If this column entry = "Yes", the data is not included, otherwise it is included.

 

After listing the rows present in the table, I have used an 'apply to each' - value - then a condition that it attempting to verify the contents of that column. However, everytime I run the test, this condition evaluates all entries the same. 

Tiarna_Wynne_0-1632117481812.png

 

The condition I have tried using is: [contains(string(items('Apply_to_each')?['Steve_Approved']),'Y')] 'is equal to' 'true'. I have also tried using various combinations of empty(), null, If statements, etc. 

 

Inside my spreadsheet, I definitely have one entry that says 'Yes' and two that are empty:

Tiarna_Wynne_1-1632117576548.png

 

No matter what I have used in the condition, all three rows evaluate the same each time. Currently, the condition above evaluates to false for all three rows.

 

Any help is appreciated!!

9 REPLIES 9
abm
Super User
Super User

Hi @Tiarna_Wynne 

 

Whats your Excel Data Type column 'Steve Approved'?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Good Morning,

 

I have tried both 'General' and 'Text' Data Types for this column.

abm
Super User
Super User

Hi @Tiarna_Wynne 

 

Thanks for your reply. Why you using the contains() expression here. Can't you directly check whether the value is Y or not? Did you tried that option?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @abm 

 

Ideally, I would like to check if the field is empty. However, that wasn't working. I changed it to contains just for testing purposes. None of the conditions I put in here are evaluated properly.

 

I have tried:

contains(string(items('Apply_to_each')?['Steve_Approved']),'Y')

contains(string(items('Apply_to_each')?['Steve_Approved']),'Yes')

equals(string(items('Apply_to_each')?['Steve_Approved']),'Y') 

equals(string(items('Apply_to_each')?['Steve_Approved']),'Yes') 

empty(string(items('Apply_to_each')?['Steve_Approved']))

I also tried testing the length of the string.

 

All of these evaluate the same for the three rows in my spreadsheet.

Hi @Tiarna_Wynne 

 

I tried the below and worked as expected

 

image.png

 

Excel File

 

image.png



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @abm 

 

I have now managed to get that to work. However, it would be ideal if I could get the empty() option to work. The idea being that 'Steve' can enter 'Yes' for approved or 'No' for not approved, and I only want to pick up the ones that have not had yes/no entered into that column. Additionally, I feel it is safer to check for the empty field in case short hand (y/n) is used or in case of a mistype.

Tiarna_Wynne
Regular Visitor

Hi @abm 

 

I have the same issue with my other fields. I need to use a date field as a condition and perform subsequent actions if the date field is empty. However, it continues to evaluate as empty even when there is a date in it.

 

I have tried 

items('Apply_to_each')?['Employee_contract_issued_date'] 'is equal to' 'null'
empty('Apply_to_each')?['Employee_contract_issued_date'] 'is equal to' 'true'

Hi @Tiarna_Wynne 

 

The current IF condition (NO) still evaluates for empty. Are you looking to filer the values which contains Yes/No only? Please see below

 

image.png

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

Hi @abm 

 

Not sure what you mean by "The current IF condition (NO) still evaluates for empty."

 

I am trying to achieve the following:

1. Read all rows from the table

2. Rows that have nothing in the 'Steve Approved' Column are emailed to Person A

3. Rows that have 'Yes' in the 'Steve Approved' Column and nothing in the 'Contract Issued' column are emailed to Person B.

4. Rows the have 'Yes' in the 'Steve Approved' Column, a date in the 'Contract Issued' column and nothing in the 'Director Notified' column are emailed to Person C.

 

The only rows I want to ignore completely are those that have 'Yes' in the 'Steve Approved' Column, a date in the 'Contract Issued' column and 'Yes' in the 'Director Notified' column.

 

I can work around the empty() not working for step 1 by assuming the contents will always be either 'Yes', 'No', or Blank however I can't do that for the date column.

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.

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 (3,011)