| Changing the &XML Data Source File dynamically [message #652350] |
Thu, 03 February 2011 11:17  |
Mike Wulkan Messages: 132 Registered: July 2009 |
Senior Member |
|
|
I have an XML datasource. In the advanced tab of the datasource's property editor I can see
ODA Data Source
&XML Data Source File
which has the value I specified when I created the datasource.
I would like to be able to set this value from a parameter that I pass in. Ideally I would also like to set the default value of the parameter to what ever the current value is.
I am assuming that the hook should be placed in the "beforeOpen" of the datasource but I don't know the syntax for referencing/setting this field.
|
|
|
|
|
|
|
| Re: Changing the &XML Data Source File dynamically [message #919054 is a reply to message #919043] |
Fri, 21 September 2012 12:37   |
Randy Evered Messages: 16 Registered: July 2012 |
Junior Member |
|
|
Jason,
That will allow me to choose the data source from within Java (if the Data Source already exists)? Sweet! I am not sure if I was clear what I needed or not (LOL sounds too easy).
What is "property"? Do I need to specify another property name, or a generic "property" will work? I am a bit new to properties and parameters. Although I have been reading about parameters.
Thanks for your help!
Randy
[Updated on: Fri, 21 September 2012 12:39] Report message to a moderator
|
|
|
|
| Re: Changing the &XML Data Source File dynamically [message #919338 is a reply to message #919099] |
Fri, 21 September 2012 19:03   |
Randy Evered Messages: 16 Registered: July 2012 |
Junior Member |
|
|
Jason,
Would this work too (on the report side)?
path = reportContext.getAppContext().get( "myParameter" );
this.getDataSource( "Data Source" ).setPrivateDriverProperty( "HOME", path );
If I set myParameter in the appContext in Java, and HOME is the property of the Data Source? They had it in the beforeFactory section.
I am just looking around at DevShare in birt-exchange because I am stuck on EMF ODA queryText problem.
I got it from: http: //www.spudsoft.co.uk/2011/10/lsned43-how-to-have-relative-path-in-a-flat-file-data-source-in-birt/
Thanks,
Randy
[Updated on: Fri, 21 September 2012 19:10] Report message to a moderator
|
|
|
|
|
|
|
|
| Re: Changing the &XML Data Source File dynamically [message #934152 is a reply to message #933173] |
Fri, 05 October 2012 14:02  |
Jason Weathersby Messages: 9167 Registered: July 2009 |
Senior Member |

|
|
What error are you getting? In the beforeFactory add something like the following:
var tst = reportContext.getDesignHandle().findDataSource("ExampleEcore").getProperty("resource");
var path = reportContext.getAppContext().get("dataSource");
importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/debugreport.txt", true ) );
out.println( "Prop " + tst + "-- appcontext value " + path);
out.close();
Jason
Jason Weathersby
BIRT Exchange
|
|
|
Powered by
FUDForum. Page generated in 0.03039 seconds