Dynamics 365财务和运营SSRS从属参数

时间:2018-03-06 13:05:00

标签: reporting-services axapta dynamics-365-operations

我正在尝试创建一个依赖参数,但我正在努力让它正常工作。一旦我选择了一个项目,那么当我点击估计参数来显示相关估计值时。如果我更改项目parm,则不会更新估计parm。请参阅下面的代码等。我是X ++开发的新手,不知道我是否需要一个构建方法来过滤参数,所以我现在已将它注释掉了。

/// <summary>
/// Data Contract class for ProjListTransProj SSRS report
/// </summary>
/// <remarks>
/// This is the Data Contract class for the ProjListTransProj SSRS Report.
/// </remarks>

[
DataContractAttribute,
SysOperationContractProcessingAttribute(classStr(ProjListTransProjUIBuilder))
]
public class ProjListTransProjContract
{
    ProjId     projId;
    EstimateTemplateCode    EstimateTemplateCode;

[
        DataMemberAttribute('ProjId'),
        SysOperationLabelAttribute(literalstr("ProjId")),
        SysOperationHelpTextAttribute(literalstr("ProjId"))
]
    public ProjId parmProjId(ProjId _projId = projId)
    {
        projId = _projId;
        return projId;
    }
    [
    DataMemberAttribute('EstimateTemplateCode'),
    SysOperationLabelAttribute(literalstr("Estimate Template")),
    SysOperationHelpTextAttribute(literalstr("Select Estimate Template"))
    ]
public EstimateTemplateCode parmEstimateTemplateCode(EstimateTemplateCode _EstimateTemplateCode = EstimateTemplateCode)
{
    EstimateTemplateCode = _EstimateTemplateCode;
    return EstimateTemplateCode;
}

}
public class ProjListTransProjUIBuilder extends SrsReportDataContractUIBuilder
{
    ProjId                          parmProjId;
    EstimateTemplateCode        EstimateTemplateCode;
    ProjListTransProjContract   contract;

//public void build()
//{

//    //get the current dialog
//    Dialog      dlg = this.dialog();

//    //get the report data contract object
//    contract = this.dataContractObject();
//    projId = contract.parmProjId();

//    //associate dialog field with data contract method
//    this.addDialogField(methodStr(ProjListTransProjContract,parmProjId), contract);
//}

public void lookupEstimate(FormStringControl _formStringControl)
{
    contract = this.dataContractObject();
    parmProjId = contract.parmProjId();
    Query query = new Query();
    QueryBuildDataSource    qbdsEstimateTemplateTable, qbdsEstimateTemplateProj;
    SysTableLookup  sysTableLookup = sysTableLookup::newParameters(tableNum(EstimateTemplateTable), _formStringControl);

    qbdsEstimateTemplateTable = query.addDataSource(tableNum(EstimateTemplateTable));

    qbdsEstimateTemplateProj = qbdsEstimateTemplateTable.addDataSource(tableNum(EstimateTemplateProj));
    qbdsEstimateTemplateProj.relations(true);

    qbdsEstimateTemplateProj.addRange(fieldNum(EstimateTemplateProj, ProjId)).value(parmProjId);

    sysTableLookup.addLookupfield(fieldNum(EstimateTemplateTable, Code));
    sysTableLookup.addLookupfield(fieldNum(EstimateTemplateTable, Name));
    sysTableLookup.addLookupfield(fieldNum(EstimateTemplateTable, Status));
    sysTableLookup.addLookupMethod(tableMethodStr(EstimateTemplateTable, displayGrandTotalValue));
    sysTableLookup.addLookupfield(fieldNum(EstimateTemplateTable, CreatedDateTime));
    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();
}

public void postBuild()
{
    DialogField dlgEstimate;

    super();

    //get the field to override by providing the data contract object and the associated attribute/method
    dlgEstimate = this.bindInfo().getDialogField(this.dataContractObject(),
            methodStr(ProjListTransProjContract,parmEstimateTemplateCode));

    //register the method we want to override
    dlgEstimate.registerOverrideMethod(
      methodStr(FormStringControl, lookup),
      methodStr(ProjListTransProjUIBuilder,lookupEstimate),
      this);
}

}

1 个答案:

答案 0 :(得分:0)

UI构建器示例,其中第二个参数通过选择第一个参数进行过滤。

public class ProjListTransProjUIBuilder extends SrsReportDataContractUIBuilder
{
    ProjId                          parmProjId;
    EstimateTemplateCode            EstimateTemplateCode;
    ProjListTransProjContract       contract;
    DialogField                     dialogProjId;
    DialogField                     dialogEstimate;


public void build()
{
    //get the current dialog
    Dialog      dialogLocal  = this.dialog();

    //get the report data contract object
    contract = this.dataContractObject();
    parmProjId = contract.parmProjId();

    //associate dialog field with data contract method
    dialogProjId = this.addDialogField(methodStr(ProjListTransProjContract,parmProjId), contract);
    dialogEstimate = this.addDialogField(methodStr(ProjListTransProjContract,parmEstimateTemplateCode), contract);
}

public boolean projIdModified(FormStringControl _control)
{
    dialogProjId.value(_control.valueStr());
    dialogEstimate.value('');
    return true;
}

public void lookupEstimate(FormStringControl _control)
{
    Query query = new Query();
    QueryBuildDataSource    qbdsEstimateTemplateTable, qbdsEstimateTemplateProj;
    SysTableLookup  sysTableLookup = sysTableLookup::newParameters(tableNum(EstimateTemplateTable), _control);

    qbdsEstimateTemplateTable = query.addDataSource(tableNum(EstimateTemplateTable));

    qbdsEstimateTemplateProj = qbdsEstimateTemplateTable.addDataSource(tableNum(EstimateTemplateProj));
    qbdsEstimateTemplateProj.relations(true);

    qbdsEstimateTemplateProj.addRange(fieldNum(EstimateTemplateProj, ProjId)).value(dialogProjId.value());

    sysTableLookup.addLookupfield(fieldNum(EstimateTemplateTable, Code));
    sysTableLookup.addLookupfield(fieldNum(EstimateTemplateTable, Name));
    sysTableLookup.addLookupfield(fieldNum(EstimateTemplateTable, Status));
    sysTableLookup.addLookupMethod(tableMethodStr(EstimateTemplateTable, displayGrandTotalValue));
    sysTableLookup.addLookupfield(fieldNum(EstimateTemplateTable, CreatedDateTime));
    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();
}

public void postBuild()
{

    super();

    //get the field to override by providing the data contract object and the associated attribute/method
    dialogProjId = this.bindInfo().getDialogField(this.dataContractObject(),
            methodStr(ProjListTransProjContract,parmProjId));

    if (dialogProjId)
    {
        dialogProjId.lookupButton(2);
    }



    // register override method for lookup cust Group
    //dialogProjId.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(ProjListTransProjUIBuilder, lookupEstimate), this);
    // register override method for modified
    dialogProjId.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(ProjListTransProjUIBuilder, projIdModified), this);

    //binding info for estimate drop down
    dialogestimate = this.bindInfo().getDialogField(
                     this.dataContractObject(),
                     methodStr(ProjListTransProjContract,parmEstimateTemplateCode));

    // register override method for lookup estimate
    dialogestimate.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(ProjListTransProjUIBuilder, lookupEstimate), this);

    if (dialogEstimate)
    {
        dialogEstimate.lookupButton(2);
    }

}

    public void getFromDialog()
    {
        contract = this.dataContractObject();
        super();
    }

    public void initializeFields()
    {
        contract = this.dataContractObject();
    }

    public void postRun()
    {
        super();
    }

}