web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Filter in form using tempdb, join with tempDb doesn't work

(0) ShareShare
ReportReport
Posted on by 123

I have added a tempdb table as a datasource in a form and i need to filter using a field in this table.  Linktype is delayed. I have created a method in form to populate the tempdb and I have used linkPhisicalTableInstance, but when I join this to inventTable, in init of my formdatasource, it doesn't work. Form shows nothing in the grid. Is there any other thing I should to to add mytempdb a s a datasource to inventTable query?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    It should work fine. Have you created your tempDB table as per below?

    stoneridgesoftware.com/using-tempdb-tables-in-ax-2012-forms

    Also did you set the link between the two tables?

    msdn.microsoft.com/.../querybuilddatasource.addlink.aspx

    You could verify it via right clicking a field on the form > Personalize > Query tab. You could verify the relations and the ranges defined there too.

  • Enxhi Bregu Profile Picture
    123 on at

    Thank you for replying,

    I am using it as a child table, and  the link between two  tables is ok, if i change it to a regular table the join works,

  • Martin Dráb Profile Picture
    239,152 Most Valuable Professional on at

    Can explain your implementation in detail. You mentioned a join with InventDim and a delayed link (without mention what's the parent table of thee link), but it's not clear how it all fits together. You also mentioned a filter - can you tell us more about it?

    You said that if works doesn't work if you add the join - does it mean that if works without the join? And are all the other things (such as the delayed link) related to the problem? If not, get rid of them, so they don't complicate your test scenario.

  • Enxhi Bregu Profile Picture
    123 on at

    So Martin, I will explain in details,

    I have to filter in a form that as a parent datasource has InventTable. the field that i have to use as a filter for inventtable records is in my temporary table, so I added my tempdb as a datasource in the form. the linktype woth invenTable is delayed. to populate the tempdb I have created a form method, and I call it in init of the form. my code is:

    init of Form

    colortmp = element.wptPopulatecolorTmp();

    WptColorTmp.linkPhysicalTableInstance(colorTmp);

    In the init of the form datasource (inventTable) i add a link between InventTable and my tempdb, it doesnt work,

    qbds   =this.query().datasourceTable(tableNum(InventTable));

    qbds1 = qbds.addDataSource(tableNum(WPtColorTmp));

    qbds1.addLink(fieldNum(InventTable,ItemId), fieldNum(WPtColorTmp, ItemId));

    qbds1.joinMode(JoinMode::InnerJoin);

    qbr = qbds1.addRange(fieldNum(wptColorTmp, OutCollection));

    When I add the join, the grid is empty, so I thought i have a problem with my tempDb. Even when I use innerJoin as a link type, still the same.

  • Martin Dráb Profile Picture
    239,152 Most Valuable Professional on at

    Why are you adding the datasource in code, instead of modelling it in form properties? I don't say it can't be done in code, but it's more work.

    Does the range have an impact on your problem? If not, let's remove it.

    I don't see anything about the delayed link; I'll assume it's not related to the actual problem.

    Do you have right data in your temporary buffer? You may have a problem in data instead of in code.

  • Enxhi Bregu Profile Picture
    123 on at

    No the range, does not have an impact, even when i use form properties i have the same problem, I think that I have the right data in my buffer, because if I change my tempdb to regular, and use the same method to populate it once, the join works

  • Verified answer
    Martin Dráb Profile Picture
    239,152 Most Valuable Professional on at

    It works for me. Let me show you what I did (it doesn't use most of your code, as it's not needed).

    I created a new table (WptColorTmp), set TableType = TempDB and dragged ItemId EDT to Fields, which created a field and a relation to InventTable.

    Then I created a new form and added data sources for InventTable and WptColorTmp. On WptColorTmp datasource, I set JoinSource = InventTable and LinkType = ExistJoin. Then I added a grid showing ItemId from InventTable.

    Then I added this code:

    private WptColorTmp wptPopulateColorTmp()
    {
        WptColorTmp tmp;
    
        tmp.ItemId = 'A0001'; // Exists in USMF demo data
        tmp.insert();
    
        return tmp;
    }
    
    public void init()
    {
        super();
    
        WptColorTmp.linkPhysicalTableInstance(this.wptPopulateColorTmp());
    }

    When I run the form, it works as expected. Try it yourself and then compare it with your attempted implementation.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans