Forum Discussion
If(Not(IsBlank([DataCardValue]) is always returning true in cases where it should not
- Jul 14, 2023I started a new issue titled: Incompatible types for comparison. These types can't be compared: Table, Number. Setting this update as the best response on this issue so the issue won't have duplicate tickets.
The issue you are experiencing is that the If Not IsBlank function is always returning true even when the DataCardValue is blank. This is because the IsBlank function only checks if the value of the DataCardValue is empty, not if it is visible. In your case, the DataCardValue is visible, but it is empty.
There are a few ways to fix this issue. One way is to use the HasValue function instead of the IsBlank function. The HasValue function will check if the DataCardValue has any value, regardless of whether it is empty or not.
Another way to fix this issue is to use the Visible property of the DataCardValue. If the DataCardValue is visible, but it is empty, then you can set the Visible property to false. This will hide the DataCardValue, and the If Not IsBlank function will no longer return true.
Here is an example of how to fix this issue using the HasValue function:
If HasValue(DataCardValue1) Then // Do something Else // Do something else End If
Here is an example of how to fix this issue using the Visible property:
If DataCardValue1.Visible Then // Do something Else // Do something else End If
I hope this helps.
- Acorn999Jul 14, 2023Brass Contributor
Very Appreciated for your help. Both of your solutions were not successful.
1. HasValue() is not a known function in MS PowerApps. It looks like it is related to checking whether a Media data type field in a record has been initialized with a media object and that the object exists - for Dynamics NAV.
2. Whether the field is visible or not: What causes certain fields to only show when a given tab is selected is the Visible property. This is what makes the tabbed form work as a tabbed form. Normally I set the Visible Property to:
varTabSelected=2
So that it only shows when tab 2 is selected.
In response to your suggestion,
I can't set the Visible Property to false if the field is blank because I have no working function to know of the field is blank - that's my issue, ,Not(isBlank is always returning true, and I need the Visible Property to show the field only if the associated tab is selected, whether or not the field is blank.
However, to test if the visible property is having an effect or causing this issue, I set the Visible property to true so the field always shows regardless of which tab is selected. In this scenario, the issue persists.