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)
Change the source of a datasource programmatically
boj
I have some rptdesign files which work with example files. Now I'm trying to use that rptdesigns but I need to change data sources by code so they point to the correct source file. How can I do this? I write my code below. Thx in advance.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
private static String DESIGN = "./glossary.rptdesign";
public boolean configReportSources() {
ReportDesignHandle design = null;
//Create a design engine configuration object.
DesignConfig dConfig = new DesignConfig( );
DesignEngine dEngine = new DesignEngine( dConfig );
// Create a session handle, using the system locale.
SessionHandle session = dEngine.newSessionHandle( null );
// Create a handle for an existing report design.
try {
design = session.openDesign( DESIGN );
} catch (DesignFileException e) {
this.exceptionCaught( e, "Report " + DESIGN + " not opened!nReason is " + e.toString( ) );
return false;
}
// Find the data source by name
DataSourceHandle dso = design.findDataSource( "Glossary" );
// TODO Change dso source file
dso.???
// Save the design
try {
design.save();
} catch (IOException e) {
this.exceptionCaught( e, "Report " + DESIGN + " not saved!" );
return false;
}
// Close the design
design.close();
return true;
}
</pre>
Find more posts tagged with
Comments
boj
I have seen at [post=37478]Data source Post[/post] an odadatasourcehandle configured with the setProperty method. I suppose what I want to do needs that method. Anyone knows what property I must reference? I'm doing a plugin for a rcp app.
Thx in advance.
boj
Ok, problem solved. I get the right property string at extensions in plugin.xml editor.
titao
Hi boj,
could you write how you did that? Thanks!