Loop through all the fields of a table in Ax 2012

Here we will find all fields from table using loop through all the fields of a table in X++:

static void FindFieldFromtable(Args _args)
{
    SysDictTable    dictTable = new SysDictTable(tableNum(A_PO));
    SysDictField    dictField;
    TreeNode        treeNode;
    FieldId         fieldId = dictTable.fieldNext(0);

    while (fieldId)
    {
        dictField = dictTable.fieldObject(fieldId);

        if (dictField.isSql() && !dictField.isSystem())
        {
            treeNode = dictField.treeNode();
            info(strFmt("%1 | %2 | %3",
                dictField.name(),                                               // Field name
                treeNode.AOTgetProperty("Label"),                               // Label id
                SysLabel::labelId2String(treeNode.AOTgetProperty("Label"))));   // Label string
        }
        fieldId = dictTable.fieldNext(fieldId);
    }
}
Run and get Fields from table.

Related Posts

Previous
Next Post »

Thanks for comments.....

:)
:(
hihi
:-)
:D
=D
:-d
;(
;-(
@-)
:P
:o
:>)
(o)
:p
:-?
(p)
:-s
(m)
8-)
:-t
:-b
b-(
:-#
=p~
$-)
(y)
(f)
x-)
(k)
(h)
cheer