我正在使用以下代码片段从 c# 中提取 Dynamics AX 2009 中的数据。这很好用,除了那些基础字段类型是维度的情况。我希望能够在返回数组类型时“展平”它们,但看不到任何方法可以做到这一点。有什么想法吗?
axRecord = ax.CreateAxaptaRecord(tableName);
axRecord.ExecuteStmt(strQuery);
// Loop through the set of retrieved records.
using (StreamWriter sw = File.CreateText(path))
{
AxaptaObject axDictTable = ax.CreateAxaptaObject("SysDictTable",axRecord.get_Field("tableid"));
outputRow = null;
List<int> ids = new List<int>();
for (int i = 1; i <= (int)axDictTable.Call("fieldCnt"); i++)
{
AxaptaObject axDictField = ax.CreateAxaptaObject("DictField", axRecord.get_Field("tableid"), axDictTable.Call("fieldCnt2ID", i));
outputRow += ((string)axDictField.Call("Name")) + ",";
ids.Add((int)axDictTable.Call("fieldCnt2ID", i));
}
sw.WriteLine(outputRow);
while (axRecord.Found)
{
outputRow = null;
foreach(int i in ids)
outputRow += axRecord.get_Field(i).ToString().Replace(",", "") + ",";
sw.WriteLine(outputRow);
axRecord.Next();
}
}