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)
Report Filename in Property Binding
rhunwicks
I want to use Property Binding to get the Connection Profile Store from a path that is relative to the location of the rptdesign file.
All of the the examples I have seen offer solutions for paths relative to the BIRT installation, e.g.
config[ "birt.viewer.working.path" ] + "profilestore.xml"
or
reportContext.getAppContext().get("birt.viewer.res ource.path") ] + "../data/myData.csv"
Please can someone suggest a javascript expression that will get me the location of the rptdesign file, so that I can use that. For example:
reportContext.get("rptdesign.path") ] + "../config/connections.xml"
Is this possible?
Thanks
Roger
Find more posts tagged with
Comments
mwilliams
Roger,
You can get the report design's full name by using the following script:
reportContext.getReportRunnable().getReportName();
It returns "file:/C:/Report_Path/Report_Name.rptdesign, so you'll probably have to take the "file:/" part off with script.
Hope this helps.
rhunwicks
Michael
Thanks for the tip, this was exactly what I needed.
In case it helps anyone else, the exact value I am using in the Property Binding dailog for Connection Profile Store URL is:
reportContext.getReportRunnable().getReportName().substring(5).match( /.*[/]/ ) + "../config/connection.xml"
Our reports are all in a /reports directory and there is a /config directory at the same level that contains the connection.xml file plus all the other configuration data for the non-BIRT part of the application.
This allows us to have multiple environments (dev, tst, prd, etc.) running on the same server with each environment having its own database connection.
We don't need to include specific parameters in the reports for the database connection, and we don't need to modify the rptdesign or rptlibrary files as we promote them from one environment to the next.
Roger