Dynamics 365 Finance and Operations SSRS 相关参数
Dynamics 365 Finance and Operations SSRS Dependant Parameter
我正在尝试创建一个依赖参数,但很难让它正常工作。一旦我 select 一个项目,然后当我点击估计参数时显示相关估计。如果我更改项目参数,则不会更新估计参数。请参阅下面的代码等。我是 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);
}
}
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();
}
}
我正在尝试创建一个依赖参数,但很难让它正常工作。一旦我 select 一个项目,然后当我点击估计参数时显示相关估计。如果我更改项目参数,则不会更新估计参数。请参阅下面的代码等。我是 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);
}
}
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();
}
}