I am selecting the table dyanamicaly .So In the bellow code in need to create the Table object dynamicaly to catch the queryrun data.
Query q;
QueryRun qr;
QueryBuildDataSource qbd;
QueryBuildRange qbr;
CustTable Cust, cust1;
vendtable vend ;
DictTable dt;
str tabName ;
;
q = new Query();
qbd = q.addDataSource(ChkNumberSeq.convTableId); // here m using the table ID which is dynamic .
qr = new QueryRun(q);
if(qr.prompt())
{
while (qr.next())
{
if(qr.changed(ChkNumberSeq.convTableId))
{
cust = qr.get(ChkNumberSeq.convTableId); // i am using CustTable object to catch the data .i need to create table object dynamicaly to catch the data or else can i get the data from querrun itself.
i am developing one form in which i have given one lookup from where user will select the table.Now i hav the table id of that table .As i given in a code m applaying some range on it.So now m getting the data from queryrun .My problem is how i can catch that data ?
That’s what m thninking . IF i declare common table varible i can use it as a selected table object.But how i sappose to declare a common table variable ? working on Ax03 .
You can use reflection to get information about the actual table and access fields in X++ via their IDs. The following example shows values of all fields in a given table:
Common t1 = InventParameters::find();
SysDictTable dictTable = new SysDictTable(t1.TableId);
FieldId fieldId;
;
fieldId = dictTable.fieldNext(0);
while (fieldId)
{
print t1.(fieldId);
fieldId = dictTable.fieldNext(fieldId);
}
pause;
You can modify it in many ways, depending on what you need and what information you have about the tables. For example, you may get fields from a particular field group, find fields with specific data types and so on.