Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » change Query in datasource at runtime
change Query in datasource at runtime [message #155962] Tue, 25 April 2006 09:42 Go to next message
Eclipse UserFriend
Originally posted by: almasalki.hotmail.com

how I can change my query in the runtime
Re: change Query in datasource at runtime [message #156208 is a reply to message #155962] Tue, 25 April 2006 19:11 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

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
&lt;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
Re: change Query in datasource at runtime [message #156328 is a reply to message #156208] Wed, 26 April 2006 10:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: almasalki.hotmail.com

what is this
Re: change Query in datasource at runtime [message #156332 is a reply to message #156208] Wed, 26 April 2006 10:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: almasalki.hotmail.com

what is this
can you explain
Re: change Query in datasource at runtime [message #156391 is a reply to message #156332] Wed, 26 April 2006 14:11 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

This is a report that modifies the query of the report at runtime based on a
parameter.
If you open the rpt and look at property binding on the Data Set you will
see Query Text is changed based on the parameter.

Jason

"Abo Alnnor" <almasalki@hotmail.com> wrote in message
news:95ea467e0ad7991276c9d7c5365de7b5$1@www.eclipse.org...
> what is this can you explain
>
Previous Topic:How to build birt f2.1?
Next Topic:image dynamic
Goto Forum:
  


Current Time: Sat Nov 09 05:45:45 GMT 2024

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

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

Back to the top