How to lookup dimension attribute in ax 2012

这里有一个dimension 就DDA。下面是查找DDA的例子。

public void lookupToDDA(FormStringControl _formStringControl)
{
    LedgerParameters                    ledgerParameters;
    DimensionAttribute                  dimAttr;
    DimensionAttributeDirCategory       dimAttributeDirCategory;
    DimensionHierarchy                  dimher;
    DimensionHierarchylevel             dimherLevel;
    LedgerStructure                     accountStructure;

    Query                               query = new Query();
    QueryBuildDataSource                qbds;
    SysTableLookup                      sysTableLookup;
    String15                            dda;

    ;

    dda = 'C_DDA_'+curext();  // no, should get it real  ledger-dimensionhierachy -


    dimAttr = DimensionAttribute::findByName(dda);
    select firstonly DirCategory from dimAttributeDirCategory where dimAttributeDirCategory.DimensionAttribute == dimAttr.RecId;

    sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionFinancialTag), _formStringControl);
    sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value));
    sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description));

    qbds = query.addDataSource(tableNum(DimensionFinancialTag));
    qbds.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory)).value(queryValue(dimAttributeDirCategory.DirCategory));
//lookup dda that large than from dda value
    qbds.addRange(fieldNum(DimensionFinancialTag, Value)).value(strFmt(">%1", dialogFrDDA.value()));

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();

}

你可能感兴趣的:(How to lookup dimension attribute in ax 2012)