MSSQL Execute SQL returning NULL to variable cannot be checked for using string if logic

Version: 8.0.0.2442
Issue: MyVariable is shown in log containing NULL, but IF test to value “NULL”, returns FALSE.

  1. Using MSSQL Execute SQL (SQLCmd) attempt to select data that does not exist (returns NULL into MyVariable, this is seem in the log.
  2. Trip the value to get rid of whitespace.
  3. Check if variable contains NULL using a simple IF =.

Can you show us an example project of what you are doing?

I’m not able to reproduce this here, at least in my simple test.

Hi Vincent,

Sorry, forgot to get back to you.

The SQL field needs to be flagged as nullable. Ensure there is no value. When you use FinalBuilder to read it, it returns a “NULL” string, but none of the string compare functions regonise it as “NULL”.

Regards,
Heath

The problem with the IF Then action, is that it is comparing strings (because it evaluates variable expressions, not variables). It does do some type coersion where it can, for example if both sides are integers it will do an integer comparison. But strings in FinalBuilder don’t understand null as such. In this case you might want to resort to using a condition on a group action. Conditions are a boolean expression that determines if the action is run or skipped :

FBVariables.MyVariable != null 

I understand the challenge, but it’s very confusing as FinalBuilder outputs NULL in the log, which I assumed would be a string matchable. Even if the Execute SQL query returned empty string for NULL, that would be a lot better.

This is what I see in the output window.
image