craazzz
1
Hi Folks,
I am using Dynamics nav 2013 and I want a way prevent duplicate
data from being accepted into the employee record when a new entry
is being made. I tried the code below but without success:
BEGIN
IF emp1.FINDSET THEN
REPEAT
emp2.SETRANGE(“Social Security No.”,emp1.“Social Security No.”);
IF emp2.COUNT > 1 THEN
EXIT(TRUE);
UNTIL emp1.NEXT = 0;
EXIT(FALSE);
END;
What are you using as your employee no? The key field is there to help prevent duplicates.
you can use something like the fist and last initial plus the last 4 digits of the social as the number.
like HR1234 - highly unlikely you’ll get two that match. You can always go last 5 digits if you want to be super sure.
Hi,
I think you should do a emp2.RESET before the emp2.SETRANGE(…).
Try that and see if it solves your issue.
Jose.
Hi,
I think you should do a emp2.RESET before the emp2.SETRANGE(…).
Try that and see if solved your issue.
Jose.
Hi Eddy,
Try this, this shall perform what you want