I just started new job where they use dynamics ax 2009. I am new to this technology.
Is there a way in x++ to iterate over any table? I don't know where the data comes from, it's lenght nor field count.
What I mean by that is I need a function that would behave like this
void convert(Table anyTable)
{
int i=0;
int k=0;
;
for(i; i < anyTable.Lenght; i++)
{
for(k; k < anyTable[i].Count; k++)
{
//some xml processing
}
}
}
(By Table i mean some kind of parent of all tables). And that basically is my question - is there a parent of all tables or something of such sort that can help me achieve something like this?
I am sorry for formatting, im typing this from mobile device
Check out xml() method on Common class, it may help generate your XML representing the current record.
The
Common
table is the base class for all tables. It does not contain any data. It is primarily used in X++ code to refer to any table in a polymorphic way. Please checkDictionary
classes to solve your issue:See this answer. It involves use of class
Dictionary
andDictTable
for reflection.