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)
Hide elements based on datasource url
paulk
I'm trying hide some text elements in my report based on the datasource url being used. What statement do I need to get the datasource url in javascript?
Thanks.
Find more posts tagged with
Comments
mwilliams
How are you making your db URL dynamic? By a parameter?
paulk
I'm actually using a scripted datasource.
I have not found a way to send a static text value to a parameter from Maximo without it being displayed to the user for input.
mwilliams
In your scripted dataSource you should have access to the URL then, so in your script, you should be able to set a variable with the information you need from the URL to know whether to hide/show and then recall this variable in the visibility expression for the elements in question. Let me know.
paulk
I am looking for the javascript function to grab the url. Something like dataSource.url or this.url in the open event of the data source but those don't appear to work. The first returns dataSource not defined and the second returns null (and dataSource was the name of source).
The data source appears to be created or defined by a script that reads from a file. The report initialize event calls a function which reads the file.
mwilliams
I'm just guessing, but it seems to me that being able to grab the dataSource URL through script via some BIRT functionality would be limited to the JDBC dataSource because in your scripted dataSource, you're making the connection through script, not through BIRT's JDBC connection. But like I said in my previous post, since you're connecting to the JDBC database using script, you should already have the URL and be able to just place that in a variable for your use wherever you need it. Is there something I'm missing?
paulk
The data source is defined by an external function that reads from a file. I did not create the classes the report uses and I am not sure how all they all fit together to create the working data source.
But, I found a function MXReportScriptContext.getDataSourceInfo(String name) while looking through the .class files that the report uses. The function returns a string with driver, username, password, and url. It should be easy to parse from here.
Thanks for your help.
mwilliams
Great! That's exactly what I assumed you'd be able to grab from your external files. I'm just not a Maximo user, so I don't know the class files.
Good luck! Let us know whenever you have questions!