04 October 2010

Creating Table with X++ Code

static void Create_Table_with_Code(Args _args)

{

SysDictTable sysdictTable;
treenode trv;// its a class
AOTTableFieldList fieldnode;
str prop;
int pos;
#AOT
#Properties
;
//#Table path refer the \\Data Dictionary\\Tables and finding the path
trv = treenode::findNode(#TablesPath);
//AOTadd method is to add table in tables//AAA is table name
trv.AOTadd('AAA');
trv = trv.AOTfindChild('AAA');
trv.AOTcompile(1);
trv.AOTsave();
trv.AOTfindChild('AAA');
fieldnode = trv.AOTfirstChild();
fieldnode.addString('AccountNum');
fieldnode = fieldnode.AOTfindChild('AccountNum');
prop = fieldnode.AOTgetProperties();
pos = findPropertyPos(prop,#PropertyExtendeddatatype); //find right place to put extended data type
pos = strFind(prop,'ARRAY',pos,strLen(prop));
pos = strFind(prop,'#',pos,strLen(prop));
prop = strins(prop,extendedTypeId2name(ExtendedtypeNum(CustAccount)),pos + 1);
// insert field of extended data type 'CustAccount'
fieldnode.AOTsetProperties(prop);
trv.AOTcompile(1);
trv.AOTsave();
trv.AOTRestore(); //to load assigned extended data type properties
sysdictTable = sysdictTable::newTreeNode(trv);
appl.dbSynchronize(sysdictTable.id());

}

1 comment:

  1. How to print child nodes we r giving only parent node using x++ code

    ReplyDelete

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...