blog for Dynamics Axapta

Hi Friends,

Here I have posted the code(not entire job/program) for adding multiple ranges/relations with the same table using Query object

Code Starts Here:

QueryRun qr;

//1st DataSource

QueryBuildDataSource qbdTableSourcefromQuery; // get query from the AOT Query which used by System in SysQuery()
QueryBuildDataSource qbdTableSourcefromCode; // newly added Query for Account Number Range

qr = new QueryRun(“your Query”);

qbdCustTableSourcefromQuery = SysQuery::findOrCreateDataSource(qr.query(), tableNum(TableName1));

SysQuery::findOrCreateRange(qbdCustTableSourcefromQuery, fieldNum(TableName1, FieldName)).value(“QueryValue”);

//2nd DataSource

qbdCustTableSourcefromCode = qbdCustTableSourcefromQuery.addDataSource(tableNum(TableName1), “TableNameNew”);
qbdCustTableSourcefromCode.addRange(fieldNum(TableName1, FieldName)).value(queryValue(“QueryValue”));


// Vasanth Arivali


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: