Thursday, October 29, 2015

AX 2012:Common Table

Common Table in ax 2012

Common :The system table Common is the base for all tables. The table contains no data, and the
table can be compared with a temporary application table. Common is used like the base
type anytype. You can set any table equal to the table Common. This is useful if you
need to transfer a table as a parameter and not knowing the exact table before execution
time

static void DataDic_Common(Args _args)
{
Common common;
CustTable custTable;
;
common = custTable;
if (common.tableId == tablenum(custTable))
{
while select common
{
info(common.(fieldnum(custTable, name)));
}
}
}

The example above is initializing Common with CustTable. A check is made to assure
that Common is now equal to CustTable. All records from CustTable are looped, and
the customer name is printed in the InfoLog. Notice, the system function fieldnum() is
used to get the field name printed. If you do not know the fieldname at runtime, you can
Ax2012 - get the value of accountNum in the selected row in a grid from
In the form cutslistepage , i want to get the value of accountNum of the selected row in grid and passe it to another form i have try that :

int64 recordsCount;

    recordsCount = CustTable_ds.recordsMarked().lastIndex();
  //  CustTable = CustTable_ds.getFirst(1);
 
enter the field id in parentheses instead.

If only one record is selected you can do:
info(CustTable_ds.accountNum);
Otherwise, if more than one record is selected you need to do something like:
custTable = CustTable_ds.getFirst(true);
while (custTable)
{
    info(custTable.accountNum);
    custTable = CustTable_ds.getNext();
}

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8