美文网首页
An example to handle QueryBuildD

An example to handle QueryBuildD

作者: axxxxxxxx | 来源:发表于2019-08-29 09:45 被阅读0次

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;
}

相关文章

网友评论

      本文标题:An example to handle QueryBuildD

      本文链接:https://www.haomeiwen.com/subject/ujpbectx.html