OBJECT Codeunit 90000 If Validate Mgt { OBJECT-PROPERTIES { Date=09/02/09; Time=12.23.59; Modified=Yes; Version List=; } PROPERTIES { OnRun=BEGIN FNTValidate; END; } CODE { VAR [email protected] : Integer; [email protected] : Text[250]; [email protected] : FieldRef; [email protected] : RecordRef; PROCEDURE [email protected](); BEGIN IF TXTNewValue = '' THEN BEGIN FRFieldRef.VALIDATE; END ELSE BEGIN EVALUATE(FRFieldRef,TXTNewValue); FRFieldRef.VALIDATE; END; END; PROCEDURE [email protected]([email protected] : Integer;[email protected] : Integer;[email protected] : Text[1000];[email protected] : Text[250]); BEGIN TXTNewValue := TXTLocValue; RRRecordRef.OPEN(INTLocTableNo); RRRecordRef.SETPOSITION(TXTLocPosition); RRRecordRef.FIND('='); FRFieldRef := RRRecordRef.FIELD(INTLocFieldNo); END; PROCEDURE [email protected]([email protected] : Text[50]) : Integer; VAR [email protected] : Record 2000000001; BEGIN TBObject.SETRANGE(Type,TBObject.Type::Table); TBObject.SETRANGE(Name,TXTTableName); TBObject.FINDFIRST; EXIT(TBObject.ID); END; BEGIN END. } }
OBJECT Codeunit 66666 getpos { OBJECT-PROPERTIES { Date=09/02/09; Time=12.27.22; Modified=Yes; Version List=; } PROPERTIES { OnRun=BEGIN txtconst := 'mlallalllllflljfdshalfjadskfljadslfkjadslfjhadslfjhadsfhsadlkfhdslafhekhfuniciabernciebhrigvbiero'; tbtest.FINDLAST; cu.FNTGetPar(cu.FNTGetTableNo(tbtest.TABLENAME),tbtest.FIELDNO(Name),tbtest.GETPOSITION(FALSE),txtconst); IF cu.RUN THEN BEGIN tbtest.VALIDATE(Name,txtconst); tbtest.MODIFY; END ELSE BEGIN MESSAGE('What customer is this?'); END; END; } CODE { VAR [email protected] : Record 18; [email protected] : RecordRef; [email protected] : Codeunit 90000; [email protected] : Text[200]; BEGIN END. } }Maybe there are problems with transactions, codeunit.run and "complex" validates...not tried yet...for sure, you should know what you are validating before using this function.