Skip to main content
sameeru0003
Known Participant
Jul 31, 2023 9:09 AM UTC
Question

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

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
Jul 31, 2023 9:44 AM UTC

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
Known Participant
Jul 31, 2023 10:22 AM UTC

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

stefanhelzle0001
Brainy
Jul 31, 2023 10:25 AM UTC

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
Participating Frequently
Aug 1, 2023 9:42 AM UTC

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
)