get the current record of a report

Morgan
Member Posts: 12
Hi everybody,
I run a report from a FORM (based on table A) like that : REPORT.RUN(report_ID,TRUE,FALSE,my_Record_from_table_A);
On the report (also based on table A), i need to get the current record in order to filter a second record based on table B. (1 record form table A is linked to several records from table B... but here isn't the problem)
The report print only 1 page related to my_record_from_table_A
In the present time , it works fine (it print 1 page for record of table A with one field of one record from table
.
But what I want is to let the user choose which record of table B will be use to print.
So i need the current record of table A to filter records from table B with a specific field of the record A, but there is no way to get this record (on the OnPreReport Trigger or another)
I search all the afternoon on the different topics but definitively no appropriated answer. I guest it is not possible but.....
Maybe one of you of a solution
I run a report from a FORM (based on table A) like that : REPORT.RUN(report_ID,TRUE,FALSE,my_Record_from_table_A);
On the report (also based on table A), i need to get the current record in order to filter a second record based on table B. (1 record form table A is linked to several records from table B... but here isn't the problem)
The report print only 1 page related to my_record_from_table_A
In the present time , it works fine (it print 1 page for record of table A with one field of one record from table

But what I want is to let the user choose which record of table B will be use to print.
So i need the current record of table A to filter records from table B with a specific field of the record A, but there is no way to get this record (on the OnPreReport Trigger or another)
I search all the afternoon on the different topics but definitively no appropriated answer. I guest it is not possible but.....
Maybe one of you of a solution
0
Comments
-
Hi,
I could give you some directions...
Make a function it the report with a parameter of type text.
Make a global var like MYFILTER of type text.
In the function give the parameter's value to that global parameter. i.e.SetAFilter(SomeFilter:Text20). BEGIN MYFILTER := SomeFilter; END;
In the OnPreDataItem of table B, place some code like:IF MYFILTER<>'' THEN "table B".SETFILTER("Field A", MYFILTER);
Declare a report variable to your FORM and prior the RUNMODAL call the SetAFilter with the desired value and then call the RUNMODAL.
That way, by declaring functions and calling them, you can pass anything and do alot of tricky stuff.
I hope that helps...0 -
You could also look at the GETFILTER(field), GETFILTERS and GETVIEW to get the filter of the desired field or the entire record.
Use that value somewhere in the OnPreDataItem of "table B".
You could also use the OnPreDataItem of "table B" trigger to filter the B record with a value of a field fro dataitem A, by using"table B".SETFILTER("bField","table A"."aField");
Do I get closer to your target that way? 8-[0 -
Your first solution seems to be OK. nice done
In my case, the report isn't directly called by the form. In fact, the form call codeunit 229 (ducument-print) in which is called the report (but in the codeunit there is no var corresponding to the report, report is called through is ID)
But, of course i also could modify this codeunit to apply your solution...0
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