Hi @saranp780 ,
Focusing purely on the error - what is SelectAll_activate resolving to?
You may also want to confirm that the way you've written your formula is giving you the output you want. It may be "working" in the one instance, but is it working the way you think it is?
The construct of the If() statement can be one of the following;
If( condition, value if true, value if false)
If( condition, value if true, condition, value if true, condition, value if true, ...., value if none of the conditions is true)
Note:
- Condition will always be immediately followed by value if true.
- The default value would normally follow a value if true, but it is optional - so if you leave it out, PowerApps doesn't throw out an error.
Your "working" code is being resolved by PowerApps as follows;
If( condition, SelectAll_activate/delete, true, false)
Note you have two conditions and two correlating value if true statements in the above, with no default or value if false conditions -
- condition & SelectAll_activate/delete, and
- true & false
This happens because a condition statement can be replaced by a pure boolean and the formula will be valid - even if the condition outcome is forced.
By specifying a boolean in the place of a condition you are telling PowerApps that the condition result will always be true, and if it evaluates that condition it will therefore always return the value if true that comes immediately after the condition - which in your case, the value to return if true has been specified as false.
It will only evaluate this second condition, if the first condition is false.
If all conditions are false, it will return Blank.
Hope this explanation helps,
Kind regards,
RT