Skip to main content
June 28, 2024
Question

How to validate if current row being entered in editable grid already exits in grid

  • June 28, 2024
  • 6 replies
  • 0 views

I want to validate if current row being entered in editable grid is duplicate or not i.e. does it exists in grid already or not.

    6 replies

    venkatrea696188
    June 28, 2024

    How you differentiating rows? Any unique fields. We got many ways of comparing arrays for example  Contains(). 

    June 28, 2024

    I tried using whereContains() but it is giving me error,

    Expression evaluation error at function 'wherecontains' [line 273]: Invalid types, can only act on data of the same type (Text, Number (Integer))

    My line of code is this

    count(wherecontains(fv!item['recordType!SMA StudentMarksData.fields.computer'], local!DB.data['recordType!SMA StudentMarksData.fields.computer']) )>0

    venkatrea696188
    June 28, 2024
    can only act on data of the same type (Text, Number (Integer))

    Approach is almost good but you lost it in transition .

    Isn't this error saying it clearly. Your trying to compare Invalid types. What you are entering in the grid is a text value but what you are getting from Backend to compare is Integer so look into it how data structured in DB and how you are entering it .

    Or On grid if you are  capturing  integer value in a text field try wrapping it with tointeger()

    mikes0011
    Brainy
    June 28, 2024

    if you're talking about a new row that the user adds, basically you'd have to implement some validation that checks every column value in that row with every column value from prior rows, and determine if all values match the values from some prior row.  this would need to be done manually, but it shouldn't be that difficult.

    June 28, 2024

    what do you mean by manually?

    mikes0011
    Brainy
    June 28, 2024

    you'd have to manually build the logic to do the comparisons between a new row and existing rows, and use it for on-form validation.