Options

Record variable Problem

vikram7_dabasvikram7_dabas Member Posts: 611
Can we create Record variable at run time? Suppose I m running 1 report of "Field" DataItem and I put some filters on "Field" DataItem and at run time the "Field" table contains "Table No." field, I want to create the record variables of those "Table Nos".
Vikram Dabas
Navision Technical Consultant

Comments

  • Options
    krikikriki Member, Moderator Posts: 9,098
    It is possible using "recordreference" variables.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    vikram7_dabasvikram7_dabas Member Posts: 611
    How can we do it by RecordReference?Please tell explain me.I never used recordReference?
    Vikram Dabas
    Navision Technical Consultant
  • Options
    krikikriki Member, Moderator Posts: 9,098
    Some small example to create a record in table 3:Payment Terms

    rer is a recordreference
    fir is a fieldreference

    // to insert a record
    rer.OPEN(DATABASE::"Payment Terms");
    fir := rer.FIELD(1);  (you can also use table field to find the fields and also the tables)
    fir.VALUE := 'THENEWCODE';
    CLEAR(fir); // when you don't need a reference anymore or change is, it is best to clear it.
    fir := rer.FIELD(5);
    fir.VALUE := 'The New Description';
    CLEAR(fir);
    fir := rer.FIELD(4);
    fir.VALUE := 10.5;
    CLEAR(fir);
    rer.INSERT;
    CLEAR(rer);
    

    to find the previous record
    rer.OPEN(DATABASE::"Payment Terms");
    
    fir := rer.FIELD(1);
    fir.SETRANGE('THENEWCODE');
    CLEAR(fir);
    
    rer.FINDFIRST;
    
    fir := rer.FIELD(5);
    MESSAGE('%1=%2',fir.NAME,fir.VALUE);
    CLEAR(fir);
    
    fir := rer.FIELD(4);
    MESSAGE('%1=%2',fir.NAME,fir.VALUE);
    CLEAR(fir);
    
    CLEAR(rer);
    
    Now you have to read the documentation on record-,field-,keyreferences and do some experiments.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.