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

Having trouble with a condition - it keeps on saying it is false.

I am working on a Management of Change Approvals process, using Microsoft Flow.

 

I have 14 different MOC Team members (MOC1 through MOC14), all who which can approve or reject the change request.

I have my flow set up so that if MOC1 approves, the comments go into the MOC1-comments column, the response goes into the MOC1-status column, and the number one goes into the MOC1-approved column.  The same for MOC2 through MOC14.

 

I also have a calculation column, that adds up the MOC1-approved through MOC14-approved columns, to have a running total of the number who have approved.

 

I am having trouble setting up a condition, so that when the number approved column value is '14', then the if yes will occur (updating an item and sending emails).

 

It keeps on returning that the result for the condition is false, and won't progress to the next steps.

Looking at list, all my columns are showing '14', but it still won't progress.

 

I have tried various conditions, including:

'Number approved' 'is equal to' '14'.

 

''Number approved' 'is equal to' 'Number required', where the number required column is set with the number '14'.

 

I have also tried an action to copy the calculated 'Number approved' column to a different 'MOC approved number' column, in case using a calculated value column in a condition was causing problems, and then having

'MOC approved number' 'is equal to' '14'.

and

'MOC approved number' 'is equal to' 'number requireed', which was set to '14'.

 

I have kept the number of decimal places as 0 in all the columns, to try to keep the 14's all the same.

 

I have even tried ends with and starts with conditions, but it wants everything to be strings in that case (not an integer).

 

Does anyone know how to make a condition work so that the if yes will progress when the calculated value becomes 14?

 

I would appreciate any assistance you can offer.

 

Many thanks,

 

Adam

2 REPLIES 2
Community Support Team
Community Support Team

Re: Having trouble with a condition - it keeps on saying it is false.

Hi @ AdamBradbury198,

 

Could you please share a screenshot of the configuration of your flow?

Could you please share more details about the "Number approved" column? Is it a calculated column in your sharepoint list?

 

 

I afraid the the value of the calculated column is not equal to "14" so the Condition keeps on saying it is false.

 

Please take a try to add a compose before the Condition,and choose the "Number approved" dynamic content in the input field of the Compose,and run the flow to see the value of the "Number approved" column.

 

I have made a test on my side to create a alculated column "Number approved" in sharepoint s below:

Capture.PNG

 

 

I have created a flow as below to test the value of "Number approved" column:

Capture.PNG

 

The flow would run successfully as below:

Capture.PNG

 

So the value of the "Number approved" column is "14.0000000000000".

 

You could take a try to add the expression as below in the Condition:

 

@equals(int(items('Apply_to_each')?['Number_x0020_approved']), 14)

 

The expression "items('Apply_to_each')?['Number_x0020_approved']" instead of dynamic of the "Number approved" column

 

I have created a flow as below:

Capture.PNG

 

 

The flow would run successfully as below:

Capture.PNG

 

 

Regards,
Alice Zhang

AdamBradbury198
Level: Powered On

Re: Having trouble with a condition - it keeps on saying it is false.

Hi Alice Zhang,

 

Yes the number approved column is a calculated column.   It is the sum of the number '1' that is in the 14 x [MOC#-Approved] columns [MOC1-Approved] through [MOC14-Approved].

Capture - calculation column.PNG

 

Once all the approvals have been performed, the view shows that this number is 14

(Even though it is actually 14.0000000000000 - as I have set the column to show zero decimal places, so the 13 0's are not present).

Capture - Number approved from view.PNG

 

 

I have tried implementing the expression you detailed in my flow: 

@equals(int(items('Apply_to_each')?['Number_x0020_approved']), 14)

Capture Condition 14.PNG

 

Initially, I thought it was working, however when I have just tested it by creating a new request, it gave a 'True' condition even when giving an output number of 0 {approved}.

Capture - 0 is true_should be 14 is true.PNG

Within seconds of creating the new item, it had sent out the email stating that Conditional approval had been granted, basically at the same time as the Approval request emails went out.

Capture - entire flow fired.PNG

I need it to wait untill all 14 Team members have approved before it triggers the next step.

 

@equals(int(items('Apply_to_each')?['Number_x0020_approved']), 14)

 

How do I make it only be True if the [Number approved] column = 14,

not when it is 0, or 6, or any other number that is not 14.

 

Also, I had a question about the expression you showed me.

In the expression you used, why is the ('Apply_to_each') needed?

 

I previously hadn't been using a 'Get Items' or 'Apply to each' in my flows.

 

Many thanks,

 

Best regards,

 

Adam

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,992)