Hey there,
I am trying to implement a Report queue.
I allready have my Reports (f. e. Invoice), which work well so far. But in case, the "Document Date" is in future, I don't want the Report to be printed.
The Report should be printed (or run), when the Document Date <= TODAY.
What is done so far:
There is a table
In my Report, I do put content in the table, if it shouldn't be printed TODAY.
Here I put in some example data in my new table:
Next I want to loop through my new table like this:
I do need help, because I am not able to fill in the needed data into the Request Form.
For our example (Todays the 06.06.2019) the code should silent-run three reports.
Please do the following:
--> Put in "Document No." (out of table "Document Source")
--> Put in "No. of Copies" in var g_NoOfCopies_Int
--> Put in "Report Delivery" in var g_ReportDelivery_Txt
--> Run Report with Report ID "Report-ID" silent
Repeat with each record in my new table (after filtering)
I just typed in manually for example No. 4
So, after all, I need to know, how to pass Variables and set a Filter to a specific DataItem to a Report (Report by ID) and run it silent.
Someone gotta idea?
Greets
Answers
Your dataitem can be filtered by using a record var.
Add a recordID field to your table and change your code to this:
repeat
TheRecordRef := TheRecordID.GETRECORD (or whatever is needed to do this)
case Report_ID of
'50230':
begin
TheRecordRef.settable(SalesHeader);
SalesHeader.setrecfilter;
reportvarname50230.SETTABLEVIEW(SalesHeader);
reportvarname50230.InitializeRequest(a,b,c);
reportvarname50230.USEREQUESTPAGE(false)
reportvarname50230.runmodal;
end;
'50232':
begin
end;
end;
until l_recordsched....
Needed some time to adjust the code for my needs. If someone also not that experienced (like me) is trying to use this solution, you must not use "reportvarname50230.USEREQUESTPAGE(false)" - you need to use "reportvarname50230.USEREQUESTFORM(false)" (PAGE vs FORM)