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

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
Harry_G
Level 8

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.
Capture.JPGFlowCapture.JPGOutput
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

Super User
Super User

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
SharepointRex
Level: Powered On

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.
Harry_G
Level 8

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

SharepointRex
Level: Powered On

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!

Harry_G
Level 8

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.
Capture.JPGFlowCapture.JPGOutput
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

Super User
Super User

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 175 members 5,154 guests
Please welcome our newest community members: