Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamically assigning datasource for a query in AOT

1 view
Skip to first unread message

chakri

unread,
Dec 17, 2009, 5:29:01 AM12/17/09
to
can any one tell me how to assign datasource to a query present in AoT
through code. I am able to add a new query to AOT dynamically and delete it.
But not able to assign a datasource and range to that ...


Klaas Deforche

unread,
Dec 17, 2009, 10:30:07 AM12/17/09
to
Hi chakri,

This should do the trick:
static void CreateQueryFromCode(Args _args)
{
TreeNode treeNode;
Query query;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
str queryName = "MyQuery";
#AOT
;
treeNode = TreeNode::findNode(#QueriesPath);
query = treeNode.AOTfindChild(queryName);
if (!query)
{
treeNode.AOTadd(queryName);
query = treeNode.AOTfindChild(queryName);
qbds = query.addDataSource(tablenum(Address));
qbr = qbds.addRange(fieldnum(Address,Name));
qbr.value("a name");
query.AOTcompile(1);
query.AOTsave();
}
}

Best regards,
Klaas.
----------------
http://www.artofcreation.be

0 new messages