Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
global var set to oracel or sqlserver...
scowsailor
I have some date-centric criteria that needs to work for both oracle and sqlserver. I'm hoping I can figure out what db type I am, set a global variable, and then use different queryText based on the variable in the Property Binding of the data set. I discovered a way to figure out what db type I am during the beforeOpen event of data source...
var db = this.getExtensionProperty("odaURL").substr(10,9);
The odaURL is actually some thing like - jdbc:jtds:sqlserver://... , so the substr gives - sqlserver.
The problem is the timing. I think I need to figure out db type before or during the onPrepare of my table element of the report.
Does anyone know how to get at the odaURL during the onPrepare phase?
Regards,
Bruce
Find more posts tagged with
Comments
scowsailor
I know, I know... it's ORACLE not ORACEL!<br />
<br />
In the beforeOpen event of the dataSet (not the data source) I just tried - <br />
<br />
<span style='color: #4169E1'>var db =this.getDataSource().getExtensionProperty("odaURL").substr(10,9);<br />
<br />
reportContext.setPersistentGlobalVariable("dbType", db);</span><br />
<br />
<br />
This still gives the desired result, but still not at the right time? Here's how I'm using it in the Property Binding of the dataSet - <br />
<br />
<span style='color: #4169E1'>if (reportContext.getPersistentGlobalVariable("dbType") == "sqlserver") {...</span>
scowsailor
I wasn't clear about the problem I'm having. When I add the condition checking for dbType in the Property Binding of the data set, it appears the condition is never true, which makes me believe my global variable is not getting set in time. However, if I add a text element to my table and set the text to my global variable, the variable contains "sqlserver".
scowsailor
After reading through this document:
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php#reportitemexamples
...about a hundred times, I can not understand why a global variable set during the beforeOpen event with apparent success, is not available within the Property Binding of the Data Set. Or, why can't I get to the extension properties directly from the Property Binding itself?