AX视图View中添加静态方法
public static server str EcoResCategoryName()
{
DictView dv = new DictView(tableNum("ViewName"));
SysDictTable ecoresCatory = new SysDictTable(tableNum(EcoResCategory));//视图中包含数据源EcoResCategory
str idFieldName = dv.computedColumnString(
'EcoResProductCategory',
fieldStr(EcoResProductCategory, Category),
FieldNameGenerationMode::WhereClause);
return strFmt('select Name from %1 where %1.recid = %2',
ecoresCatory.name(DbBackend::Sql),
idFieldName);
}