Home » Archived » BIRT » beforeOpen on a datasource, scripting, and passing in parameters
beforeOpen on a datasource, scripting, and passing in parameters [message #76353] |
Wed, 21 September 2005 19:19  |
Eclipse User |
|
|
|
I would like to change what my template data source is at report
generation time. So I see that on each of my Data Sources, there is a
beforeOpen() event that allows one to 'tweak' the data source before
report render.
so what I believe I can do is pass in parameters and then on the
beforeOpen Event get the right parameter for the particular data Source.
Note: I may want to pass in 'N' Data source parameters, 1 for each data
source.
Problem is...not sure how to completely do this...any help is appreciated.
|
|
| |
Re: beforeOpen on a datasource, scripting, and passing in parameters [message #76514 is a reply to message #76481] |
Thu, 22 September 2005 11:32   |
Eclipse User |
|
|
|
Tried things similar to that, no luck.
So I tried
//where DS2 is the name of my Data source I am scripting the beforeOpen
//event
ds = report.dataSources.DS2;
ds.publicDriverProperties.userName = "whatever";
also tried
ds = report.dataSources.mydatasource;
just in case I wasn't reading post right...
nadda
I get a javascript error like
There are errors on the report page:Error1:Invalid Javascript
expression. Source: DataSource:DS2.beforeOpen, line: 0,
Expression:function_prefix_1127342608518();function
function_prefix_1127342608518(){ds =
report.dataSources.mydatasource;ds.publicDriverProperties.us erName =
"whatever";}Script engine error: TypeError: Cannot read property
"mydatasource" from null
or
There are errors on the report page:Error1:Invalid Javascript
expression. Source: DataSource:DS2.beforeOpen, line: 0,
Expression:function_prefix_1127342608519();function
function_prefix_1127342608519(){ds =
report.dataSources.DS2;ds.publicDriverProperties.userName =
"whatever";}Script engine error: TypeError: Cannot read property "DS2"
from null
Anyway.....
so I was told that on the beforeOpen event on a datasource element that
I could set a property sourceURL=
but nothing works for me so far.
thanks for the continued help.
Jason Weathersby wrote:
> Mike,
>
> You are suppose to be able to get the datasource like
> ds = report.dataSources.mydatasource;
> ds.publicDriverProperties.userName = "whatever";
> but this doesnt seem to work for me. The publicDriverProperties are the
> ones exposed at the ODA layer.
> I searched Bugzilla, but didnt find an entry on this.
> Let me know if it works for you, otherwise I will log a bug.
>
> Jason Weathersby
> BIRT PMC
>
> "Mike Boyersmith" <mjboyers@us.ibm.com> wrote in message
> news:dgspp7$4ak$1@news.eclipse.org...
>
>>I would like to change what my template data source is at report generation
>>time. So I see that on each of my Data Sources, there is a beforeOpen()
>>event that allows one to 'tweak' the data source before report render.
>>
>>so what I believe I can do is pass in parameters and then on the
>>beforeOpen Event get the right parameter for the particular data Source.
>>
>>Note: I may want to pass in 'N' Data source parameters, 1 for each data
>>source.
>>
>>Problem is...not sure how to completely do this...any help is appreciated.
>>
>>
>>
>>
>>
>>
>>
>
>
>
|
|
| |
Re: beforeOpen on a datasource, scripting, and passing in parameters [message #76592 is a reply to message #76544] |
Thu, 22 September 2005 12:16   |
Eclipse User |
|
|
|
ahhhhh...this does shed some light. I was talking with one of the BIRT
developers who mentioned I could set a "sourceURL" property in the
beforeOpen event. however after reading the FAQ entry I'm sure this
is specific to the ODA driver he was referrring to...thus what I'm
tryinig most likely won't work, as the Datasource ODA driver I'm
currently trying to script to most likely doesn't have a sourceURL
property (or so I think). Thats my theory anyway.... will take this
offline at this point. and post what I find latter on.
Thank you for the faq pointer, it helped.
Jason Weathersby wrote:
> Mike,
> If you look at the faq, under uncategorized, if you put
>
> extensionProperties.odaUser = "sesame";
> extensionProperties.odaPassword = "open";
> extensionProperties.odaURL = "jdbc:my_data_source:....";
> extensionProperties.odaDriverClass = "com.mycompany.jdbc.Driver";
>
> this code in beforeOpen of the datasource, this will work.
>
> These values are defined in the oda.
>
> public static String ODAURL = "odaURL";
> public static String ODAPassword = "odaPassword";
> public static String ODAUser = "odaUser";
> public static String ODADriverClass = "odaDriverClass";
> I am not sure if this is what your were talking about though.
>
> Jason Weathersby
> BIRT PMC
>
> "Mike Boyersmith" <mjboyers@us.ibm.com> wrote in message
> news:dgspp7$4ak$1@news.eclipse.org...
>
>>I would like to change what my template data source is at report generation
>>time. So I see that on each of my Data Sources, there is a beforeOpen()
>>event that allows one to 'tweak' the data source before report render.
>>
>>so what I believe I can do is pass in parameters and then on the
>>beforeOpen Event get the right parameter for the particular data Source.
>>
>>Note: I may want to pass in 'N' Data source parameters, 1 for each data
>>source.
>>
>>Problem is...not sure how to completely do this...any help is appreciated.
>>
>>
>>
>>
>>
>>
>>
>
>
>
|
|
|
Re: beforeOpen on a datasource, scripting, and passing in parameters [message #76608 is a reply to message #76514] |
Thu, 22 September 2005 12:30  |
Eclipse User |
|
|
|
Well... one thing that still stumping me is simply getting the
datasource in javascript so I select the datasource element in the
report designer, I then select beforeOpen event and I write script like
ds = report.dataSources.DS2;
where DS2 is the name of my datasource, this doesn't work for me either,
I get exceptions. but I have no idea what should be following
report.dataSoruces. to get my datasource,
such as .DS2, or getCurrentDataSource() or what.
any ideas?
Mike Boyersmith wrote:
> Tried things similar to that, no luck.
>
> So I tried
>
> //where DS2 is the name of my Data source I am scripting the beforeOpen
> //event
> ds = report.dataSources.DS2;
> ds.publicDriverProperties.userName = "whatever";
>
> also tried
>
> ds = report.dataSources.mydatasource;
>
> just in case I wasn't reading post right...
>
> nadda
>
> I get a javascript error like
>
> There are errors on the report page:Error1:Invalid Javascript
> expression. Source: DataSource:DS2.beforeOpen, line: 0,
> Expression:function_prefix_1127342608518();function
> function_prefix_1127342608518(){ds =
> report.dataSources.mydatasource;ds.publicDriverProperties.us erName =
> "whatever";}Script engine error: TypeError: Cannot read property
> "mydatasource" from null
>
> or
>
> There are errors on the report page:Error1:Invalid Javascript
> expression. Source: DataSource:DS2.beforeOpen, line: 0,
> Expression:function_prefix_1127342608519();function
> function_prefix_1127342608519(){ds =
> report.dataSources.DS2;ds.publicDriverProperties.userName =
> "whatever";}Script engine error: TypeError: Cannot read property "DS2"
> from null
>
> Anyway.....
>
> so I was told that on the beforeOpen event on a datasource element that
> I could set a property sourceURL=
>
> but nothing works for me so far.
>
> thanks for the continued help.
>
>
>
>
> Jason Weathersby wrote:
>
>> Mike,
>>
>> You are suppose to be able to get the datasource like
>> ds = report.dataSources.mydatasource;
>> ds.publicDriverProperties.userName = "whatever";
>> but this doesnt seem to work for me. The publicDriverProperties are the
>> ones exposed at the ODA layer.
>> I searched Bugzilla, but didnt find an entry on this.
>> Let me know if it works for you, otherwise I will log a bug.
>>
>> Jason Weathersby
>> BIRT PMC
>>
>> "Mike Boyersmith" <mjboyers@us.ibm.com> wrote in message
>> news:dgspp7$4ak$1@news.eclipse.org...
>>
>>> I would like to change what my template data source is at report
>>> generation time. So I see that on each of my Data Sources, there is a
>>> beforeOpen() event that allows one to 'tweak' the data source before
>>> report render.
>>>
>>> so what I believe I can do is pass in parameters and then on the
>>> beforeOpen Event get the right parameter for the particular data Source.
>>>
>>> Note: I may want to pass in 'N' Data source parameters, 1 for each
>>> data source.
>>>
>>> Problem is...not sure how to completely do this...any help is
>>> appreciated.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
|
|
|
Goto Forum:
Current Time: Wed Jul 16 15:25:06 EDT 2025
Powered by FUDForum. Page generated in 0.04535 seconds
|