NAV 5.0 | Report queue

DasChamaeleon
Member Posts: 4
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
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
0
Best Answer
-
You should declare the report a a variable, and use init function to pass variables.
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....
5
Answers
-
You should declare the report a a variable, and use init function to pass variables.
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....
5 -
YEAH! Your solution still brilliant!
Thank you very much!!
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)
0 -
True, had to leave something for your own imagination1
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions