Powered By Blogger

Thursday, April 7, 2011

Multiple table properties update

Guys -

Sometimes if you need to update a set of tables (sales*,proj*,purch*,address*) for few properties. You can opt
below script which basically look in all that related tables that are in the database (SQLDictionary) and keep on iterating until all that tables gets updated.



static void ChangeTableProperties(Args _args)
{
SQLDictionary dictionary;
TreeNode treeNode;
str properties;
Counter i;
;
while select dictionary
where dictionary.fieldId == 0 && dictionary.name like("Address*")
{
treeNode = TreeNode::findNode('\\data dictionary\\tables\\' + dictionary.name);
if (treeNode)
{
properties = treeNode.AOTgetProperties();
properties = setProperty(properties, 'CreatedDateTime', 'Yes');
properties = setProperty(properties, 'CreatedBy', 'Yes');
treeNode.AOTsetProperties(properties);
treeNode.AOTsave();
i++;
}
}
info(strfmt("NO of tables which has been updated - %1",i));
}

No comments:

Post a Comment