perhaps you are interested ...
Author: ulrichmerkel@web.de (ulrich-merkel)
once, we had a field called "STUFE" as part of the PK and anything was fine.
Then one decided that STUFE needs to be modifyable and used a TK instead.
Unfortunately, they still want to assure there will be no duplicate value of STUFE.
And they have components where they can add multiple new occs.
Our LFLD trigger (asssumes there will never be an empty value allowed) reads now:
variables
numeric v_savepos
string v_valuelist
endvariables
v_savepos = $curocc("<$entname>")
setocc "<$entname>",1 ; to get a complete list, we have to start at occ 1
putlistitems v_valuelist, "<$fieldname>"
setocc "<$entname>",v_savepos ; reeposition to saved pos
delitem v_valuelist,v_savepos ; delete "own" value from the list
if ($item(<$fieldname>,v_valuelist) != "") ; and compare
message/error "duplicate Stufe encountered"
return (-2)
endif
Perhaps one has other ideas how to implement that task?
(Just to keep you fit in creative usage of uniface possibilities)



