03.04.2007, 23:11
|
#1
|
Участник
|
casperkamal: A small addition to creation of Table throug x++ code in Dynamics Ax
Источник: http://casperkamal.spaces.live.com/B...CD63!261.entry
==============
A small addition to my entry on Adding a Table field through X++ code in Dynamics Ax
I was actually using map's and structures to set the properties for the field type. There is also an alternative way of setting it throug the Global::setproperty method....
Global::setProperty(str properties, str propertyname, str value)
I have rewritten the job based on that.......
static void JobCreateTableFields(Args _args)
{
#AOT
#TreeNodeSysNodeType //find the Table
TreeNode tablenode = TreeNode::findNode(#TablesPath).AOTfindChild('LedgerTable');
TreeNode fieldNode, tn;
Struct properties;
Struct propertyInfo;
Array propertyArray;
str propertyValue;
AOTTableFieldList lst;
str name;
Counter propertyCount;
int i;
Map map = new Map(Types::String, Types::String);
;
//Find the tables field node
lst = tablenode.AOTfindChild('fields');
//add the field
lst.addString('Test');
//now find the node in the tree
fieldNode = lst.AOTfindChild('Test');
//can be used when we requried to set a fewer properties
fieldNode.AOTsetProperties(setProperty(fieldNode.AOTgetProperties(), 'Label', 'TestField'));
//save the treenode
tablenode.AOTsave();
//Let us open the table
//and see if the code works :)
tablenode.AOTnewWindow();
}
............................. 

Источник: http://casperkamal.spaces.live.com/B...CD63!261.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
|
|