ph_isnull PowerHome formula function
Description
Checks to see if a supplied string parameter is NULL or empty and returns an alternate value instead 
Syntax
ph_isnull ( as_value, as_return, ai_flags )
Argument Description
as_value String. The string value you wish to test for NULL or empty
as_return String. The value to be returned if the test on as_value (controlled by the ai_flags parameter) comes back NULL or empty
ai_flags Integer. A flags parameter that indicates which tests are to be performed. See Usage below
Return value
String. Returns as_value if as_value passes the tests indicated by the ai_flags parameter. If as_value fails the tests, then as_return will be returned instead 
Usage
Use this function to check for NULL, empty (blank), or strings containing nothing but whitespace and return an alternate value instead. 

While NULL values will not often be found in normal PowerHome usage, it is possible that a NULL value will surface. Any type of variable can be NULL but this function only checks for String values. When a NULL string is concatenated with another string, the result will ALWAYS be NULL. A numeric value that is NULL added to another numeric value will be NULL. Whenever a NULL is part of an equation, the result will be NULL. This function will allow you to check and substitute an alternate value.

The ai_flags parameter controls which type of checking to use. Add together the values below for each check you would like performed:

  • 1 - Check for NULL values
  • 2 - Check for empty string values
  • 4 - Check for string values containing ONLY whitespace (you MUST include value 2 in order for this option to take effect)

    If you supply an ai_flags parameter of 0, no checks will be performed. If you would like to perform all 3 checks, use an ai_flags value of 7

    If you need to check for NULL values for datatypes other than Strings, see the isnull( ) function

  • Examples
    The following examples demonstrate typical syntax/usage for this function.
    • ph_isnull(ph_getvar_s(1,1),"Blank",7) - Tests the LOCAL1 system variable for either NULL, empty, or whitespace only. Returns the value for LOCAL1 if LOCAL1 is not NULL, empty, or whitespace otherwise returns the string "Blank"