Filling field in navision

shafeaashafeaa Member Posts: 54
hi
what is the right or the best way to fill "Amount" field when we fill the" No"field?????
this one
if recourd.get(NO) then
amount:=recourd.Amount;
validate(Amount);

or this
if NO <>'' then 
recourd.get(NO);
Amount:=recourd.Amount;
validate(Amount);
or is there another way what do u think guys
:-k [/quote]

Comments

  • SbhatSbhat Member Posts: 301
    if NO <>'' then begin
    record.get(NO);
    validate(Amount,record.<Value>);
    end;

    This way you will be executing the OnValidate code of Amount field.


    SB.
  • DenSterDenSter Member Posts: 8,307
    I agree with bhat, only I'd also check the return value of the GET statement, like this:
    IF NO <>'' THEN BEGIN
      IF record.GET(NO) THEN
        VALIDATE(Amount,record.<Value>); 
    END;
    
    Of course this only works if this code is within a construction like
    WITH SomeKindOfRecordVariable DO BEGIN
    END;
    
    Otherwise Navision will throw an error, because VALIDATE in itself is not a valid keyword.
Sign In or Register to comment.