Vijaya
Vijaya

Reputation: 101

How to get the tables from AOT query in ax 2012

I have drop down in one page, I am selecting AOT query in first page then i will click on next button, then it has to show tables related to that query

Upvotes: 3

Views: 2145

Answers (1)

Maxim Lazarev
Maxim Lazarev

Reputation: 1254

If you have a query name, you can loop through all of its datasources like this:

str queryName = "ActivityListOpen";
int i, dbcount;
QueryBuildDataSource qbds;
Query query = new Query(queryName);
dbcount = query.dataSourceCount();

for (i = 1;  i <= dbcount; i++)
{
    qbds = query.dataSourceNo(i);
    info(qbds.name());
}

You can also use table() method on QueryBuildDataSource to retrieve table Id.

Upvotes: 3

Related Questions