Hello!
I am using the following code. This is On-Element Entry for the LE "New" -------------------- var vLabor as String var nn as Int var vSteuern as String var VCnt as Int var vLoop As Int var vUNIQUE as String var vLabNr as String vLabNr = LabNr vSteuern = "A" vLabor = NeW vCnt = @FormResultSetTotal("OrderSubform") vUNIQUE = toUpper(@lt(New,2))+"-"+LabNr
// writeLN("UNIQUE : " + vUNIQUE)
vCnt = @FormResultSetTotal("OrderSubform") IF @isBlank(New) = 0 and @IsBlank(LabNr) = 0 { vLoop = 1 while vLoop <= vCnt and @IsBlank(new) = 0 { vUNIQUE = @FormFieldValue ("OrderSubform", "UNIQUE", vLoop) IF @error then { vLoop = vLoop + 1 } else { nn = @FormNewRecord("OrderForm") FormFieldValue("OrderForm", "Steuern", nn, vSteuern) FormFieldValue("OrderForm", "LabNr", nn, vLabNr) FormFieldValue("OrderForm", "UNIQUE", nn, vUNIQUE) FormFieldValue("OrderForm", "Datum",nn, Eingang) FormFieldValue("OrderForm", "PatientID", nn, PatientID) FormFieldValue("OrderForm", "Labor", nn, vLabor) }
Clear(New) } Throwfocus (New) } -------------------- It doesn't work as intended. It is expected to create a record in the SubForm only if the Unique Value does not exit. It does on all entries in this element whether they exist or not.
|