Hi all,
Does anyone know how to write 'do nothing' in if statement when the condition is not true?
example if ( condition, 'do an action', 'do nothing')
Thanks in advance
Solved! Go to Solution.
Hi @petergriac,
If you want to do nothing when the condition is not true, you just need to leave the If no branch of the Condition blank, do not add any actions in it.
And you could add actions that you want to to do in the If yes branch of the Condition.
Best regards,
Alice
Hi
Just put false in the false part of the If STatement
Regards
Nigel
Hi @petergriac,
If you want to do nothing when the condition is not true, you just need to leave the If no branch of the Condition blank, do not add any actions in it.
And you could add actions that you want to to do in the If yes branch of the Condition.
Best regards,
Alice
Thanks,
This works.
Regards,
Peter
In my case this does not work. It throws my an error
Fix the dependent actions, I guess?
How can we use an expression to signify "do nothing"? I can't use the gui condition connector due to checking the condition inside of a column for "update a row in a table connector"
Hi @kgreen8790,
could you please rephrase?
In the originally accepted solution the author stated to leave the "No" window blank to solve the "do nothing if false". Due to my use case I can not use the "Condition" connector in the power automate GUI. I'm wondering if there is a way to achieve the same result with a written expression. Currently if I leave the third parameter blank on my written if statement expression I get an error saying "if requires 3 parameters, only received 2". I've tried if(equals(item(), 'X'), 'Do X', false) but in this instancte the flow actually places the word false on my spreadsheet (which is what I'm using the condition for). If I try if(equals(item(), 'X'), 'Do X',) I get the beforementioned "requires 3 parameters only received 2" error. So, in closing is there a way to express an written if statement where the false comparative simply takes no action?
Try to use something like tis:
if(equals(item(), 'X'), 'Do X', null)
I am having the same issue. I have tried the following expressions with a excel data source and writing to D365. Both still clear out the data in D365. I don't want to create multiple conditions in the flow to accomplish this as I have a lot of fields that needs this logic. I have used this same expression with a Microsoft Form data source it is still works. But when I switched to an excel data source it no longer works.
if(empty(outputs('ListRows')?['Main Phone']),' ' , outputs('ListRows')?['Main Phone'])
If I'm reading your if statement correctly your checking if output from List Rows: Main Phone is empty, if so do nothing, if List Rows: Main Phone has value then your having it update a row in dataverse with the 'Main Phone' value. Is that correct?
If so you may want to try equals(outputs('ListRows')?['Main Phone'], '') rather than 'empty'. I haven't used the empty evaluator before so I'm unfamiliar with its behavior but I've used the equals evaluator to check for empty string via ' ' and have had success with this.
Thanks for the info. I did end up re-writing the expression a little differently to get the job done. But I do believe the null expression worked at one time as I had several flows using this format.
The point if that this is incredibly bad coding practice. By leaving it blank anyone reading the "code" (either the "programmer" or as a reviewer) doesn't know if this is intentional or not.
User | Count |
---|---|
16 | |
16 | |
14 | |
9 | |
8 |
User | Count |
---|---|
27 | |
26 | |
24 | |
23 | |
14 |