An example to handle QueryBuildD

2019-08-29  本文已影响0人  axxxxxxxx

Return query on specific financial dimension and financial dimension value

// Changed on 30/7/2019 at 15:51:20 by chloel
public static QueryBuildDataSource joinDimensionAttributeLevelValueView(
    QueryBuildDataSource _qbds,
    DimensionAttribute   _dimAttr,
    anytype _fromValue = "",
    anytype _toValue = "")
{
   QueryBuildDataSource  qbds;

   // verify the source is GeneralJournalAccountEntry table
   if(_qbds.table() != tableNum(GeneralJournalAccountEntry))
        throw error(Error::wrongUseOfFunction(funcName()));

   //join DimensionAttributeLevelValueView
    qbds = _qbds.addDataSource(tableNum(DimensionAttributeLevelValueView));
    qbds.addlink(fieldNum(GeneralJournalAccountEntry, LedgerDimension), fieldNum(DimensionAttributeLevelValueView,ValueCombinationRecId));
    qbds.joinMode(JoinMode::InnerJoin);
    qbds.fetchMode(QueryFetchMode::One2One);

   //query the range of dimensionattribute, for example "C_DDA"
    qbds.addRange(fieldNum(DimensionAttributeLevelValueView, DimensionAttribute)).value(queryValue(_dimAttr.RecId));

   // query the value of dimensionattribute value, for example "UNC~UNC~UNCL"
    qbds.addRange(fieldNum(DimensionAttributeLevelValueView, DisplayValue)).value(SysQuery::range(_fromValue, _toValue));


    return qbds;
}
上一篇 下一篇

猜你喜欢

热点阅读