Domanda

In Microsoft Dynamics AX, come posso ottenere un elenco di metodi su una tabella da C #?

È stato utile?

Soluzione

Il metodo X ++ seguente utilizza il nome della tabella come parametro e restituisce un ArrayList dei metodi. Puoi chiamare i metodi statici X ++ dal tuo codice C # (per questo ti serve il .Net Business Connector).

public static System.Collections.ArrayList getTableMethods(str _tableName)
{
    SysDictTable sdt;
    TreeNode tn;
    TableId tableId;
    MethodInfo methodInfo;
    System.Collections.ArrayList methodArr;
    #AOT
    ;

    tableId = tableName2id(_tableName);

    sdt = SysDictTable::newTableId(tableid);

    methodArr = new System.Collections.ArrayList();
    tn = TreeNode::findNode(#TablesPath + "\\" + _tableName + "\\" + "Methods");
    tn = tn.AOTfirstChild();
    while(tn)
    {
        methodArr.Add(tn.AOTname());
        tn = tn.AOTnextSibling();
    }

    return methodArr;
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top