Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

I am trying to populate a form grid with a temprory table which is set as form's datasource

Posted on by 97

I have a requirement such that i have a form which contains PO id as a listbox.

In action pane i have a find button.

Below the field there is a grid which is populated by a temprory table(filtered according to PO)

68520.Capture.PNG

the requirement is such that when i select a PO number and click on find button the corresponding lines should be populated in the grid.

Issue:  when i set table as regualr data is populated correctly but as temprory table it disappears.

code: 

in clicked method of find 

void clicked()
{

//Need to pass the parameter here to fetch the data in a grid
ABC_TMPPurchtData.setTmpData(element.fetchData(dialogPONumber.text()));

ABC_TMPPurchtData_ds.executeQuery();
}

fetch data method 

public CBO_TMPPurchtData fetchData(purchId _PurchId)
{

PurchTable purchTable;
PurchLine purchLine;

while select purchTable
Join purchLine where purchTable.PurchId==purchLine.PurchId
&& purchTable.PurchId==_PurchId

{
tMPPurchtData.PurchId=purchTable.PurchId;
tMPPurchtData.LineNumber=purchLine.LineNumber;
tMPPurchtData.ItemId=purchLine.ItemId;
tMPPurchtData.OrderAccount=purchTable.OrderAccount;
tMPPurchtData.insert();

}

return tMPPurchtData;

}

*This post is locked for comments

  • Palak jain Profile Picture
    Palak jain 97 on at
    RE: I am trying to populate a form grid with a temprory table which is set as form's datasource

    Thnaks alot it worked.

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: I am trying to populate a form grid with a temprory table which is set as form's datasource

    Put the delete_from tMPPurchtData

        PurchTable purchTable1;
        PurchLine purchLine;
    
        delete_from tMPPurchtData;
    
        while select purchTable1
            join purchLine 
            where purchTable1.PurchId == purchLine.PurchId
               && purchTable1.PurchId == _PurchId
    
        {


  • Palak jain Profile Picture
    Palak jain 97 on at
    RE: I am trying to populate a form grid with a temprory table which is set as form's datasource

    its a temprory table with same name ABC_TMPPurchtData i have created the same object.

    By the way the code is working fine now as settmp method works with inmemory type.

    Now there is another issue everytym i select a new po and click on find it appends the last tym searched data.

  • Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: I am trying to populate a form grid with a temprory table which is set as form's datasource

    Did you have any data source table joined to your ABC_TMPPurchtData?

  • Palak jain Profile Picture
    Palak jain 97 on at
    RE: I am trying to populate a form grid with a temprory table which is set as form's datasource

    void clicked()

    {

    //Need to pass the parameter here to fetch the data in a grid

    ABC_TMPPurchtData.setTmpData(element.fetchData(dialogPONumber.text()));

    ABC_TMPPurchtData_ds.executeQuery();

    }

    fetch data method

    public ABC_TMPPurchtData fetchData(purchId _PurchId)

    {

    PurchTable purchTable;

    PurchLine purchLine;

    while select purchTable

    Join purchLine where purchTable.PurchId==purchLine.PurchId

    && purchTable.PurchId==_PurchId

    {

    tMPPurchtData.PurchId=purchTable.PurchId;

    tMPPurchtData.LineNumber=purchLine.LineNumber;

    tMPPurchtData.ItemId=purchLine.ItemId;

    tMPPurchtData.OrderAccount=purchTable.OrderAccount;

    tMPPurchtData.insert();

    }

    return tMPPurchtData;

    }

    sorry that was a typing mistake of mine that was not the issue, the issue is what i mentioned

    when i set table as regualr data is populated correctly but as temprory table it disappears.

  • Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: I am trying to populate a form grid with a temprory table which is set as form's datasource

    Hi!

    Your code is strange. You trying setTmpData of CBO_TMPPurchtData to ABC_TMPPurchtData.

    Or ABC_TMPPurchtData is just the name of form's CBO_TMPPurchtData data source table?

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans