Skip to main content



      Home
Home » Archived » BIRT » Parameter as variable in JDBC data source
Parameter as variable in JDBC data source [message #173346] Mon, 26 June 2006 07:50 Go to next message
Eclipse UserFriend
Hi all,

How can I use parameter as variable in a report?

I’m trying to get the parameter from java
object(Packages.parameter.Test.getApp("param")), but it does not work.

…
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set1" id="45">
<text-property name="displayName">Data Set1</text-property>
<list-property name="parameters">
<structure>
<property name="name">appCparameter</property>
<property name="dataType">string</property>
<property name="nativeDataType">0</property>
<property name="position">1</property>
<expression name="defaultValue">
Packages.parameter.Test.getApp("BOTEE");
</expression>
<property name="isOptional">false</property>
<property name="isInput">true</property>
</structure>
…

It is possible to do that with Script Data Source.
Is it also possible to do that with JDBC Data Source?


Thanks,

Said
Re: Parameter as variable in JDBC data source [message #173592 is a reply to message #173346] Mon, 26 June 2006 19:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danny.rosenberg.weblayers.com

There are two ways you can tackle this problem in the designer. The easiest
is to create report parameters and substitute the right-hand site of the =
with a ?.

This should get you started:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 2.0 -->
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.2"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.1.0.N20060531-1258 Build &lt;20060531-1258></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2006 Actuate
Corporation.</property>
<parameters>
<scalar-parameter name="org_id" id="116">
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="controlType">text-box</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
</parameters>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc"
name="Local HSQL" id="80">
<property name="odaDriverClass">org.hsqldb.jdbcDriver</property>
<property
name="odaURL">jdbc:hsqldb:hsql://localhost:9001</property>
<property name="odaUser">test</property>
<encrypted-property
name="odaPassword">dGVzdA==</encrypted-property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="HSQL from Views" id="81">
<list-property name="parameters">
<structure>
<property name="name">param1</property>
<property name="position">1</property>
<expression
name="defaultValue">params["org_id"]</expression>
<property name="isInput">true</property>
</structure>
</list-property>
<structure name="cachedMetaData"/>
<property name="dataSource">Local HSQL</property>
<property name="queryText">select *
from V_TEST_RESULTS
where ORG_ID = ?</property>
</oda-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage" id="2">
<page-footer>
<text id="3">
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new
Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
</report>


"S.Taaouati" <staaouat@hotmail.com> wrote in message
news:7d47da9121adae7fbe0dd47b8cce5be0$1@www.eclipse.org...
> Hi all,
>
> How can I use parameter as variable in a report?
> I
Re: Parameter as variable in JDBC data source [message #173643 is a reply to message #173592] Tue, 27 June 2006 03:19 Go to previous message
Eclipse UserFriend
The following query is generated.
What I try to do is as follow:
During running (preview) the report included this query the program asked
the user to enter “OOMAPP.PPAPPC”.

…
<property name="queryText">
select
OMAPP.PPAPPC,
OMPDL.DLPDLC,
from OMSRUN.OMPDL, OMSRUN.OMAPP
where
OMPDL.DLAPPC=OMAPP.PPAPPC
and
OOMAPP.PPAPPC=?

</property>
</oda-data-set>
…


The default value of “OOMAPP.PPAPPC” can be determined using the
following code:
…
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set1" id="45">
<text-property name="displayName">Data Set1</text-property>
<list-property name="parameters">
<structure>
<property name="name">appCparameter</property>
<property name="dataType">string</property>
<property name="nativeDataType">0</property>
<property name="position">1</property>
<expression
name="defaultValue">'app'</expression>
<property name="isOptional">false</property>
<property name="isInput">true</property>
</structure>
…

Can I use this default value as variable?
Previous Topic:change result set name in export as csv
Next Topic:method getHttpServletRequest() returns null
Goto Forum:
  


Current Time: Sat Jul 12 19:10:56 EDT 2025

Powered by FUDForum. Page generated in 0.06406 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top