web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : Ky6SWtHKssld93W1EptZWs
Power Automate - Building Flows
Answered

(if) Condition do nothing/ keep current value

Like (1) ShareShare
ReportReport
Posted on 1 Jun 2022 13:22:36 by 16

Hello everyone,

 

there have already been some discussions on how to build an if condition that does nothing when false. However those Solutions do not seem to work for my case. Maybe you have some ideas to help me with this:

The request seems to be quite simple: If a certain colum(Actiontype) as a defined value do some calculations and put them into an other colum (Sum1). The Actiontype defines which sum colums (sum1-4) have to be updated. The sum colums already have some calculated values. 

I am using the Dataverse Connector but anyways I though this should work: Solved: do nothing in if function - Power Platform Community (microsoft.com) 

If eq(Actiontype),2, calculate and update sum1, do nothing

 

if(equals(triggerBody()['number']),2,variables('SummeEtat'))
if(equals(triggerBody()['number']),2,variables('SummeEtat'),)
if(equals(triggerBody()['number']),2,variables('SummeEtat'),'')

 

which either is not recognizes as a valid expression or promts this error:

 

Unable to process template language expressions in action 'Update_Controlling_Position_Etat_ANF_Prod' inputs at line '0' and column '0': 'The template language function 'equals' expects two parameters: the values to test for deep equality. The function was invoked with '1' parameter(s). Please see https://aka.ms/logicexpressions#equals for usage details.'.

 

 I have tried puting the current value of the field into the false condition but since the current value comes from one apply to each container and the if condition is in another apply to each container I get another error that the first apply to each has to be superior to the second one which is understandable. 

So maybe anyone has another idea on how to form an expression that updates a value if true and simply does nothing to the existing value if false. 

 

Thank you in advance

  • moko33 Profile Picture
    35 on 18 Jul 2022 at 23:28:40
    Re: (if) Condition do nothing/ keep current value

    I found out that the dataverse record is NOT going to be updated (so it's doing nothing) if for the "do nothing case" your formula delivers the same value that the trigger already delivered.

     

    if(equals("do nothing","do nothing"),TriggerFieldContent,else...)

  • Verified answer
    eliotcole Profile Picture
    4,266 Moderator on 01 Jun 2022 at 20:54:50
    Re: (if) Condition do nothing/ keep current value

    It is failing because your equals() functions are a little bit off, @TimFe, if you don't mind me saying.

     

    This is what you currently have in that first if() statement, and I've fanned it out so you can see:

    if(
     equals(
     triggerBody()['number']
     ),
     2,
     variables('SummeEtat')
    )

    What you have there is an equals statement without its second parameter. Your other two are similarly (but not the same) just a little off (I've fanned them in the below spoiler):

     

    Spoiler (Highlight to read)
    If #2 also has a bad equals, but the end of the if has an extra comma which infers more should be there:
    if(
     equals(
     triggerBody()['number']
     ),
     2,
     variables('SummeEtat'),
    )
    If #3 is perhaps probably closest to what you're after, here, you wish it to be empty or null on the false branch.

    It just still has the bad equals 😉:
    if(
     equals(
     triggerBody()['number']
     ),
     2,
     variables('SummeEtat'),
     ''
    )
    If #2 also has a bad equals, but the end of the if has an extra comma which infers more should be there: if( equals( triggerBody()['number'] ), 2, variables('SummeEtat'), ) If #3 is perhaps probably closest to what you're after, here, you wish it to be empty or null on the false branch.It just still has the bad equals : if( equals( triggerBody()['number'] ), 2, variables('SummeEtat'), '' )

    So, using your 3rd if() as a basis, this would run correctly:

    if(
     equals(
     triggerBody()['number'],
     2
     ),
     variables('SummeEtat'),
     ''
    )

    All that was done was moving that ',2' inside the equals(). Now it will check to see if triggerBody()['number'] is equal to 2 ... then it will pass the variable 'SummeEtat' if it is 2, and nothing if it isn't.

     

    Plus, as @tom_riha, mentioned, you can also use null. Just make sure that the input you're entering null into is able to accept a null value. 👍 ... @tom_riha wrote:

    Spoiler (Highlight to read)

    Hello @TimFe,

    I'd try two ideas:

    1. use null value

    if(equals(triggerBody()['number']),2,variables('SummeEtat'),null)

    2. keep the original value

    if(equals(triggerBody()['number']),2,variables('SummeEtat'),<the current value>)

    e.g.

    if(equals(triggerBody()['number']),2,variables('SummeEtat'),triggerBody()['number'])
    Hello , I'd try two ideas: 1. use null value if(equals(triggerBody()['number']),2,variables('SummeEtat'),null) 2. keep the original value if(equals(triggerBody()['number']),2,variables('SummeEtat'),<the current value>) e.g. if(equals(triggerBody()['number']),2,variables('SummeEtat'),triggerBody()['number'])

     

  • tom_riha Profile Picture
    10,127 Most Valuable Professional on 01 Jun 2022 at 19:36:00
    Re: (if) Condition do nothing/ keep current value

    Hello @TimFe ,

    I'd try two ideas:

    1. use null value

    if(equals(triggerBody()['number']),2,variables('SummeEtat'),null)

    2. keep the original value

    if(equals(triggerBody()['number']),2,variables('SummeEtat'),<the current value>)
    
    e.g.
    if(equals(triggerBody()['number']),2,variables('SummeEtat'),triggerBody()['number'])

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 2

Loading complete