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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Suggested Answer

how to create the related field fixed relation in query object in x++ code?

(0) ShareShare
ReportReport
Posted on by

how to create the related field fixed relation in query object(through addlink() method) in X++ code?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    DavidGunawan Profile Picture
    1,381 on at

    Hi Kavitha,

    I think your objective can be achieved by add range in the query. So it will possible to has a filter and give the same results with field fixed relation.

    Do you need some example?

  • Community Member Profile Picture
    on at

    Hi DavidGunawan,

    Kindly give example in X++ code to explain the field fixed relation in query objects.

  • DavidGunawan Profile Picture
    1,381 on at

    Please find the example:

    static void testQuery()

    {

       Query q;

       QueryRun qr;

       QueryBuildDataSource qbd;

       QueryBuildDataSource qbd2;

       QueryBuildRange qbr;

       //Define query

       q = new Query();

       qbd = q.addDataSource(TableNum(InventTable));

       //Join with other table (InventSum)

       qbd2 = qbd.addDataSource(tableNum(InventSum));

       qbd.relations(true);

       qbd.joinMode(JoinMode::InnerJoin);

       //Add range, this will act similar like filed fixed relation

       qbr = qbd.addRange(FieldNum(InventTable, ItemType));

       qbr.value(SysQuery::value(enums2str(ItemType::Item)));

       qr = new QueryRun(q);

       qr.prompt();

       pause;

    }

  • DavidGunawan Profile Picture
    1,381 on at

    Hi Kavitha,

    Have you solved this issue? If yes, please flag this question as solved. So it will help others. Thank you.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans