以表格形式记录Dynamics AX

时间:2018-09-18 13:17:44

标签: axapta microsoft-dynamics executequery

我已经以数据源形式创建了executeQuery()方法,该方法应该隐藏不必要的记录。但是只有一个字段不可见,其他字段可见。发生了什么? enter image description here

public void executeQuery()
{
    Query query;
    QueryBuildDataSource qbds, qbdsTypeDef;
    QueryBuildRange queryBuildRange, queryBuildRangeAgregat;
    QueryBuildRange queryBuildRangeParent;
    if(element.args())
    {
        qbds = KPFinStatementTable_ds.query().dataSourceTable(tablenum(KPFinStatementTable));
        queryBuildRange = qbds.addRange(fieldnum(KPFinStatementTable,OperationDate));
        queryBuildRange.value(queryValue(element.args().parm()));

    queryBuildRangeAgregat = qbds.addRange(fieldnum(KPFinStatementTable,IsAggregate));
    queryBuildRangeAgregat.value(queryValue(NoYes::Yes));
    queryBuildRangeAgregat = qbds.addRange(fieldnum(KPFinStatementTable,Level));
    queryBuildRangeAgregat.value(queryValue(1));

    queryBuildRangeAgregat = qbds.addRange(fieldnum(KPFinStatementTable,AggrLevel));
    queryBuildRangeAgregat.value(queryValue(KPFinStatementListPageType::AggrLevel1));

    qbdsTypeDef = KPFinStatementTable_ds.query().dataSourceTable(tablenum(KPFinStatementTypeDef));
    queryBuildRangeParent = qbdsTypeDef.addRange(fieldnum(KPFinStatementTypeDef,FinStatementTypeDefParent));
    queryBuildRangeParent.value(queryValue(0));

    super();
}
}

更新:我找到了解决方法,而不是

qbdsTypeDef = KPFinStatementTable_ds.query().dataSourceTable(tablenum(KPFinStatementTypeDef));

您应该写:

qbdsTypeDef = qbds.addDataSource(tablenum(KPFinStatementTypeDef));
qbdsTypeDef.relations(true);

0 个答案:

没有答案