Expression language
Empty values
Learn how expressions treat fields and inputs that have no value, and avoid the most common surprises.
In CRM data, empty fields are normal: a contact without a mobile phone, an opportunity without a discount, a case that is not resolved yet. Logic Fabric never stops a run just because a value is empty. Instead, each function has a defined, predictable answer. Most of the time that answer is what you expect, but a few rules catch people out. This page lists them so you can design for them.
“Empty” means the field or input has no value (in Dataverse terms, it is null). Empty text "" is treated as empty by some functions but not all, as noted below.
The rules at a glance
Section titled “The rules at a glance”| Situation | What happens |
|---|---|
| Arithmetic with an empty number | The empty number counts as 0 |
| Comparing an empty number | The empty number counts as 0 |
| An empty Yes/No in a condition | Counts as No |
| Text functions with empty text | Usually return empty text (or 0 for String Length) |
| Joining text with an empty value | The empty value adds nothing |
| Date functions with an empty date | Usually return empty |
| Date differences with an empty date | The empty date counts as Now |
| List totals with an empty list | Return 0 |
| First or last item of an empty list | Returns empty, not 0 |
Empty numbers count as zero
Section titled “Empty numbers count as zero”In Add, Subtract, Multiply, Divide, Modulo, Raise to Power, Max Value and Min Value, and in number comparisons, an empty number is treated as 0.
This keeps calculations running, but it changes what some conditions mean:
discountpercentage = 0is true when the discount is empty.estimatedvalue > 1000is false when the estimated value is empty.Max(0, estimatedvalue - Discount)treats an empty discount as no discount, which is usually what you want.Min(creditlimit, RequestedAmount)returns0when the credit limit is empty, which may not be what you want.
The same rule applies to list totals. Collection Sum, Collection Average, Collection Minimum and Collection Maximum count empty items as 0, so an empty score drags an average down and can become the minimum. Use Filter with Not Null to drop empty items first. An empty or missing list gives 0.
Empty Yes/No counts as No
Section titled “Empty Yes/No counts as No”- And and Or treat an empty Yes/No as No.
- If Condition treats an empty condition as false and returns the Else value.
- Filter drops items whose condition is empty.
- Is True is false for an empty value, but Is False is true for an empty value. If you need to tell “No” from “not answered”, use Null first.
Empty text
Section titled “Empty text”- Concatenate and Join skip empty values, so you never see the word “null” and never get doubled separators such as
"a, , b". - String Length returns
0. - Trim, To Upper Case, To Lower Case, Substring, Left, Right, Base64 Encode and Base64 Decode return empty text.
- Contains, Starts With and Ends With compare empty text as
"". - Null Or Empty String is true for empty values and for
"", but not for text that contains only spaces. To treat" "as empty, checkTrim(value)instead.
Empty dates
Section titled “Empty dates”- Day, Month, Year, Day Of Week, the Add date functions, Start Of Day, Start Of Hour, Start Of Month, Parse DateTime, Convert From Utc and Convert To Utc return empty for an empty date.
- An empty amount in Add Days, Add Hours and the other Add functions adds nothing.
- Days Diff, Hours Diff, Minutes Diff, Months Diff and Years Diff treat an empty date as Now. So
Days(createdon, resolvedon)measures up to the current time for a case that is not resolved yet. Check Not Null first if that matters. - Is Business Day returns false for an empty date; Add Business Days and Business Days Between return empty.
Empty lists and items
Section titled “Empty lists and items”- Collection Count returns
0for a missing list. - First Item, Last Item and Item at Position return empty for an empty list, even for lists of numbers.
- Any is true when the list has at least one item, even if that item is itself empty. A missing or empty list gives false.
- Contains Item returns false for a missing list.
- Add Items ignores an empty item.
Choosing a fallback
Section titled “Choosing a fallback”To replace an empty value with a sensible default, use First Non-Empty. It returns the first value that is not empty, and treats "" as empty:
Coalesce(mobilephone, telephone1, Account.telephone1)
When every value is empty, the result is still empty, so you can test it with Null.
The conversion functions have their own fallback: To Whole Number, To Decimal and To True/False return the value in Default if conversion fails when the input is empty or cannot be converted.
Results that are never empty
Section titled “Results that are never empty”If Condition never returns an empty number or Yes/No: if the chosen branch is empty, the result becomes 0 for numbers and No for Yes/No. Switch likewise returns 0 instead of an empty number. If you need to pass “no value” on, test the input with Null before you use the result.