What is the best way to null check a date rule input before using inside Expression Rule

 What is the best way to null check a date rule input before using inside Expression Rule? In order to prevent the below error:

 

Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!queryFilter [line 24]: The a!queryFilter function has an invalid value for the “value” parameter. When the value of “operator” is “<=” “value” must not be null or empty.

  Discussion posts and replies are publicly visible

Parents
  • If you have the Appian Common Objects installed (although I cannot find a recent reference to it), I would suggest rule!APN_isEmpty(). Otherwise you may want to create your own isEmpty() rule to also check for blank (non-null) values such as:

    rule!isEmpty() > =or(fn!isnull(ri!data),ri!data="")

    Then utilize similarly to Aditya's suggestion:

    if(
    rule!isEmpty(ri!dateField),
    {},
    a!queryFilter(
    field: "dateField",
    operator: "<=",
    value: ri!dateField
    )
    )
Reply
  • If you have the Appian Common Objects installed (although I cannot find a recent reference to it), I would suggest rule!APN_isEmpty(). Otherwise you may want to create your own isEmpty() rule to also check for blank (non-null) values such as:

    rule!isEmpty() > =or(fn!isnull(ri!data),ri!data="")

    Then utilize similarly to Aditya's suggestion:

    if(
    rule!isEmpty(ri!dateField),
    {},
    a!queryFilter(
    field: "dateField",
    operator: "<=",
    value: ri!dateField
    )
    )
Children
  • 0
    Certified Lead Developer
    in reply to Chris

    I agree with using the common objects functions for those that have them.  I use the apn_isBlank() and apn_isEmpty() functions almost exclusively.

    I'd just note here that you were probably thinking of apn_isBlank(), which is intended to check the null / blank status of a single entity.  apn_isEmpty(), on the other hand, is intended to take an array and check that it's empty (and it handles being passed a null value too, unlike the primitive functions).