Need difference set of data from rule input, local variable.

Hi,

I have a rule input with multiple rows of data and I also have a local variable with few rows of data.

Now I want to find the difference rows of data into a another local variable.

Is it possible in appian. 

Any inputs please.

  Discussion posts and replies are publicly visible

Parents
  • +1
    Certified Senior Developer

    Hello ,

    You can use symmetricDifference() to get the unique values that are there in both set A and set B.

    Here is an example

    a!localVariables(
      local!data1: {
        a!map(name: "kevin", age: "23", gender: "Male"),
        a!map(name: "Rambo", age: "26", gender: "Male"),
        a!map(name: "Jude", age: "33", gender: "Female"),
        a!map(
          name: "Michelle",
          age: "21",
          gender: "Female"
        )
      },
      local!data2: {
        a!map(name: "kevin", age: "23", gender: "Male"),
        a!map(
          name: "Fracesca",
          age: "22",
          gender: "Female"
        ),
        a!map(name: "Jude", age: "33", gender: "Female"),
        a!map(name: "Martin", age: "53", gender: "Male"),
        a!map(
          name: "Michelle",
          age: "21",
          gender: "Female"
        )
      },
      local!unique: symmetricdifference(local!data1, local!data2),
      { local!unique }
    )

Reply
  • +1
    Certified Senior Developer

    Hello ,

    You can use symmetricDifference() to get the unique values that are there in both set A and set B.

    Here is an example

    a!localVariables(
      local!data1: {
        a!map(name: "kevin", age: "23", gender: "Male"),
        a!map(name: "Rambo", age: "26", gender: "Male"),
        a!map(name: "Jude", age: "33", gender: "Female"),
        a!map(
          name: "Michelle",
          age: "21",
          gender: "Female"
        )
      },
      local!data2: {
        a!map(name: "kevin", age: "23", gender: "Male"),
        a!map(
          name: "Fracesca",
          age: "22",
          gender: "Female"
        ),
        a!map(name: "Jude", age: "33", gender: "Female"),
        a!map(name: "Martin", age: "53", gender: "Male"),
        a!map(
          name: "Michelle",
          age: "21",
          gender: "Female"
        )
      },
      local!unique: symmetricdifference(local!data1, local!data2),
      { local!unique }
    )

Children