if duplicate data exists in the list then display a message indicating that duplicate data is present.

Certified Associate Developer

local!data: {
a!map(SAPNumber: "1111111", Qty: "1", Spare: "0"), 
a!map(SAPNumber: "1111111", Qty: "2", Spare: "1"),
a!map(SAPNumber: "1111111", Qty: "3", Spare: "0"),
a!map(SAPNumber: "2222222", Qty: "1", Spare: "0")
},

In the above list, If a duplicate combination of 'SAPNumber' and 'Spare' exists in the list, display a message indicating that duplicate data is present.

Example : 

a!map(SAPNumber: "1111111", Qty: "1", Spare: "0"), 

a!map(SAPNumber: "1111111", Qty: "3", Spare: "0"),

here, 'SAPNumber' and 'Spare' are same so it must shows a message.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Another simple way to do this is as below, Note: I have not handle any null errors etc.. just a targeted answer for the requirement

    a!localVariables(
      local!data: {
        a!map(SAPNumber: "1111111", Qty: "1", Spare: "0"),
        a!map(SAPNumber: "1111111", Qty: "2", Spare: "1"),
        a!map(SAPNumber: "1111111", Qty: "3", Spare: "0"),
        a!map(SAPNumber: "2222222", Qty: "1", Spare: "0")
      },
      if(
        length(local!data) > length(
        /* This union can be a rule named like XXX_removeDuplicate() */
          union(
            merge(local!data.SAPNumber, local!data.Spare),
            merge(local!data.SAPNumber, local!data.Spare)
          )
        ),
        "Error Message",
        ""
      )
    )

Reply
  • 0
    Certified Lead Developer

    Another simple way to do this is as below, Note: I have not handle any null errors etc.. just a targeted answer for the requirement

    a!localVariables(
      local!data: {
        a!map(SAPNumber: "1111111", Qty: "1", Spare: "0"),
        a!map(SAPNumber: "1111111", Qty: "2", Spare: "1"),
        a!map(SAPNumber: "1111111", Qty: "3", Spare: "0"),
        a!map(SAPNumber: "2222222", Qty: "1", Spare: "0")
      },
      if(
        length(local!data) > length(
        /* This union can be a rule named like XXX_removeDuplicate() */
          union(
            merge(local!data.SAPNumber, local!data.Spare),
            merge(local!data.SAPNumber, local!data.Spare)
          )
        ),
        "Error Message",
        ""
      )
    )

Children
No Data