Null check for a!map in a process

Certified Senior Developer

Hi together,

I have a "map" value in a process.

I realized that an IsNull/emptycheck rule I used in a gateway down the line, was failing of evaluating that there was (in my understanding) an empty value

cast(
  'type!{http://www.appian.com/ae/types/2009}Boolean',
  length(a!flatten(ri!value)) = 0
)



Even the new rules a!isNullOrEmpty ..... are not recognizing this properly.

Does anybody experienced this as well? (not difficult to solve, but it was pretty unexpected)

Kind regards,

Richard

  Discussion posts and replies are publicly visible

Parents
  • Hi Richard,

    You should check what the value of the map type is inside the process instance. If it's null then it's length will be 0 but if the map value has been initialize during the process and has a structure, then it's value will not be 0. Something like this: 

    What was the error message that you were getting in the process instance?

  • 0
    Certified Senior Developer
    in reply to Dimitris Soulovaris

    yeah the error message is fine. Nothing complicated.
    I think the {} is my issue here.




    A cdt structure is differently represented in a process then.

    I just expected a different behavior as the value is shown as {} not as (id: null, name: null) 
    it is more about the visual representation where i am struggling, i think.
    The issue of null values in a structure vs empty list -> {} is an empty list to me.

    Perhaps its just me. Smiley

    Edit: a!map doesn't seems to be intialized as a "list of variant" is saved into it.
    Edit2: Which is not working in an expression editor but in a process, if a process variable is of type a!map but the rule result you like to store has the type "list of variant".
    ...yeeeah....fun.....

  • All the data structures in Appian, if have been initialized in an expression or interface then are not considered as Null or Empty.  Therefore its length will be always at least 1. This is a key point. 

    In your example, you are comparing different things.. A single CDT with a list of CDTs.

    You have flagged the rule input as an array. If you uncheck that flag then the result will be different. 

      

Reply Children