Hi Enggar,
I faced it a year back and there was no proper solution for it. You will not find an easy answer for this one.
If there was just one or two parameters you could've passed them on to controller class easily from where you could pass them on to contract class in the prePromtModify method like you're already doing.
One way is to create the same fields as needed in parameters in the datasource of your form which will make it easy for you and you will be able to pass the parameters same as the AsOnDate parameter. (Not recommended).
Solution:
The workaround I had to develop for achieving this is a bit complex but it works. What you can do is concatenate all the parameters in a string and pass that string as a parameter to the report controller. Then in the prePromptModifyContract method you can tokenize/break the string, get your parameters and assign them to your contract class.
Here,
Override the click method of the button which runs your report and add code like this.
void clicked()
{
Args args = new Args();
str parameterString;
;
args.record(FCardTable);
args.caller(this);
// add parameters to a single string
parameterString += strfmt("%1,%2,%3,%4",fromDate.valueStr(),toDate.valueStr(),site.valueStr(),warehouse.valueStr());
args.parm(parameterString); //change the fields as per your own code
//Assuming you have created these fields just on the form and auto declaration for them is set to "yes".
new MenuFunction(menuItemOutputStr(yourReportControllerMenuItemName), MenuItemType::Output).run(args);
}
Now in the controller class of your report do something like this.
protected void prePromptModifyContract()
{
args xArgs;
container conParm;
TransDate fromDate, toDate;
str siteID, wareHouse;
super();
xArgs = this.parmArgs();
conParm = str2Con(this.parmArgs().parm()); //this will give you parameters from the string we created
fromDate = str2Date( conpeek(conParm,1), 213);
//second parameter is the date sequence fro day month year, you can change it per your requirement
//1 = day, 2= month, 3 =year
toDate = str2Date( conpeek(conParm,2), 213);
siteID = conpeek(conParm,3);
wareHouse= conpeek(conParm,4);
contract = this.parmReportContract().parmRdpContract();
contract.parmasondate(Args.record().(fieldNum(FCardTable, AsOnDate)));
contract.parmfromdate(fromDate);
contract.parmfromdate(toDate);
contract.parmfromdate(siteID);
contract.parmfromdate(wareHouse);
}
Please try this and let me know if you have any issues.
Mark the answer verified if this solves your problem.