An example to handle QueryBuildDataSource in class

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;
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容