|
Re: change Query in datasource at runtime [message #156208 is a reply to message #155962] |
Tue, 25 April 2006 19:11 |
|
Look at this example.
It modifies the query to add a where clause.
Check the property binding tab on the dataset.
Jason
<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 2.0 -->
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3" id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.0.0 Build
<20060123-1141></property>
<property name="units">in</property>
<list-property name="propertyBindings">
<structure>
<property name="name">queryText</property>
<property name="id">5</property>
<expression name="value">"select * from Orders Where ordernumber =" +
params["qp"];</expression>
</structure>
<structure>
<property name="name">queryTimeOut</property>
<property name="id">5</property>
</structure>
</list-property>
<method name="initialize"><![CDATA[function teststyle(){
this.getStyle().backgroundColor = "Red";
}]]></method>
<list-property name="configVars">
<structure>
<property name="name">qp</property>
<property name="value">10101</property>
</structure>
</list-property>
<parameters>
<scalar-parameter name="qp" id="52">
<property name="valueType">static</property>
<property name="dataType">decimal</property>
<property name="allowBlank">false</property>
<property name="format">Unformatted</property>
<property name="controlType">text-box</property>
<property name="defaultValue">10100</property>
</scalar-parameter>
</parameters>
<data-sources>
<oda-data-source extensionID="org.eclipse.birt.report.data.oda.jdbc"
name="Data Source" id="4">
<property
name="odaDriverClass">org.eclipse.birt.report.data.oda.sampledb.Driver </property>
<property name="odaURL">jdbc:classicmodels:sampledb</property>
<property name="odaUser">ClassicModels</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set" id="5">
<property name="dataSource">Data Source</property>
<property name="queryText">select *
from Orders</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>
<body>
<table id="6">
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<column id="45"/>
<column id="46"/>
<column id="47"/>
<column id="48"/>
<column id="49"/>
<column id="50"/>
<column id="51"/>
<header>
<row id="7">
<cell id="8">
<label id="9">
<text-property name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="10">
<label id="11">
<text-property name="text">ORDERDATE</text-property>
</label>
</cell>
<cell id="12">
<label id="13">
<text-property name="text">REQUIREDDATE</text-property>
</label>
</cell>
<cell id="14">
<label id="15">
<text-property name="text">SHIPPEDDATE</text-property>
</label>
</cell>
<cell id="16">
<label id="17">
<text-property name="text">STATUS</text-property>
</label>
</cell>
<cell id="18">
<label id="19">
<text-property name="text">COMMENTS</text-property>
</label>
</cell>
<cell id="20">
<label id="21">
<text-property name="text">CUSTOMERNUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="22">
<cell id="23">
<data id="24">
<method name="onCreate"><![CDATA[teststyle()]]></method>
<expression name="valueExpr">row["ORDERNUMBER"]</expression>
</data>
</cell>
<cell id="25">
<data id="26">
<expression name="valueExpr">row["ORDERDATE"]</expression>
</data>
</cell>
<cell id="27">
<data id="28">
<expression name="valueExpr">row["REQUIREDDATE"]</expression>
</data>
</cell>
<cell id="29">
<data id="30">
<expression name="valueExpr">row["SHIPPEDDATE"]</expression>
</data>
</cell>
<cell id="31">
<data id="32">
<expression name="valueExpr">row["STATUS"]</expression>
</data>
</cell>
<cell id="33">
<data id="34">
<expression name="valueExpr">row["COMMENTS"]</expression>
</data>
</cell>
<cell id="35">
<data id="36">
<expression name="valueExpr">row["CUSTOMERNUMBER"]</expression>
</data>
</cell>
</row>
</detail>
<footer>
<row id="37">
<cell id="38"/>
<cell id="39"/>
<cell id="40"/>
<cell id="41"/>
<cell id="42"/>
<cell id="43"/>
<cell id="44"/>
</row>
</footer>
</table>
</body>
</report>
"Abo Alnnor" <almasalki@hotmail.com> wrote in message
news:ac0eb920896548d1d41bae31075c94d2$1@www.eclipse.org...
> how I can change my query in the runtime
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03679 seconds