Skip to main content
July 16, 2024
Question

How can I extract values with duplicate criteriaCode? (Remove one item and leave other)

  • July 16, 2024
  • 5 replies
  • 0 views

local!combinedCriteriaResults: a!flatten(
    {
      local!test1.criteriaResults,
      local!test2.criteriaResults,
      local!test3.criteriaResults,
      local!test4.criteriaResults
    }
  ),

Local variables show there is two items with the same criteriaCode. How can I remove one item and leave the other with the same code?

5 replies

venkatrea696188
July 16, 2024

You can use union()  Function, but can you tell me more about requirement .

a!localVariables(
  local!test1:{1,2,3,4},
  local!test2:{1,2,3,4,5,6},
  local!combined:a!flatten({local!test1,local!test2}),
  union(local!combined,local!combined)
)

July 16, 2024

The requirement is to remove one of the duplicate items from the local!combinedCriteriaResults

stefanhelzle0001
Brainy
July 16, 2024

Using union() and count() you can detect any duplicates. Then, for each item in the union, you can just pick a single item from the list. displayvalue() comes to my mind.

Question is, how do you decide which item to pick?