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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

UIBuilder: "The data source is not embedded within a (parent) data source." Error For Doing a Parameter Lookup

(0) ShareShare
ReportReport
Posted on by 1,036

Hello awesome community!

This is my first take on using UIBuilder, so please correct the newbie!

I want to have a lookup in a parameter, Table name: "PurchAgreementHeader" Field Name: "PurchNumberSequence".

The drop down button appears next to the parameter field, but once I click on it I get this error saying: "The data source is not embedded within a (parent) data source."

I believe the issue is coming from the lookup method, so here how my lookup method looks like:

public void lookup(FormStringControl _control)
{

    Query                   query = new Query();
    QueryBuildDataSource    qbds;



    sysTableLookup = SysTableLookup::newParameters(tableNum(PurchAgreementHeader), _control);
    sysTableLookup.addLookupfield(fieldNum(PurchAgreementHeader, PurchNumberSequence));

    sysTableLookup.addSelectionField(fieldNum(PurchAgreementHeader, PurchNumberSequence));

    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();

}

Is there something wrong in the lookup method?

Any advice would be appreciated :)

Thanks in advance!

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,035 Super User 2025 Season 2 on at

    Hi Momochi,

    For future question, would you mind to use keywords in the tags, not complete sentences? I have cleaned it for you.

  • Momochi Profile Picture
    1,036 on at

    Oh sorry about that, will do it next time.

    Thanks.

  • Suggested answer
    Alex Voytsekhovskiy Profile Picture
    on at

    this line empties your query, I guess

    sysTableLookup.parmQuery(query);

  • Verified answer
    BrandonSA Profile Picture
    1,673 on at

    Hi Momochi

    The problem is that your query has nothing in it.

    You initiate the query, but then you do nothing with it.

    You should at least add this second line of code:

    Query query = new Query();
    query.addDatasource(tablenum(PurchAgreementHeader));


    You should then add any other line of code you need to manipulate the query. But that'll get you started.

  • Momochi Profile Picture
    1,036 on at

    It did solve my issue!

    I thought this line :

    sysTableLookup = SysTableLookup::newParameters(tableNum(PurchAgreementHeader), _control);

    would add the table to the query but turned out i'm wrong and I need to use the line you suggested to add the datasource to the query.

    Thanks alot!

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans