FieldRef by FieldName

mr.burnsmr.burns Member Posts: 39
Hello,

I have a RecordRef and a FieldRef variable.
Now I want to get a FieldRef like follows:

FieldRef := RecordRef.Field("Customer No.");

but I cannot find such a command. RecordRef.Field expects the FieldNo in brackets and RecordRef.Fieldindex expects the Index of a field in brackets.

So how can I get a FieldRef to a field of a recordref using a FIELDNAME?

Thanks for any help!

Comments

  • kujukuju Member, Microsoft Employee Posts: 62
    glRecordRef.OPEN(18);
    glRecordRef.FINDFIRST;
    FOR i := 1 TO glRecordRef.FIELDCOUNT DO BEGIN
      glFieldRef := glRecordRef.FIELDINDEX(i);
      str := STRSUBSTNO('Field %1 has value %2',glFieldRef.NAME,glFieldRef.VALUE);
      MESSAGE(str);
    END;
    

    i would try to avoid using fieldnames in code and if you can not avoid it you can search in the virtual 'Field' table to find a field record and a fieldnumber to work with in your fieldref

    Good luck!
    Dynamics Rules!
Sign In or Register to comment.