Skip to main content
May 12, 2025
Question

Unexpected Error

  • May 12, 2025
  • 8 replies
  • 0 views

Hi Everyone,

I got this error one time "at function a!flatten [line 5]: Cannot read the array length because "<local3>" is null" in expression rule. Unable to find the root cause because local3 is not used anywhere in the expression.

Can anyone please help me out.

    8 replies

    harshas2775
    May 12, 2025

    Are you calling any sub rule within the rule you are calling this flatten function?

    stefanhelzle0001
    May 12, 2025

    We need to see your code.

    May 12, 2025

    if(
      isnull(ri!array),
      true,
      length(
        a!flatten(ri!array)
      ) = 0
    )

    stefanhelzle0001
    May 12, 2025

    Do you try to create some null-checking expression? If yes, try isNullOrEmpty() or my function I posted about here: https://appian.rocks/2022/10/17/the-magic-of-null-checking

    In your implementation, the problem is that the length() function is not happy with null values. So you would have to filter them out before, or use count().

    davidj137213
    May 13, 2025

    I received this error in Java. In my case, it means that you are iterating over an array, and internally, your variable is converted into a different, local variable (e.g., local1 or local3). Check the elements of your array for null values.

    May 13, 2025

    I did check for null values, it does not occur any more.