Friday, August 28, 2015

How to find out number of field & field names in the table using X++

static void DictTable(Args _args)
{
dictTable dt;
DictField df;
int numberOfFields;
int fieldId;
int i;
str table;
;

table = 'salestable';
dt = new dictTable(tablename2id(table));
numberOfFields = dt.fieldCnt();
info(strFmt("%1",dt.fieldCnt()));
for (i = 1; i <= (numberOfFields); i++)
{
fieldId = dt.fieldCnt2Id(i);
df = dt.fieldObject(fieldId); //instead of we can use below line.
info(df.label());    

}
 
}

No comments:

Post a Comment

How to enable the dimension fields based on the Item selected on the form.

[Form] public class KMTShipFromWarehouses extends FormRun {     InventDimCtrl_Frm_EditDimensions        inventDimFormSetup;     /// &l...