How to pass parameters from report to dataport?

Aravindh_Navision
Member Posts: 258
Hi Friends,
I have designed 3 dataports: Dataport-A, Dataport-B, Dataport-C and a report: Report-A.
From report, I am running these 3 dataports. My requirement is, I need to give FromDate and ToDate in request form of Report-A. In these data range, I need to extract data through dataports Dataport-A, Dataport-B, Dataport-C.
It is passing the date parameters (FromDate; ToDate) from Report-A to the dataports Dataport-A, Dataport-B, Dataport-C to filter the records. Can anyone tell me how to pass parameters from report (request form) to dataport?
Thanks in advance.
Aarvi
I have designed 3 dataports: Dataport-A, Dataport-B, Dataport-C and a report: Report-A.
From report, I am running these 3 dataports. My requirement is, I need to give FromDate and ToDate in request form of Report-A. In these data range, I need to extract data through dataports Dataport-A, Dataport-B, Dataport-C.
It is passing the date parameters (FromDate; ToDate) from Report-A to the dataports Dataport-A, Dataport-B, Dataport-C to filter the records. Can anyone tell me how to pass parameters from report (request form) to dataport?
Thanks in advance.
Aarvi
0
Comments
-
Hi,
1. Create in each dataport 2 global variables: FromDate , ToDate
2. Create in each dataport a function with two parameters, and assign the values of these parameters to the global variables
3. In the report, before executing the dataport, call the function in that dataport [you need to define a variable of type Dataport to be able to do this]Jan Veenendaal0 -
Thank you Jan for your reply.
I could not able to understand the point no 3. Can you please explain in detail?0 -
Hi,
Let's assume the function you created is called PassDateFilter.
In your report, create a (global) variable for each or the dataports:
variable 1: name=DpA, type=Dataport, Subtype=Dataport-A
variable 2: name=DpB, type=Dataport, Subtype=Dataport-B
variable 3: name=DpC, type=Dataport, Subtype=Dataport-C
In the code where you want to execute the dataports, write:
DpA.PassDateFilter(FromDate,ToDate);
DpA.RUN; // or DpA.EXPORT;
DpB.PassDateFilter(FromDate,ToDate);
DpB.RUN;
DpC.PassDateFilter(FromDate,ToDate);
DpC.RUN;
I hope this helps?
Jan.
P.S.: Of course, regarding my first post, you also need to write code in the dataports to apply the data filterJan Veenendaal0 -
Thanks Jan, It worked..!
One more doubt. How can I get the FromDate and Todate values in OnPreDataItem() from the function in dataport?0 -
1. You created 2 global variables in the dataport, called ToDate and FromDate.
2. You created a function PassdateFilter(FromDatePar, ToDatePar) with a body that should look something like:
BEGIN
FromDate := FromDatePar;
ToDate :=ToDatePar;
END;
3. You can use the variables FromDate and ToDate in any trigger in the dataport. Since you will call the function before running the dataport, the variables should have the value that you entered in the request form of your report.
JanJan Veenendaal0 -
Thanks Jan, It worked perfectly.. :thumbsup:
Did a silly mistake in assigning record variables. :roll:0 -
I have written code with a few :bug: :bug: sometimes, too :shock:Jan Veenendaal0
-
[Topic moved from 'NAV Tips & Tricks' forum to 'NAV/Navision Classic Client' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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