我正在尝试创建一个依赖参数,但正在努力让它正常工作。一旦我选择了一个项目,然后当我单击估计参数以显示相关估计值时。如果我更改项目参数,则它不会更新估计参数。请参阅下面的代码等。我对 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);
}
}