cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

If() statement error: the expression is invalid. Please advise what Is wrong with it?

the if statement is like this: IF(body('get_item')?['Are_x0020_Both_x0020_Ends_x0020_']='True','Yes','No')

I have tried also many other, but thought I wouldpost this one: 

IF(body('get_item')?['Are_x0020_Both_x0020_Ends_x0020_']=bool('True'),'Yes','No')
Note the value is boolean true or false
2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Kudo Kingpin
Kudo Kingpin

Re: If() statement error: the expression is invalid. Please advise what Is wrong with it?

Hi @SharepointRex,

Can you please Try Below formula in Compose Connector, I reproduced your issue using this formula in compose connector and its working fine

 
"if(equals(variables('Column30'),true),'Yes',if(equals(variables('Column30'),false),'No','other'))"
In Above Formula Please replace bold Text with your column Name.
FlowFlowOutputOutput
Note: your column value Has to be in Boolean type. 
If you find this helpful, please Mark it as a Solution
 
Thanks,
Harry_G

View solution in original post

Highlighted
Super User III
Super User III

Re: If() statement error: the expression is invalid. Please advise what Is wrong with it?

@SharepointRex

 

You need to use the equals() function and not the = sign.

Flow does not accommodate = + - ÷ etc. and there are equivalent functions for each.

 

Scott

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

5 REPLIES 5
Highlighted
Frequent Visitor

Re: If() statement error: the expression is invalid. Please advise what Is wrong with it?

I have another - similar..

IF(body('get_item')?['Column30']='WIM4','A','B')
Can't save - The expression is invalid.
Highlighted
Kudo Kingpin
Kudo Kingpin

Re: If() statement error: the expression is invalid. Please advise what Is wrong with it?

hi @SharepointRex,

You can use condition connector for this purpose , Condition Connector by default give you if condition functionality.

Capture.JPG

 

If this solution is helpful, Please Accept it as a Solution.

 

Thanks,

Harry_G

Highlighted
Frequent Visitor

Re: If() statement error: the expression is invalid. Please advise what Is wrong with it?

Hello Harry,

No I can't use a condition - there is now where to add the condition in at the point where the issue arrises - the problem is like this;

snip demonstrate why can;t use condition to allow if statementI wanted to put content in depending on what was on column 30, as part of the flow (copy item from one sharepoint list to another)

So I have used expression, selected an logical expression if() to asses column 30 and put certain info into [Primary Machine Process Instructions] column based on the assesment. But the if() statement as submitted it won't let me save the statement - what is it requiring to allow it to be valid?

Would love some developed help topic/document on this - the ones available are too broad...

So reliant on advice system this way.... hope my case is not to difficult!

Highlighted
Kudo Kingpin
Kudo Kingpin

Re: If() statement error: the expression is invalid. Please advise what Is wrong with it?

Hi @SharepointRex,

Can you please Try Below formula in Compose Connector, I reproduced your issue using this formula in compose connector and its working fine

 
"if(equals(variables('Column30'),true),'Yes',if(equals(variables('Column30'),false),'No','other'))"
In Above Formula Please replace bold Text with your column Name.
FlowFlowOutputOutput
Note: your column value Has to be in Boolean type. 
If you find this helpful, please Mark it as a Solution
 
Thanks,
Harry_G

View solution in original post

Highlighted
Super User III
Super User III

Re: If() statement error: the expression is invalid. Please advise what Is wrong with it?

@SharepointRex

 

You need to use the equals() function and not the = sign.

Flow does not accommodate = + - ÷ etc. and there are equivalent functions for each.

 

Scott

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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!

Top Solution Authors
Top Kudoed Authors
Users online (6,812)