Comparing blank Text and Number data types: Why do they evaluate as unequal?

Hi everyone,

I’m running into a behavior with blank values and type-casting in an AND() condition, and I want to understand the exact mechanics of how AppSheet’s expression engine evaluates this.

I have a condition that includes this line: [Alias] <> TEXT([Serial No])

  • [Alias] is a Text data type.

  • [Serial No] is a Number data type.

When a new record is created and both fields are completely blank, I expected this condition to evaluate to FALSE (since blank should equal blank). Instead, it evaluates to TRUE, meaning the rule passes.

My questions

  1. Are blank Number and Text data types evaluated differently at the moment of record creation (e.g., NULL vs "" vs 0)?

  2. If [Serial No] is a blank number, what exactly does the TEXT() wrapper output? Does it cast the uninitialized number to a 0 first (resulting in "0"), causing it to mismatch the "" of the Text data type value?

I want to understand the fundamental logic of how TEXT() handles uninitialized numeric blanks in comparisons.

If [Serial No], a Number value, is blank (i.e., empty, undefined, null), TEXT([Serial No]) returns a blank Text value, equivalent to ""in an expression.

This is trivial to test.

Hi @Steve,

Thanks for confirming how TEXT() handles blank Number data types. That helps narrow things down, but it leaves me with a mystery on why my action condition is behaving this way.

To give you the full context, I am using [Alias] <> TEXT([Serial No]) as the “Only if this condition is true” expression for an action. The action itself simply sets the value of the [Alias] field to TEXT([Serial No]).

I added this condition to ensure the action isn’t enabled unnecessarily when both fields are essentially the same.

The Problem

When testing this for completely new records, both fields start blank. Based on your explanation that TEXT() outputs an empty string for a blank number, I expected the comparison to be "" <> "".

That should evaluate to FALSE, keeping the action disabled. However, the action is still being triggered via manual trigger/automation, meaning AppSheet is evaluating the condition as TRUE.

Why I’m using the TEXT() wrapper for “Only if this condition is true” expression

To ensure that different data types don’t cause the condition to constantly pass as TRUE.

If I simply use[Alias] <> [Serial No], AppSheet might look at a Number (100495) and a Text string ("100495") and decide they aren’t equal strictly because of the type mismatch. Parsing the Serial Number as text seemed like the safest way to get a true 1:1 comparison.

The Google Sheets Factor

My data source is Google Sheets (converted to a native Google Sheets table). I know that Google Sheets often adds a single leading quote (') to a cell to force a number to behave as text.

While I wonder if AppSheet might be comparing an empty string to a hidden formatting character (like that quote or a space) in the background, that shouldn’t essentially be an issue for new records where the values are completely blank.

Given that TEXT() outputs a clean empty string, and sheet formatting shouldn’t apply to empty cells, what else could be happening under the hood that causes AppSheet to see a mismatch between these two blank fields?

Look here next:

My bad…

After reviewing my test steps again, I realized the expression [Alias] <> TEXT([Serial No]) is correctly evaluating to FALSE when both are completely blank, exactly as you mentioned.

The real culprit was my automation setup. It’s a grouped data action, and the sequence of events was throwing me off:

  1. Step 1 (Generate Serial No): This step runs first and successfully updates the [Serial No] field.

  2. Step 2 (Update Alias): By the time this subsequent action triggers, [Serial No] is no longer blank. Therefore, the condition [Alias] <> TEXT([Serial No]) correctly evaluates to TRUE (since [Alias] is still blank but [Serial No] now has a value), causing the action to fire.

It turns out everything is working perfectly.

Thanks anyways!