OK, this is odd - was 'debugging' some issues in an App sent to me...
See image below.
1. Return checkbox.value to a label- reported as 'false'
2. So checkbox.value = false? Apparently not
3. But, 'checkbox.value = true' is false? Yes it is
On closer investigation the Default of the checkbox was set to Value(txt_plexiSheets.Text)>0, which returns error when when there is no text in txt_plexiSheets. But in that case the CheckBox value should either return error in the label, or it should return false in the label and actually mean false (when doing logical comparison), not return false in the label but error for logical comparison.
Thanks for following up @danielbazetto
The issue appears to be related to how null/empty/error values are handled. The Default property for the checkbox was based on a formula checking the value of a text box that was often empty. The returned value of the text box is really 'error' but shows in some places as False.
I have reported this (via the forum) and is an acknowledged bug. This may relate to the Experimental setting 'Formula-level error management' but typically I have to have this turned on or PowerApps doesn't handle nulls in datasources properly.
I suspect this is a change in behaviour in a recent update as I had not noticed it prior to a couple of months ago, but now I am seeing the issue in a lot of places (most commonly when trying to determine if a combo box is populated - different results are returned depending on whether the combo has been reset or whether an entry has been selected and then cleared).
Have to comment that this is really frustrating and has resulted in many lost hours trying to trace bugs/issues - hours that I'm starting to think may have been better spent developing our solutions on a more reliable platform.
This problem is NOT only appearing in CheckBoxes.
We just ran into this (very hard to debug) issue:
- App works FINE in Editor
- Visibility of some elements DOES NOT WORK in Player
- Turning off "Formula-level error management" caused all elements to be visible in Player
Code sample: This was not working without Formula-level Error Management turned OFF
If( And( CountRows(colTest) > 0, Or( !icnCircle.Visible, icnSquare.Visible) ), true, false )
Yep - with Formal level error management turned ON, I suspect your collection (colTest) when initially empty is actually being treated like an error, so the CountRows returns an error instead of True/False. If you populate it and then clear it, I suspect it is treated as an empty array (this is very similar to how combo boxes are behaving when you check the SeletectedItems array). As you say, very hard to debug, especially if not consistent between the Player and Studio (note also that the formula bar often evaluates differently to the controls as well).
Frankly I (and my clients) are losing faith rapidly in this platform. I appreciate 'Formula level error management' is an experimental feature, but I believe it has been that way for over a year and it is essential to turn it on to overcome other serious bugs/limitations in the platform (not handling nulls in datasources correctly).
I hope the Apps I published before this error was introduced are OK, but now I am nervous to make changes to existing apps (even correcting a typo in a label) because when re-published they will be on the latest version and so will likely be affected by this bug.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.