Temp table in release 5 forms

davmac1davmac1 Member Posts: 1,283
Release 5 supports temporary tables in forms.
I thought this would enable me to open a list form and then populate the table and display it, plus rebuild the table on the fly.
Through debug, I can tell it is inserting new records, but nothing shows up in the list form.
Has anyone used this new property and made a list form work with a temp table just like a normal table?

Comments

  • ara3nara3n Member Posts: 9,256
    Something like this should work.

    TempItem."No." := 'My_ITEM_1';
    TempItem.INSERT;
    TempItem."No." := 'My_ITEM_2';
    TempItem.INSERT;
    FORM.RUNMODAL(Form::"Item List",TempItem);
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • davmac1davmac1 Member Posts: 1,283
    This looks the same as prior to release 5.
    So if I am going to change filters and delete and recreate the temp table, I am going to have to do that from a different form each time, then run the form with the temp table.

    Currently, I have everything in one form where I am rebuilding the temp table based on filter changes on the form, but it won't allow the user to mark records, because it is doing the current record substitution to display the temp table records.

    I was hoping for an all in one solution.
    I guess I can try building the temp table once and then apply the various filters to it instead of rebuilding it each time.

    Do you know what the sourcetabletemporary property does differently?
  • ara3nara3n Member Posts: 9,256
    there is no documentation for it but basically you don't have to write any code on
    triggerrs OnFindRecord and OnNextRecord.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • amunozsuamunozsu Member Posts: 30
    Hello,

    How and where are you populating the table? I am using this new functionality and it works fine. I am populating the Rec table on the "OnOpenForm" trigger.

    -- Alejandro --
  • davmac1davmac1 Member Posts: 1,283
    I have tried it on the OnOpenForm trigger - it inserts 6 records according to the debugger, but nothing shows.
    I was not specifying Rec, but I changed the code to specifically use Rec - still see nothing on the list form.
    Did you make any other changes?
  • amunozsuamunozsu Member Posts: 30
    No, nothing else. Do you have a filter on "SourceTableView" property? It should work.
  • davmac1davmac1 Member Posts: 1,283
    No filter - undefined.

    I am going to try building this form from new.
    I modified a form I had working in release 4 so I could let the user mark records. I got rid of all the old code for substituting Rec - maybe I missed something.
  • amunozsuamunozsu Member Posts: 30
    Actually it's not necessary to specify rec, just field names but, it is to remove the old references. Good luck.

    -- Alejandro --
  • davmac1davmac1 Member Posts: 1,283
    Had to completely remove my commented out lines - then it worked.
    Even empty code in the record retrieval triggers causes the normal actions not to take place.
  • David_SingletonDavid_Singleton Member Posts: 5,479
    davmac1 wrote:
    Release 5 supports temporary tables in forms.
    I thought this would enable me to open a list form and then populate the table and display it, plus rebuild the table on the fly.
    Through debug, I can tell it is inserting new records, but nothing shows up in the list form.
    Has anyone used this new property and made a list form work with a temp table just like a normal table?

    Its not really "new" functionality, just a different way than you did this in earlier versions.

    in earlier versions of Navision you could pass a Temp var as a parameter to a FORM.RUNMODAL command in which case you didn't need to write any code on the OnNext and OnFind triggers.
    David Singleton
  • David_SingletonDavid_Singleton Member Posts: 5,479
    davmac1 wrote:
    Had to completely remove my commented out lines - then it worked.
    Even empty code in the record retrieval triggers causes the normal actions not to take place.

    This was actually the First error that I officially logged with Navision as an error in Financials. I was trying to use a temp table in a form and back then there were no existing forms (like Location Qty) to copy, I had tried lots of things, and eventually commented them out to get back to normal and it all stopped working. The answer came back from Denmark "Read the manual (aka on line help)".

    So if you read it literally it says "any code in this trigger replaces the built in functionality", and of course // is still code, just code that does nothing, so the run time simply sees that there is code there, so it does not run the built in NEXT and FIND functions. Its called Danglish I think. :wink:
    David Singleton
  • davmac1davmac1 Member Posts: 1,283
    "any code" also includes variables. I had removed all code, but left a variable definition. I ended up dropping the form to text where you can see evrything.
  • Johnny_ReggaeJohnny_Reggae Member Posts: 63
    Is it possible to rebuild the contents of a form with SourceTableTemporary=True on the fly ?

    I tried to fill up the rec in the OnAfterValidate trigger of a variable on the form, but after this Navision always tried to insert a new record (with the contents of my last record in the temptable).
Sign In or Register to comment.