Friday, December 10, 2010

To get a property name (Ax30)

static void getDataSourceTableProperty(Args _args)
{
#AOT
#properties
TreeNode datasourcesNode, datasourceNode;
List tablesAccessed = new List(types::String);
str prop;
int pos;
int posIndex;
int colCount;
str tableName;
;
datasourcesNode = TreeNode::findNode(#FormsPath + #AOTDelimiter + "CustTable" + '\\Data Sources');

if(datasourcesNode.AOTchildNodeCount() > 0)
{
datasourceNode = datasourcesNode.AOTfirstChild();

//List pages can use queries as their datasource. Want to get just the tables.
if(datasourceNode.sysNodeType() == 330)
{
datasourceNode = datasourceNode.AOTnextSibling();
}
prop = datasourceNode.AOTgetProperties();
pos = findPropertyPos(prop,#PropertyTable);
pos = strFind(prop,'#',pos,strLen(prop));
posIndex = findPropertyPos(prop,#PropertyIndex);
tableName = strrem(strrtrim(substr(prop,pos+1,posIndex-pos-1)),"\n");

tablesAccessed.addEnd(tableName);
info("OK");
}


}