Unable to see parameters in report dialog

Hi All,

I have created a report, calling it through controller class. But I am not able to see the parameters in the report dialog.

The classes I created are as follows:

Controller class:

class NMNRdlItemTransListController extends SrsReportRunController
{
}

protected void prePromptModifyContract()
{
Query query;
QueryBuildDataSource qbds;
InventTable inventTable;
NMNRdlItemTransListContract contract;

super();

inventTable = Args ? Args.record() as InventTable : null;

if(inventTable.RecId)
{
query = this.getFirstQuery();
qbds = query.dataSourceTable(tableNum(InventTable));
qbds.addRange(fieldNum(InventTable, ItemId)).value(inventTable.ItemId);
}
}

public static void main(Args args)
{
NMNRdlItemTransListController nmnRdlItemTransListController;

nmnRdlItemTransListController = new NMNRdlItemTransListController();
nmnRdlItemTransListController.parmReportName(ssrsReportStr(NMNRdlItemTransList, ItemTransList));
nmnRdlItemTransListController.parmLoadFromSysLastValue(false);
nmnRdlItemTransListController.parmArgs(args);
nmnRdlItemTransListController.startOperation();
}


Contract class:

[
DataContractAttribute,
SysOperationContractProcessingAttribute(classstr(NMNRdlItemTransListUIBuilder))
]
public class NMNRdlItemTransListContract implements SysOperationValidatable
{
TransDate fromDate;
TransDate toDate;
InventtransferUpdateType status;
TaxRegistrationNumber_IN eccNumber;
}

[
DataMemberAttribute(‘ECCNumber’),
SysOperationLabelAttribute(literalStr(“ECC Number”))
]
public TaxRegistrationNumber_IN parmEccNumber(TaxRegistrationNumber_IN _eccNumber = eccNumber)
{
eccNumber = _eccNumber;
return eccNumber;
}

[
DataMemberAttribute(‘FromDate’),
SysOperationLabelAttribute(literalStr(“FromDate”))
]
public FromDate parmFromDate(FromDate _fromDate = fromDate)
{
fromDate = _fromDate;
return fromDate;
}

[
DataMemberAttribute(‘Status’),
SysOperationLabelAttribute(literalStr(“Status”))
]
public InventTransferUpdateType parmStatus(InventTransferUpdateType _status = status)
{
status = _status;
return status;
}

[
DataMemberAttribute(‘ToDate’),
SysOperationLabelAttribute(literalStr(“ToDate”))
]
public ToDate parmToDate(ToDate _toDate = toDate)
{
toDate = _toDate;
return toDate;
}

public boolean validate()
{
boolean isValid = true;

if (fromDate && toDate && fromDate > toDate)
{
isValid = checkFailed(“From date cannot be greater than to date”);
}

if (!fromDate)
{
isValid = checkFailed(“From date must be filled in”);
}

if (!toDate)
{
isValid = checkFailed("To date must be filled in ");
}

return isValid;
}


UI Builder class:

class NMNRdlItemTransListUIBuilder extends SrsReportDataContractUIBuilder
{
DialogField dialogStatus;
DialogField dialogFromDate;
DialogField dialogToDate;
DialogField dialogEccNumber;
}

public void build()
{
NMNRdlItemTransListContract nmnRdlItemTransListContract;
nmnRdlItemTransListContract = this.dataContractObject() as NMNRdlItemTransListContract;

dialogStatus = this.addDialogField(methodStr(nmnRdlItemTransListContract, parmStatus), nmnRdlItemTransListContract);
dialogFromDate = this.addDialogField(methodStr(nmnRdlItemTransListContract, parmFromDate), nmnRdlItemTransListContract);
dialogToDate = this.addDialogField(methodStr(nmnRdlItemTransListContract, parmToDate), nmnRdlItemTransListContract);
dialogEccNumber = this.addDialogField(methodStr(nmnRdlItemTransListContract, parmEccNumber), nmnRdlItemTransListContract);
}

