Announcements
I am using AX 2012 and have developed a report using the class and have use the contract class for customer parameter like 'From Date' and 'To Date'.
Now I want to initialize the 'From Date' with some date like 01\07\2013 how I can do this. My class code is as follow.
//class declaration
[DataContractAttribute]
public class CustomerBalancesQryContract
{
FromDate StartDate;
ToDate ToDate;
boolean WithoutOpening ;
//AccountName accountName;implements SysOperationValidatable
//
#define.parameterStartDate('StartDate')
#define.parameterToDate('ToDate')
}
// function declaration
[DataMemberAttribute("ToDate"),
SysOperationLabelAttribute(literalStr("@SYS14656"))
]
public TransDate parmToDate(TransDate _ToDate = ToDate)
{
ToDate = _ToDate;
return ToDate;
}
I'm glad this solution worked for you.
Just to clarify: The setValue() method is a method of class SrsReportRdlDataContract and therefore can only be called if you extend that class.
When using SrsReportRdlDataContract your parameters are not stored in global variables of your contract class but in objects of class SRSReportParameter, so you have to call setValue() in order to change those objects.
Thanks Dinnes
For your help, yes I am using these parameter for RDP class and I have change the definition of class with the following
public class CustomerBalancesQryContract implements SysOperationInitializable
The following code was not working for current scenario
this.setValue('StartDate', 01/07/2013);
So I have use following code in initialize method and it is working. As parmStartDate is the member of contract class.
this.parmStartDate(01\07\2013);
When using a contract that extends SrsReportRdlDataContract use the method setValue() of this super class.
In your case it would look like this:
this.setValue('StartDate', 01/07/2013);
this.setValue('WithoutOpening', true);
Note that the string you pass into the method is the parameter's name as specified in the report itself.
By the way, you seem to use these parameters in your report data provider class. In this case you might not want to extend class SrsReportRdlDataContract, because you usually use this class for parameters that are only created in the report object itself.
The class in your original post looks like an RDP contract class from which report parameters are created automatically when refreshing the report's datasets.
Please refer to following TechNet article for further information on the difference between RDL and RDP contracts: technet.microsoft.com/.../dn249829.aspx
Thanks Dennis
Can you please give me some example to assign value to parameter, I have use the following code after implementing the SysOperationInitializable but its not working
public void initialize()
{
StartDate=01\07\2013;
WithoutOpening=true ;
}
while class declaration is as under
public class CustomerBalancesQryContract extends SrsReportRdlDataContract implements SysOperationInitializable
in case of using in combination with reports extend the
SRSReportRunController
example SalesQuotationConfirmationController
Hello,
you can change your contract's class declaration to implement the interface SysOperationInitializable.
Then add your initialization logic to the initialize() method.
The SSRS report framework in AX will then call this method after instanicating your contract class.
Best Regards
Dennis
P.S.: The same logic works for the interface SysOperationValidatable and method validate().
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,142 Super User 2024 Season 2
Martin Dráb 227,979 Super User 2024 Season 2
nmaenpaa 101,148