Skip to main content
January 27, 2026
Solved

Need validation while uploading Excel

  • January 27, 2026
  • 8 replies
  • 0 views

No warning or error message is displayed when the user uploads a file containing duplicate advisor code and Line of business.

I need validation message when I am uploading more than 1 entry with same data.

a!forEach(
items: local!constructData,
expression: if(
count(
index(
fv!item[local!constructData.advisorCode],
wherecontains(
fv!item[local!constructData.lineOfBusiness],
tostring(local!constructData)
)
)
) > 1,
"Duplicate Line of business",
null
)
),

    Best answer by shubhama926776

    a!localVariables(
      local!constructData: {
        a!map(advisorCode: "A01000", lineOfBusiness: "Life"),
        a!map(advisorCode: "A01000", lineOfBusiness: "Life"),
        a!map(advisorCode: "A02000", lineOfBusiness: "Health")
      },
    
      /* Create combined keys */
      local!allKeys: a!forEach(
        items: local!constructData,
        expression: fv!item.advisorCode & "|" & fv!item.lineOfBusiness
      ),
    
      /* Find duplicates */
      local!duplicates: a!forEach(
        items: local!constructData,
        expression: if(
          count(
            wherecontains(
              fv!item.advisorCode & "|" & fv!item.lineOfBusiness,
              local!allKeys
            )
          ) > 1,
          "Duplicate: " & fv!item.advisorCode & " - " & fv!item.lineOfBusiness,
          null
        )
      ),
    
      reject(fn!isnull, local!duplicates)
    )


    Check this sample code.

    8 replies

    shubhama926776
    January 27, 2026

    a!forEach(
      items: local!constructData,
      expression: if(
        length(
          where(
            and(
              local!constructData.advisorCode = fv!item.advisorCode,
              local!constructData.lineOfBusiness = fv!item.lineOfBusiness
            )
          )
        ) > 1,
        "Duplicate: " & fv!item.advisorCode & " - " & fv!item.lineOfBusiness,
        null
      )
    )


    Filter nulls and show in validation:

    reject(fn!isnull, {above code})

    January 27, 2026

    tried provided code. But both entries are getting uploaded. It is not triggering the validation

    shubhama926776
    January 27, 2026

    Excel parse rule/plugin not populating local!constructData correctly. Share parse code for exact fix