Temp. Table transfer to a form

twctwc Member Posts: 28
Hello

I have modified the line:
FORM.RUN(FORM::"Calculation Card 2", lre_CalcLineTemp);

in the following ones:
lfo_CalculationCard2.fu_SetInfo(lre_CalcLineTemp,pre_Item);
lfo_CalculationCard2.RUN;

That beacuse I need to transfer the Item to the Form lfo_CalculationCard2.
lre_CalcLineTemp is a temporary table.

The code of fu_SetInfo is:
fu_SetInfo(VAR pre_CalcLineTemp : TEMPORARY Record "Calculation Line";VAR pre_Item : Record Item)
Rec := pre_CalcLineTemp;
re_Item := pre_Item;

The question is: Why the form does lose all the informations in the temp. table pre_CalcLineTemp?

Which would be the right code?

Thanks and Cheers!
Tommaso
Tommaso Cereghetti
IT-Consultant

Comments

  • krikikriki Member, Moderator Posts: 9,118
    With
    lfo_CalculationCard2.RUN;
    , you can't give a temptable.
    You would have to program a function to receive all records and save them in a temptable in the form and then program "OnFindRecord", "OnNextRecord" to use the temptable.

    The trick I would use is :
    lre_CalcLineTemp.RESET;
    lre_CalcLineTemp.SETRANGE("Some Code Field",pre_Item."No.");
    FORM.RUN(FORM::"Calculation Card 2", lre_CalcLineTemp);
    

    And in the form (trigger "OnOpenForm") I would put:
    re_Item.GET(GETFILTER("Some Code Field"));
    

    This of course if you didn't change any fields in the record "pre_Item".

    In case you have changed some fields, you have to send them in the same way as the item no. OR use a Singleinstance codeunit to put the pre_Item in before calling the form and in the form get the record (see http://www.mibuso.com/howtoinfo.asp?FileID=9 )
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • twctwc Member Posts: 28
    Grazie mille! Era proprio quello che mi serviva!

    Buona serata,
    Tommaso
    Tommaso Cereghetti
    IT-Consultant
Sign In or Register to comment.