how to create the related field fixed relation in query object(through addlink() method) in X++ code?
*This post is locked for comments
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?
Hi DavidGunawan,
Kindly give example in X++ code to explain the field fixed relation in query objects.
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;
}
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Community Member 4
Martin Tocauer 4
Nayyar Siddiqi 2