Query link and query build datasource example
static void QueryLinks(Args _args)
{
Query query = new Query(queryStr(custtable));//Give your query name as in AOT...
void getLinks(QueryBuildDatasource _qbds)
{
QueryBuildDataSource childDataSource;
QueryBuildLink queryBuildLink;
Counter links;
int i;
;
if (_qbds.enabled())
{
setPrefix (tableId2Name(_qbds.table()));
if(_qbds.level() > 1)
{
while (links < _qbds.linkCount())
{
links++;
queryBuildLink = _qbds.link(links);
info(strFmt("%1.%2 --> %3.%4",
tableId2Name(queryBuildLink.relatedTable()),
fieldId2Name(queryBuildLink.relatedTable(), queryBuildLink.relatedField()),
tableId2Name(queryBuildLink.table()),
fieldId2Name(queryBuildLink.table(),queryBuildLink.field())));
}
}
for (i = 1; i <= _qbds.childDataSourceCount(); i++)
{
childDataSource = _qbds.childDataSourceNo(i);
getLinks(childDataSource);
}
}
}
;
setPrefix(strFmt("Query: '%1'", query.name()));
getLinks(query.dataSourceNo(1));
}