I'd like to create a class in AX2012 which I can call from Ax2012 Business Connector that allows me to generate the SQL statement for a specified table.
The method I implemented at the class is:
client server public static str getTableStatement(str tableName)
{
OMInternalOrganization org;
select generateOnly org;
info(org.getSQLStatement());
return org.getSQLStatement();
}
My question is: how can I now use the parameter tableName instead of the static assignment of OMInternalOrganization.
It would be also fine to find another way of getting the SQL statement.
I'm a .Net Developer and have nearly NO experience with X++ development.
Thank you for your help!
You can use SysDictTable::makeRecord
.
client server public static str getTableStatement(str tableName)
{
Common buffer;
;
buffer = SysDictTable::newName(tableName).makeRecord();
select generateOnly buffer;
info(buffer.getSQLStatement());
return buffer.getSQLStatement();
}