In this post today, let us see one of the lesser known function named Coalesce
Most of the times, the value we pass through a variable to Power Automate or PowerApps functions to process the business data may not arrive and may cause data processing failures due to NULL values.
The Coalesce function helps (Citizen) developers to avoid NULL values issues in data processing by enabling to pass default values when required.
Here is the expression for Coalesce... to handle NULL values
In the below example we are passing only Name and Email values to another HTTP request.
But at the receiving end point we are trying to capture Country value too,
which is not available in the input values. Let us how can we handle this using Coalesce
coalesce(triggerBody()['country'],'India')
with the above expression, though the COUNTRY value is not received we can have it filled with
INDIA as we are using COALESCE.
if(empty(variables('Country')),'N/A',variables('Country'))
In the above example if the Country value is empty - we can tweak it with required default input i.e., "N/A".
No comments:
Post a Comment