Dynamicaly creating the table

Hi

i have some requirement where i need to create the temporary table dynamically.Please anybody can help me how to create the table dynamically.

Thanks & regards

Bijesh kumar singh

Hi,

You can use the below code in order to create the ‘table’ in ax:

static void Tbl(Args _args)
{
#aot
#properties
SysDictTable sysdictTable;
treenode trv;
AOTTableFieldList fieldnode;
str prop;
int pos;
;
trv = treenode::findNode(#TablesPath);
//trv.AOTDrop(‘AAA’,1);
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());

}

Hi Vishal

Thank you very much it working fine.

Thanks & Regards

Bijesh kumar singh