Options

fieldref and validate

Jens_MadsenJens_Madsen Member Posts: 23
edited 2003-01-23 in Navision Attain
I'm having trouble validating values into a fieldref variable.

example:

varibles
l_varTemp of type Variant
l_codTemp of type Code[20]
l_blnRetVal of type Boolean
l_rRecMyRecord of type RecordRef
l_rFldMyField of type FieldRef

A):

l_rRecMyRecord.OPEN(18);
l_rRecMyRecord.INIT;
l_rFldMyField := l_rRecMyRecord.FIELDINDEX(1) ;
l_varTemp := '12345678901234567890';

l_blnRetVal := l_rFldMyField.VALIDATE(l_varTemp) ;

B):
l_rRecMyRecord.OPEN(18);
l_rRecMyRecord.INIT;
l_rFldMyField := l_rRecMyRecord.FIELDINDEX(1) ;
l_varTemp := '12345678901234567890';

l_rFldMyField.VALUE := l_varTemp;


In example A I get an l_blnRetVal of FALSE, but in B it works just fine. I've tried using temporary code-variable but that also fails...
Is it me or are there still some minor flaws in Attains new dynamic access of records and fields ???

Comments

  • Options
    mortenreeslevmortenreeslev Member Posts: 11
    VALIDATE is a VOID it has no return value :?

    l_blnRetVal := l_rFldMyField.VALIDATE(l_varTemp);

    just

    l_rFldMyField.VALIDATE(l_varTemp);
  • Options
    Jens_MadsenJens_Madsen Member Posts: 23
    If that's the case then why does the documentation(F1) contain this ?
    f.VALIDATE
    Skriv ny virksomhedsnote

    Use these functions to call the triggers for the field you specify.

    Record.VALIDATE(Field [, NewValue])
    Ok := fieldref.VALIDATE([NewValue])
    Field

    Data type: field

    A field with associated triggers.

    NewValue

    Data type: must be same data type as Field, or a data type that is convertible

    The value to insert in Field.

    filedref

    Data type: fieldref

    The fielref of the field with associated triggers.
  • Options
    mortenreeslevmortenreeslev Member Posts: 11
    Hmm it's an error in the documentation :shock:

    Should have been...

    fieldref.VALIDATE([NewValue])
Sign In or Register to comment.