public void postBuild()
{
NMNRdlItemTransListContract nmnRdlItemTransListContract;
super();

nmnRdlItemTransListContract = this.dataContractObject() as NMNRdlItemTransListContract;

dialogStatus = this.bindInfo().getDialogField(nmnRdlItemTransListContract, methodStr(nmnRdlItemTransListContract, ParmStatus));
dialogFromDate = this.bindInfo().getDialogField(nmnRdlItemTransListContract, methodStr(nmnRdlItemTransListContract, parmFromdate));
dialogToDate = this.bindInfo().getDialogField(nmnRdlItemTransListContract, methodStr(nmnRdlItemTransListContract, parmTodate));
dialogECCNumber = this.bindInfo().getDialogField(nmnRdlItemTransListContract, methodStr(nmnRdlItemTransListContract, ParmEccNumber));
dialogECCNumber.registerOverrideMethod(methodStr(FormStringControl, lookup), staticMethodStr(nmnRdlItemTransListUIBuilder,eccNumberLookup),this);
}

public static void eccNumberLookUp(FormControl _formControl)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(TaxRegistrationNumbers_IN), _formControl);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
queryBuildDataSource = query.addDataSource(tablenum(TaxRegistrationNumbers_IN));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(TaxRegistrationNumbers_IN, TaxType));
queryBuildRange.value(queryValue(TaxType_IN::Excise));
sysTableLookup.addLookupfield(fieldnum(TaxRegistrationNumbers_IN, RegistrationNumber));
sysTableLookup.addLookupfield(fieldnum(TaxRegistrationNumbers_IN, Name));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}

Please help what I am missing.

Best Regards,

Nagesh

Hi Nagesh, please tell us what exactly you mean by “I am not able to see the parameters”. Does it mean that a dialog opens, but it’s completely empty?
Did you verify whether your UI builder class gets called at all?

Try writing below code in main method of your controller class
nmnRdlItemTransListController.parmShowDialog(true);

Hi Martin,

Thanks for quick response. Actually, when the dialog opens, I can see the select button, but I have added certain fields outbound parameters like From date, To date and status, but those are are not appearing in the dialog. Also the UI builder class is not getting called at all. I have pasted the code also in my previous post for reference.

Best Regards,

Nagesh

Hi Lalit,

Thanks for your response. The select button is visible, but I have added some outbound fields and those are not visible in the report dialog. Also the UI builder class is not getting called. Don’t know what I am missing.

Best Regards,

Nagesh

Hi Nagesh,

You have to compile the project, run incremental CIL and then open the project in Visual Studio and see if the parameters are there. If they’re not, refresh the datasets and redeploy the project.

Your UI builder seems to be connected correctly to your data contract, but your code doesn’t show whether your data contract is used by the report. Can you verify it, please?
The fact that you see a query selection button although your data contract doesn’t define any query suggests that the report uses a different contract.

Hi Martin,

Can you please suggest how the UI Builder/Contract class is connected with the the controller class/report. As per the code sample, I found the data contract and UI builder classes connected, but don’t know how these can be associated with report/controller class.

Best Regards,

Nagesh

Where is your report data provider class ?

The controller doesn’t care, it’s not its business. You associate your data contract with your data provider via SRSReportParameterAttribute.

Look at an example in How to: Use a Report Data Provider Class in a Report.

Hi,

I have not created RDP class. What I did is I created a report, calling it using controller class, and wanted additional filter criteria like From date, To date etc… on the report dialog. I have used AX query in the report datasource. For additional filter criteria, I created the UI builder and Contract class.

Best Regards,

Nagesh

So that’s why your parameters aren’t showing. You have to create a report Data Provider class ( SRSReportDataProviderBase )with the attribute [ SRSReportQueryAttribute(queryStr(<thenameofyourquery)) ] for your query and the attribute [ SRSReportParameterAttribute(classStr(NMNRdlItemTransListContract))] to pass your parameters from your contract class.

Hi,

I have a different scenario in my case that I didn’t mention in my earlier posts. There is one report that shows items and their respective transactions. For that, a query say, ItemTransactions, has been created in AX with tables InventTable and InventTrans joined together. The data source type of this report is Query, not Report data provider, and the above query is used in the report dataset. Now I have to modify the report and I need to add additional unbounded filter criteria in the report dialog and I added the additional fields using the Data contract and UI builder classes. Now how can I change the report logic based on the new filter criteria as it is not using the data source type as Report Data Provider. Is there any way to modify the existing report for the changes or do I need to create a new report altogether with data source type as Report data provider.

Use a report data provider class, nevertheless you still can modify your report to use a different data source; your don’t have to create a new report. Nevertheless if it’s a standard report, you should rather create a new report than converting the standard report to something completely different.

Hi,

Well you can change the dataset to a Report Data Prodiver class, and use your query inside it with the attribute SRSReportQueryAttribute. It’s always better to use an RDP class as you have more control on your queries, filtering and joins than using standard queries.