Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Temporary table as form data source

Posted on by Microsoft Employee

I have a form which should display data in the grid based on certain parameters. The grid has a temporary table as its data source.

Please see the image below:

212121.JPG


Now, I have used the linkPhysicalTableInstance( tempTable::populateTable(parm1, parm2)) on the clicked event of OK button. The records are getting inserted into the temporary table but are not getting displayed on the form.

Any idea about this?

*This post is locked for comments

  • Faisal Raja Profile Picture
    Faisal Raja 10 on at
    RE: Temporary table as form data source

    Hi Rohan,

    I have exactly the same requirement and I get the same error which you mentioned while clicking the button. Could you please tell me the way to resolve the issue ?

    Thanks in advance.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Temporary table as form data source

    It works now. Thank you so much Martin.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: Temporary table as form data source

    That's what I tried to do by "If you need to put data to the table after the form has been initialized, pass a reference to the buffer to your populateTable() method." You need to use the buffer created for you datasource.

    In populateData(), write records to the datasource buffer you receive as the parameter.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Temporary table as form data source

    Oh. I did not realize that.

    Could you kindly help me out in resolving that error?

  • Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: Temporary table as form data source

    If you populate a new buffer that has nothing to do with the form datasource, how could the data magically appear on the form?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Temporary table as form data source

    Hi Martin,

    I got the error initially when I used the 1st code, so I declared a temporary table buffer and used it. The error was gone but the data is not displaying on he form.

    1st code:

    TempTableDS.linkPhysicalTableInstance(TempTable::populateTempTable(parm1, parm2);

    Changed code:

    TempTableBuffer.linkPhysicalTableInstance(TempTable::populateTempTable(parm1, parm2);

    Is there something wrong with this?

    Note:

    TempTableDS - Data source name

    TempTableBuffer - Temporary table buffer declared in class declaration.

  • Suggested answer
    Jesus R. ABASCAL Profile Picture
    Jesus R. ABASCAL 1,450 on at
    RE: Temporary table as form data source

    Hi,

    I think do you do a refresh of the data source.

    Regards!

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,235 Most Valuable Professional on at
    RE: Temporary table as form data source

    Can you show us your code? From your description, I would expect you to get an error ("The method is only applicable to TempDB table variables that are not linked to existing physical table instance"), if you don't get any, then I obviously don't understand what you're doing. Maybe you're using a new (= wrong) buffer.

    If you need to put data to the table after the form has been initialized, pass a reference to the buffer to your populateTable() method. Nevertheless if you're using a wrong buffer, you have to resolve this problem as well.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans