Показать сообщение отдельно
Старый 08.07.2019, 18:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
axaptacorner: Create Query dynamically in AOT through code:
Источник: http://axaptacorner.blogspot.com/201...t-through.html
==============

Create Query dynamically in AOT through code:

static void CreateQueryInAOT(Args _args)
{
TreeNode treeNodeObj;
Query queryObj; // Extends TreeNode class.
QueryBuildDataSource qbds;
QueryBuildRange qbr;
QueryRun qr;
CustTable xrecCustTable;
str queryName = "TestQuery";
// Macro.
#AOT
// Delete the query from the AOT, if the query exists.
treeNodeObj = TreeNode::findNode(#QueriesPath);
treeNodeObj = treeNodeObj.AOTfindChild(queryName);
if (treeNodeObj) { treeNodeObj.AOTdelete(); }
// Add the query to the AOT.
treeNodeObj = TreeNode::findNode(#QueriesPath);
treeNodeObj.AOTadd(queryName);
queryObj = treeNodeObj.AOTfindChild(queryName);
// Further define the query.
qbds = queryObj.addDataSource(tablenum(CustTable));
qbr = qbds.addRange(fieldnum(CustTable, CustGroup));
qbr.value("Inter");
// Compile the query.
queryObj.AOTcompile(1);
queryObj.AOTsave();
// Run the query.
qr = new QueryRun("TestQuery");
while ( qr.next() )
{
xrecCustTable = qr.GetNo(1); // 1 means first data source.
Global::info(strFmt("%1 , %2",
xrecCustTable.AccountNum, xrecCustTable.CustGroup));
}


Источник: http://axaptacorner.blogspot.com/201...t-through.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.