Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to pass values for design parameters in.rptdesign file during run time?
BKokilan
I have requirement like, while opening the .rptdesign file, I have to pass run time values for some design parameters in .rptdesign file.
For example while creating .rptdesign file , I have given name of the data source file as "Example.csv", but the name of actual data source file to be used for generating chart will be known only during run time and I have to pass the file name while opening the .rptdesign during reporting generating task.
Is there anyway to pass run time value like this for any such design parameter like chart display name etc.?
May anyone help me out?
Thanks in advance.
BKokilan.
Find more posts tagged with
Comments
jordi
Maybe you can store your file name in the request or session, and then use a Report Event Handler to get this name and populate a Script Data Set.
Check java docs if you can manage file name and path using a Dataset event handler.
Or maybe you can create your dataset on runtime by code. Theres' a sample of changing datasets on runtime in birtworld.blogspot.com
cypherdj
Hiya,<br />
<br />
there are at least 2 practical approaches that I know of that you could take.<br />
<br />
The first one consists in using the report engine's application context to set a config property at runtime like follows:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportEngine.getConfig().getAppContext().put("csvFileName", csvFilename);
</pre>
<br />
this can then be picked up within your report design, by setting the property binding query text expression of your data set like follows:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
reportContext.getAppContext().get("csvFileName")
</pre>
<br />
The second one consists in opening the report design with the design engine, and update the actual filename property on the fly before running the report, or even create the data set. If you're interested in this solution, let me know and I'll post some sample code (might take a day or two, so depends how rushed you are on getting a solution, and how elegant you want the solution to be ;-))<br />
<br />
Regards,<br />
Cedric
BKokilan
Hi Cedric
Thanks for your reply.
Please post the sample code for the second solution.
Thanks in advance
BKokilan.
cypherdj
Here's some sample code that should do what you're after.
note that I extracted the exact query text directly from the report design, but am replacing the filename at runtime. As long as your generate csv file contains the expected columns with the appropriate data types, this code should run the report design, and simply change the filename.
Sorry it took a bit of time, busy weekend!
Let me know if this is what you were looking for,
Regards,
Cedric