This content has been marked as final. Show 10 replies
You should have to use a unique constraint or primary key constraint in order to prevent duplicate records entry but if u can't then u can use
when-validate-trigger on that particular field to check weather tha value already present in that table or not . if user have not yet saved the data in tabular records then u must loop from first record to last record weather tha value already present in any upper record or not.
Kevin in his post said
Although you cannot normally read other records in a multi row block without navigating to them, I have found a cunning method to do this validation using the power of calculation properties. You need three extra hidden fields, two of which have calculation properties, and a little function. (If you want to see how it works, try making the hidden fields visible).
Form program unit:
function COMPARISON (in1 number, in2 number) is
if in1 = in2 then
3 new hidden fields:
calculation mode: formula
formula: COMPARISON(:control.PK_COPY, :datablock.PK)
WHEN_VALIDATE_ITEM on DATABLOCK.PK
:control.pk_copy := :datablock.pk;
if :control.number_of_matches > 1 then
message('matching key found');
(DATABLOCK must have query_all_records = TRUE)
what do i have to name my fields and what to do in each field?
becuase i got lost in what Kevin said.
please answer me!