Skip to main content



      Home
Home » Archived » BIRT » dynamic parameter name
dynamic parameter name [message #258451] Tue, 16 October 2007 08:39 Go to next message
Eclipse UserFriend
Originally posted by: rwojtowicz.dfqs.pl

Hello,
In my report I have Dynamis parameter, which gets values from SQL:

SELECT id, name
FROM MyTable

and I use 'id' as value and 'name' as display name. Now I want to use this
display name in my report. How can I do this?

Thanks,
Re: dynamic parameter name [message #258464 is a reply to message #258451] Tue, 16 October 2007 09:51 Go to previous messageGo to next message
Eclipse UserFriend
Hi Rafal,
if I well understood your question, you should create a report parameter.
In "List of value" choose "Dynamic" then choose your existing dataset
from the combo and give value to "Value column" (it's the value your
parameter is going to be assigned) and "Display text" (it's what you see
in the combo.

If you need to display more info you can append them.
Example:

dataSetRow["aaa"] + ' ' + dataSetRow["bbb"] + ....... and so on

Bye
nico

Rafal Wojtowicz ha scritto:
> Hello,
> In my report I have Dynamis parameter, which gets values from SQL:
>
> SELECT id, name
> FROM MyTable
>
> and I use 'id' as value and 'name' as display name. Now I want to use
> this display name in my report. How can I do this?
>
> Thanks,
>
Re: dynamic parameter name [message #258705 is a reply to message #258464] Thu, 18 October 2007 10:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rwojtowicz.dfqs.pl

Hi Nikolaus,
Well, I don't think you understood my question :-)
I've got all this working just like you said. For example:

When displaying my finished report, I picked a parameter from parameter
window. I picked it from the listbox, chose the name of the City, but I
really chose the hidden City's ID. Now I've got report with values
regarding this City. But how can I get a city name in the header of my
report without querying the database again?
When i use dynamic text element with parameter["city"], i Get city's ID,
but still don't have the name

Nikolaus wrote:

> Hi Rafal,
> if I well understood your question, you should create a report parameter.
> In "List of value" choose "Dynamic" then choose your existing dataset
> from the combo and give value to "Value column" (it's the value your
> parameter is going to be assigned) and "Display text" (it's what you see
> in the combo.

> If you need to display more info you can append them.
> Example:

> dataSetRow["aaa"] + ' ' + dataSetRow["bbb"] + ....... and so on

> Bye
> nico

> Rafal Wojtowicz ha scritto:
>> Hello,
>> In my report I have Dynamis parameter, which gets values from SQL:
>>
>> SELECT id, name
>> FROM MyTable
>>
>> and I use 'id' as value and 'name' as display name. Now I want to use
>> this display name in my report. How can I do this?
>>
>> Thanks,
>>
Re: dynamic parameter name [message #258961 is a reply to message #258464] Mon, 22 October 2007 06:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rwojtowicz.dfqs.pl

Nikolaus wrote:

> Hi Rafal,
> if I well understood your question, you should create a report parameter.
> In "List of value" choose "Dynamic" then choose your existing dataset
> from the combo and give value to "Value column" (it's the value your
> parameter is going to be assigned) and "Display text" (it's what you see
> in the combo.

That's exactly want I want to achieve: to see this picked "Display text"
in my report, not just in the parameter window.
Anyone?
Re: dynamic parameter name [message #259110 is a reply to message #258961] Tue, 23 October 2007 11:57 Go to previous messageGo to next message
Eclipse UserFriend
Rafal,

If you want to display a parameter in a Data Control, you should be able
to do that with the expression builder. The expression will look like:

params["paramToDisplay"]

Here is a report that takes a parameter and displays it in the report.

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.15"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.2.1.r221_v20070924
Build &lt;2.2.0.v20070924-1550></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2007 Innovent Solutions, Inc.</property>
<html-property name="description">Creates a blank report with no predefined
content.</html-property>
<text-property name="displayName">Blank Report</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<parameters>
<scalar-parameter name="paramToDisplay" id="7">
<property name="valueType">static</property>
<property name="dataType">string</property>
<property name="paramType">simple</property>
<text-property name="promptText">What do you want to display</text-property>
<property name="controlType">text-box</property>
<property name="defaultValue">This is the default text</property>
<property name="distinct">true</property>
<structure name="format">
<property name="category">Unformatted</property>
</structure>
</scalar-parameter>
</parameters>
<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>
<data id="8">
<list-property name="boundDataColumns">
<structure>
<property name="name">Column Binding</property>
<expression name="expression">params["paramToDisplay"]</expression>
<property name="dataType">any</property>
</structure>
</list-property>
<property name="resultSetColumn">Column Binding</property>
</data>
</body>
</report>


> Nikolaus wrote:
>
>> Hi Rafal,
>> if I well understood your question, you should create a report
>> parameter.
>> In "List of value" choose "Dynamic" then choose your existing dataset
>> from the combo and give value to "Value column" (it's the value your
>> parameter is going to be assigned) and "Display text" (it's what you
>> see
>> in the combo.
> That's exactly want I want to achieve: to see this picked "Display
> text" in my report, not just in the parameter window. Anyone?
>
Re: dynamic parameter name [message #259265 is a reply to message #259110] Wed, 24 October 2007 07:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rwojtowicz.dfqs.pl

Scott,
thanks for your answer. But I mean something other than just displaying
the parameter's value:
1. My Parameter is DYNAMIC (from dataset, one column has the id as value
and second has name as 'display name' into parameter window)
2. I want to show in my report the "display name", not the "value column"



Scott Rosenbaum wrote:

> Rafal,

> If you want to display a parameter in a Data Control, you should be able
> to do that with the expression builder. The expression will look like:

> params["paramToDisplay"]

> Here is a report that takes a parameter and displays it in the report.

> <?xml version="1.0" encoding="UTF-8"?>
> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.15"
> id="1">
> <property name="createdBy">Eclipse BIRT Designer Version
2.2.1.r221_v20070924
> Build &lt;2.2.0.v20070924-1550></property>
> <property name="units">in</property>
> <property name="comments">Copyright (c) 2007 Innovent Solutions,
Inc.</property>
> <html-property name="description">Creates a blank report with no
predefined
> content.</html-property>
> <text-property name="displayName">Blank Report</text-property>
> <property name="iconFile">/templates/blank_report.gif</property>
> <parameters>
> <scalar-parameter name="paramToDisplay" id="7">
> <property name="valueType">static</property>
> <property name="dataType">string</property>
> <property name="paramType">simple</property>
> <text-property name="promptText">What do you want to
display</text-property>
> <property name="controlType">text-box</property>
> <property name="defaultValue">This is the default text</property>
> <property name="distinct">true</property>
> <structure name="format">
> <property name="category">Unformatted</property>
> </structure>
> </scalar-parameter>
> </parameters>
> <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>
> <data id="8">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">Column Binding</property>
> <expression
name="expression">params["paramToDisplay"]</expression>
> <property name="dataType">any</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">Column Binding</property>
> </data>
> </body>
> </report>


>> Nikolaus wrote:
>>
>>> Hi Rafal,
>>> if I well understood your question, you should create a report
>>> parameter.
>>> In "List of value" choose "Dynamic" then choose your existing dataset
>>> from the combo and give value to "Value column" (it's the value your
>>> parameter is going to be assigned) and "Display text" (it's what you
>>> see
>>> in the combo.
>> That's exactly want I want to achieve: to see this picked "Display
>> text" in my report, not just in the parameter window. Anyone?
>>
Re: dynamic parameter name [message #259331 is a reply to message #259265] Wed, 24 October 2007 12:20 Go to previous messageGo to next message
Eclipse UserFriend
Rafal,

Sorry for the misunderstanding. I have reworked and re-attached the report.
The expression is:

reportContext.getParameterDisplayText("paramToDisplay")

Scott Rosenbaum

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.15"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version 2.2.1.r221_v20070924
Build &lt;2.2.0.v20070924-1550></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2007 Innovent Solutions, Inc.</property>
<html-property name="description">Creates a blank report with no predefined
content.</html-property>
<text-property name="displayName">Blank Report</text-property>
<property name="iconFile">/templates/blank_report.gif</property>
<parameters>
<scalar-parameter name="paramToDisplay" id="7">
<property name="valueType">dynamic</property>
<property name="dataType">string</property>
<property name="paramType">simple</property>
<text-property name="promptText">Pick Office</text-property>
<property name="controlType">list-box</property>
<property name="dataSetName">setOffices</property>
<expression name="valueExpr">dataSetRow["OFFICECODE"]</expression>
<expression name="labelExpr">dataSetRow["CITY"]</expression>
<property name="mustMatch">true</property>
<property name="fixedOrder">false</property>
<property name="defaultValue">1</property>
<property name="distinct">true</property>
<property name="sortBy">value</property>
<property name="sortDirection">asc</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="srcClassic" id="31">
<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="setOffices" id="32">
<list-property name="columnHints">
<structure>
<property name="columnName">OFFICECODE</property>
<property name="displayName">OFFICECODE</property>
</structure>
<structure>
<property name="columnName">CITY</property>
<property name="displayName">CITY</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">OFFICECODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CITY</property>
<property name="dataType">string</property>
</structure>
</list-property>
</structure>
<property name="dataSource">srcClassic</property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">OFFICECODE</property>
<property name="nativeName">OFFICECODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">CITY</property>
<property name="nativeName">CITY</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
</list-property>
<property name="queryText">select OFFICECODE, city
from offices</property>
<xml-property name="designerValues"><![CDATA[<?xml version="1.0"
encoding="UTF-8"?>
<model:DesignValues xmlns:design="http://www.eclipse.org/datatools/connectivity/oda/design"
xmlns:model="http://www.eclipse.org/birt/report/model/adapter/odaModel">
<Version>1.0</Version>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>OFFICECODE</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>OFFICECODE</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>OFFICECODE</design:label>
<design:formattingHints>
<design:displaySize>10</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>CITY</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>50</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
<design:uiHints>
<design:displayName>CITY</design:displayName>
</design:uiHints>
</design:attributes>
<design:usageHints>
<design:label>CITY</design:label>
<design:formattingHints>
<design:displaySize>50</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-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="19">
<property name="width">100%</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">bindParameterValue</property>
<expression name="expression">params["paramToDisplay"]</expression>
<property name="dataType">any</property>
</structure>
<structure>
<property name="name">paramBindDisplayName</property>
<expression name="expression">reportContext.getParameterDisplayText("paramToDisplay ")</expression>
<property name="dataType">any</property>
</structure>
</list-property>
<column id="26"/>
<detail>
<row id="22">
<cell id="23">
<data id="29">
<property name="resultSetColumn">bindParameterValue</property>
</data>
</cell>
</row>
<row id="27">
<cell id="28">
<data id="30">
<property name="resultSetColumn">paramBindDisplayName</property>
</data>
</cell>
</row>
</detail>
</table>
</body>
</report>
Re: dynamic parameter name [message #259397 is a reply to message #259331] Thu, 25 October 2007 02:41 Go to previous message
Eclipse UserFriend
Originally posted by: rwojtowicz.dfqs.pl

Thank you very much, finally I've got it working :)

Scott Rosenbaum wrote:

> Rafal,

> Sorry for the misunderstanding. I have reworked and re-attached the report.
> The expression is:

> reportContext.getParameterDisplayText("paramToDisplay")

> Scott Rosenbaum
Previous Topic:Problems with WebViewer
Next Topic:BIRT Viewer problem
Goto Forum:
  


Current Time: Wed May 07 01:06:08 EDT 2025

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

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

Back to the top