cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aarvind1
Helper I
Helper I

Use If Expression to Evaluate a Variable

I am trying to write an if expression to return a specific value if the statement is true.  Here is what I am hoping to accomplish.

 

I have a variable of type String:  strAutoRenewValue that is set using a Yes/No column in SharePoint Document Library column.  If the value is Yes, I want it to return "IS" or "IS NOT" if No. Below is what I have been I get expression not valid. What am I doing wrong?

 

if(equals(strAutoRenewValue, 'Yes'), 'IS''IS NOT')
 
Thank you.
1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

 

Hi @aarvind1 ,

 

Please try the following configuration:

83.PNG84.PNG

if(equals(variables('strAutoRenewValue'),true),'IS','IS NOT')

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
ManishJain
Solution Sage
Solution Sage

Hi @aarvind1 ,

 

Please use this expression :
 
if(equals(variables(variables('strAutoRenewValue')), 'Yes'), 'IS''IS NOT'
 
Thanks

Thank you @ManishJain .  When I tried to save I get the following error that I am not sure what to do with. Seems like variables in the expressions need to declare?

 

The template validation failed: 'The template action 'SetAutoRenewalValue' at line '1' and column '6094' is not valid: "The template function 'variables' is not expected at this location.".'.

Hi @aarvind1 ,

 

Don't you have variable "strAutoRenewValue " declared at the beginning to be precise. Please share screenshot of your flow to help further.

 

Thanks

I do. Here is a screenshot.

 

Screenshot2.jpg

Screenshot.jpg

@ManishJain 

If this is a SharePoint Yes/No column, you need to be testing in you if expression or condition for true or false and not Yes or No.

if(equals(strAutoRenewValue, true), 'IS''IS NOT')

 

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

Scott
v-bacao-msft
Community Support
Community Support

 

Hi @aarvind1 ,

 

Please try the following configuration:

83.PNG84.PNG

if(equals(variables('strAutoRenewValue'),true),'IS','IS NOT')

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,608)