IsBlank

You can use the IsBlank function in Optiva script type to determine if a field value is blank or contains characters. This function is useful for validating if the required fields have values populated before proceeding with an operation. This function determines if a variable has a non-null, non-blank value.

When to use

You can use this function to:

  • Check if the required fields have values before allowing a workflow to proceed or an object to be saved.
  • Branch workflow or script logic based on whether optional fields are populated.

When not to use

You cannot use this function to determine whether a numeric value is zero.

Note: The IsBlank function can treat zero as blank depending on the context.

Syntax

int IsBlank(object Value);

Parameter

Parameter Type Required Description
Value object Yes The field or variable to check.

Return Value

  • The application returns a value zero (0) if the field has a value or is not blank.
  • The application returns a value one (1) if the field is blank, null or empty.

Prerequisites

  • You can use the function with strings, numbers, and objects.
  • No specific permissions are required.

Examples

Example 1
Check if Formula Has an MFG Item Code.
// Get ITEMCODE from PIZZASAUCE formula
object oItemcode = ObjProperty("ITEMCODE", "FORMULA", "PIZZASAUCE\\003");

// Check if the item code is blank
int iBlank = IsBlank(oItemcode);

if (iBlank == 1)
{
    MessageList("This formula does not have a MFG item code.");
}
Description
This example checks if the formula has an MFG Item.
Example 2
Validate Required Field.
object description = ObjProperty("DESCRIPTION", "ITEM", itemCode);
if (IsBlank(description) == 1)
{
    MessageList("Description is required.");
    return 1;  // Stop workflow
}