AX视图View中添加静态方法

时间:2023-03-09 04:19:18
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);
}