intersystems-cache

How to check that variable exists in Caché Object Script?


Is there a more elegant way in COS just to check that variable is set?

The tricky one I can guess is the next one:

set test = ""
write $get(test, "NO") '= "NO"

But the test variable can also be equal to "NO"...


Solution

  • You can use $Data(var) for that. Documentation.