Find one Record by Name which is not Primary Key

Hello togheter.

How can i find a Record by a Name which is not in the PK?

I know the Get Function, but this only works with the PK. So this won’t work.
I tried out the Find Function but this didn’t work well

Name := FindRecByThisName;

IF FIND THEN BEGIN
NEXT(-1);
Name := ‘New Name’;
MODIFY;
END;

How about

SETRANGE(Name,FindRecByThisName)
IF FIND THEN BEGIN
… //I am leaving out this code as it is not part of your question
END;

Notes- This code is assuming that you have a secondary key for Name

  • Why are you using the NEXT(-1)?