Prevent Duplicate Records before Saving Form

Hello,

I want to prevent duplicate records when the form is filled, but the tricky part is that the entry should be compared with the part of the existing one.

Example: if the value is already part of the table the following formula works perfectly: Not(In([_THIS],
SELECT(METERING_POINTS[metering_point_id], [metering_point_id]=[_ThisRow].[metering_point_id])))

The problem is that I want to compare only the right 7 digits from the existing one and if the new value is equal to them, then it shouldn't allow input (to be considered as duplicate). There are two ways of those values: first is with 30 digits, and the second is with 7 (the last 7 from the long one). So I want to compare only the RIGHT 7 digits. 

Example: Value "GA5512345678901234567890121122334" is part of the table and I want to enter "1122334". This should be considered as a duplicate due to the RIGHT 7 digits.

I tried with no success: Not(In([_THIS],
SELECT(METERING_POINTS[metering_point_id], right([metering_point_id],7)=[_ThisRow].[metering_point_id])))  

Any help will be highly appreciated.

 

Solved Solved
0 9 1,210
1 ACCEPTED SOLUTION

Your ANDING() of two formulas looks good for me, except that it may not work for the existing rows. 

Please try an expression something like below

AND(

ISBLANK(

  FILTER(

  "METERING_POINTS",

    ([_THIS] = [metering_point_id])

  )

  - LIST([_THISROW])

),

ISBLANK(

  FILTER(

  "METERING_POINTS",

    ([_THISROW].[Short_Metering_Point_Id] = [Short_Metering_Point_Id])

  )

  - LIST([_THISROW])

)

)

 

View solution in original post

9 REPLIES 9
Top Labels in this Space