Skip to main content
sameeru0003
July 31, 2023
Question

Filter values from an array which does not belongs to a group

  • July 31, 2023
  • 5 replies
  • 0 views

Hi All,

Below is my Array.

{
    {
        Id:"A",
        Value: 123
    },
    {
        Id:"B",
        Value: 345
    },
    {
        Id:"C",
        Value: 678
    }
}

1.I want to check if list contains items with Id apart from "A" and "B".

2.Also I want to filter the items whose Id is not equal to "A" and "B".

5 replies

stefanhelzle0001
Brainy
July 31, 2023

You can implement that using the filter() function, or foreach(). And as this is a very frequently asked question, you will find plenty examples in other conversations.

sameeru0003
July 31, 2023

If you could help in writing an expression would be appreciated.

stefanhelzle0001
Brainy
July 31, 2023

Just like I said, this forum has a search engine that helps you to find threads like this one: https://community.appian.com/discussions/f/rules/29517/problem-filtering-null-values-from-record/117017#117017

tejpals0001
August 1, 2023

a!localVariables(
  local!array : {
    {
      Id:"A",
      Value: 123
    },
    {
      Id:"B",
      Value: 345
    },
    {
      Id:"C",
      Value: 678
    }
  },
  local!idsnotIncludedforfilter :{"A","C"},
 
 local!filteredData: remove(local!array,wherecontains(local!idsnotIncludedforfilter,touniformstring(index(local!array,"Id",{})))),
 local!filteredData
)