rule() should return null, however it always return with not null value

disabled:if(isnull(local!searchDeleteUserRole),true(),if(isnull(trim(rule!KONE_Development_userrolebackupexist_Rule(local!searchDeleteUserRole))),false(),true())),

my rule is:

 a!queryEntity(
   entity: cons!KONE_Development_userrolebackup_Constant,
   query: a!query(
     pagingInfo: a!pagingInfo(
       startIndex: 1,
       batchSize: 5000
     ),         
     selection: a!querySelection(
       columns: {
         a!queryColumn(
           field: "name"
         )
       }
     ),
     filter:a!queryFilter(
       field:"name",
       operator:"=",
       value:ri!name,
     )
   ),
 ).data

What I test from rule is always return empty, which I doubt is null value, however, if(isnull(rule!(local!value)),true(),false()), it should return true() since no value respond in the rule, but seems it always return false, so i doubt the rule always return with some not null value though it is empty. Which way I can make the empty value transfer to be null? Thanks

  Discussion posts and replies are publicly visible

Parents
  • You are correct that null and empty are not the same value in Appian. In general the best way to approach this to both check if the value is null AND check how many items are in a list. The easiest way to check if there is an empty list is to use the length function.

    Personally one of the first rules I always create or import is a rule to test the behavior of "isNullOrEmpty". Something like this should work:

    or(
      isnull(ri!value),
      length(ri!value)=0
    )

Reply
  • You are correct that null and empty are not the same value in Appian. In general the best way to approach this to both check if the value is null AND check how many items are in a list. The easiest way to check if there is an empty list is to use the length function.

    Personally one of the first rules I always create or import is a rule to test the behavior of "isNullOrEmpty". Something like this should work:

    or(
      isnull(ri!value),
      length(ri!value)=0
    )

Children