How to from Field No. -->Value?

OnewayOneway Member Posts: 53
Hi Guys,

Is it possible to know the value of the certain Field No. of the record?

eg. I know current customer record is Cust No. 1234. and how can i know the value of field No. 9?

Comments

  • krikikriki Member, Moderator Posts: 9,110
    Put the record in a recordreference and then use fieldreference to find the value of the field you want.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • OnewayOneway Member Posts: 53
    Thanks Kriki,

    Actually, I do not know whick table/record is.

    what i know is the value of the primary key and the table id and the field id which i want to know the value.

    how to do it?
  • krikikriki Member, Moderator Posts: 9,110
    Use a recordreference on that table.
    Fill up the primary key fields using fieldreferences.
    Do a GET or a FIND('=')
    And use again field reference to get the value of the field.

    Something like (I didn't test it):
    Lrer.OPEN(TableID);
    Lfir := Lrer.FIELD(Keyfield1);
    Lfir.VAlUE := 'The value1';
    Lfir := Lrer.FIELD(Keyfield2);
    Lfir.VAlUE := 'The value2';
    Lrer.FIND('=');
    Lfir := Lrer.FIELD(FieldN);
    MESSAGE('The Value is=%1',Lfir.VALUE);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • XypherXypher Member Posts: 297
    If you already have a record being used I would go with:
    varRecRef.GETTABLE(Rec);
    
    varFieldRef   := varRecRef.FIELD("varFieldNo.");
    varFieldValue := FORMAT(varFieldRef.VALUE);
    //Since FieldRef.VALUE resultant is a Variant you must use some kind of formatting
    
  • OnewayOneway Member Posts: 53
    Thanks Guys

    It does work.
Sign In or Register to comment.