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
0
Comments
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]
I could not able to understand the point no 3. Can you please explain in detail?
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 filter
One more doubt. How can I get the FromDate and Todate values in OnPreDataItem() from the function in dataport?
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.
Jan
Did a silly mistake in assigning record variables. :roll:
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!