Issue in fn!union() to return unique values. Is there any other function available?

Hi Team,

Got confused while doing some calculations in Appain Expression rule. Added input and output below. i have tried fn!union() function but it was failing sine input was only one array.

Code: fn!union({ 1, 2, 2, 1, 3, 1, null, null }, {})

Sample i/p -> { 1, 2, 2, 1, 3, 1, null, null}

Expected o/p -> { 1, 2, 3} 

Current Appian Design:

Thanks and Regards,

Vigneshkumar Radhakrishnan

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    This works perfectly.  You pass in an array with three 1's, two 2's, a 3, and 2 nulls, and pass in another array with a 9 in it.  Union does exactly what it says on the tin.  It joins the arrays and removes the duplicates.  You only have 1 null in the result set.  If you don't want it, reject(a!isNullOrEmpty(_), local!list).

    Union doesn't say it does anything or doesn't do anything to nulls.  It says it removes duplicates, and it did.

Reply
  • 0
    Certified Lead Developer

    This works perfectly.  You pass in an array with three 1's, two 2's, a 3, and 2 nulls, and pass in another array with a 9 in it.  Union does exactly what it says on the tin.  It joins the arrays and removes the duplicates.  You only have 1 null in the result set.  If you don't want it, reject(a!isNullOrEmpty(_), local!list).

    Union doesn't say it does anything or doesn't do anything to nulls.  It says it removes duplicates, and it did.

Children
No Data