I am back with another blog on Power Apps and this is one more for citizen developers who are still finding their feet in PowerApps.
While conducting trainings on Power Platform, one of the frequent question I get from citizen developers and sometimes even from experienced developers coming into Power Platform is – “How do I check for NULL values in a Canvas App“.
Let’s take an example here. Suppose we have a combobox control on Canvas app screen and you want to perform an operation if no item is selected in Combobox.
In Power Apps, your formulas are essentially functions and anything unknown or ‘no value‘ is represented as blank in Power App. And quite obvious, to check NULL value there is function – IsBlank().
And we can write a formula like the one below which is setting a label text depending on Combobox value.
Pretty simple. Let’s take a more complex scenario.
In the below formula, I have created a table and used a global variable “DemoTable” to hold the Table structure.
Set(DemoTable, Table({'Name': "Debajit Dutta", Id: 1}, {'Name': "John Miller", Id: 2}, {'Name': "Chandana"}))
If you carefully look into the formula above, the table currently have three records and the last record does not have the Id field populated.
Now in the next screen, I have a textbox and I set the text of the input textbox to below formula.
Observe how I am comparing with the Blank() function here to find the record which does not hold a value for Id field. While this may sound relatively easy, more often than not I have seen developers on Power Apps using the IsEmpty function for these scenarios.
Hope this helped!
You might also like the below posts.
Debajit Dutta
Business Solutions MVP
Discover more from Debajit's Power Apps & Dynamics 365 Blog
Subscribe to get the latest posts sent to your email.