How can I check what TreeNode object I have found?
Related topic: community.dynamics.com/.../get-the-query-from-view
static void GetViewFromQuery(Args _args)
{
#AOT
#define.QueryName(MainQuery)
#define.viewName('mainView')
TreeNode treeNode;
str tmp;
;
tmp = strFmt(#QueryPath + #AOTDelimiter + #ApplicationDataSourcesPath, identifierStr(#QueryName));
treeNode = TreeNode::findNode(tmp);
if (treeNode)
{
treeNode = treeNode.AOTfirstChild(); // Get the first data source -> view (as table)
if (treeNode)
{
tmp = treeNode.treeNodeName();
if (tmp == #viewName)
{
info(strFmt("View %1 found", tmp));
}
}
}
}
The code above can be used to find the data source offset within a query. And yes it is possible to compare the name of the datasource to a name I already know....but I find that a erroneous way.
My question is how can I check if the found treenode is of type 'view'?