Getting the row count [message #248370] |
Tue, 17 July 2007 10:02  |
Eclipse User |
|
|
|
Originally posted by: andy.nospam.com
I'm using Birt 2.2.
In the Initialize section of the script, I have added
rwcnt = 0;
In the onFetch section of my data set I have
rwcnt += 1;
and then I am using rwcnt in the visibility section to hide or show
different parts of the report if no data is returned.
However when I edit the data set and try to preview the results I get the
following error:
A BIRT exception occurred.
Plug-in Provider:Eclipse.org
Plug-in Name:BIRT Data Engine
Plug-in ID:org.eclipse.birt.data
Version:2.2.0.v200706221
Error Code:data.engine.BirtException
Error Message:A BIRT exception occurred: Error evaluating Javascript
expression. Script engine error: ReferenceError: "rwcnt" is not defined.
(DataSet[PDI].__bm_onFetch#2)
Script source: DataSet[PDI].__bm_onFetch, line: 1, text:
__bm_onFetch(). See next exception for more information.
Error evaluating Javascript expression. Script engine error: ReferenceError:
"rwcnt" is not defined. (DataSet[PDI].__bm_onFetch#2)
Script source: DataSet[PDI].__bm_onFetch, line: 1, text:
__bm_onFetch()
Am I doing this right? It seems to work in thje report itself, but I need to
preview the data. Is there another way of doing this?
Andy
|
|
|
|
Re: Getting the row count [message #248447 is a reply to message #248434] |
Tue, 17 July 2007 12:43   |
Eclipse User |
|
|
|
Originally posted by: andy.nospam.com
Jason,
the report is enclosed.
Andy
"Jason Weathersby" <jasonweathersby@alltel.net> wrote in message
news:f7iqdm$5pm$1@build.eclipse.org...
> Andy,
>
> Putting this in the data set script is probably not what you want, as
> currently the data set may run more than once.
>
> If it is only tied to one report element then this approach is fine.
> Can you post your report?
>
> Jason
>
>
>
> Andy wrote:
>> I'm using Birt 2.2.
>>
>> In the Initialize section of the script, I have added
>> rwcnt = 0;
>>
>> In the onFetch section of my data set I have
>> rwcnt += 1;
>> and then I am using rwcnt in the visibility section to hide or show
>> different parts of the report if no data is returned.
>> However when I edit the data set and try to preview the results I get the
>> following error:
>> A BIRT exception occurred.
>> Plug-in Provider:Eclipse.org
>> Plug-in Name:BIRT Data Engine
>> Plug-in ID:org.eclipse.birt.data
>> Version:2.2.0.v200706221
>> Error Code:data.engine.BirtException
>> Error Message:A BIRT exception occurred: Error evaluating Javascript
>> expression. Script engine error: ReferenceError: "rwcnt" is not defined.
>> (DataSet[PDI].__bm_onFetch#2)
>> Script source: DataSet[PDI].__bm_onFetch, line: 1, text:
>> __bm_onFetch(). See next exception for more information.
>> Error evaluating Javascript expression. Script engine error:
>> ReferenceError:
>> "rwcnt" is not defined. (DataSet[PDI].__bm_onFetch#2)
>> Script source: DataSet[PDI].__bm_onFetch, line: 1, text:
>> __bm_onFetch()
>>
>> Am I doing this right? It seems to work in thje report itself, but I need
>> to
>> preview the data. Is there another way of doing this?
>> Andy
>>
>>
>>
|
|
|
Re: Getting the row count [message #248466 is a reply to message #248447] |
Tue, 17 July 2007 13:50   |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.alltel.net
Andy,
Set the rwcnt=0 in the beforeOpen of the dataset.
Take a look at the attached example.
Jason
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.14"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.2.0.v20070620 Build <2.2.0.v20070626-1003></property>
<property name="units">in</property>
<property name="comments">Copyright (c) 2007 <<Your Company
Name here>></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="ordernumber" id="8">
<property name="valueType">static</property>
<property name="dataType">integer</property>
<property name="controlType">text-box</property>
<property name="defaultValue">10101</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="Data Source"
id="6">
<text-property name="displayName"></text-property>
<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="7">
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="dataType">string</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="dataType">integer</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="dataType">float</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<method name="beforeOpen"><![CDATA[rwcnt = 0;]]></method>
<method name="onFetch"><![CDATA[rwcnt++;]]></method>
<list-property name="parameters">
<structure>
<property name="name">param_1</property>
<property name="paramName">ordernumber</property>
<property name="nativeName"></property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
<property name="position">1</property>
<expression name="defaultValue">10101</expression>
<property name="isOptional">false</property>
<property name="isInput">true</property>
<property name="isOutput">false</property>
</structure>
</list-property>
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">ORDERNUMBER</property>
<property name="nativeName">ORDERNUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">PRODUCTCODE</property>
<property name="nativeName">PRODUCTCODE</property>
<property name="dataType">string</property>
<property name="nativeDataType">12</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">QUANTITYORDERED</property>
<property name="nativeName">QUANTITYORDERED</property>
<property name="dataType">integer</property>
<property name="nativeDataType">4</property>
</structure>
<structure>
<property name="position">4</property>
<property name="name">PRICEEACH</property>
<property name="nativeName">PRICEEACH</property>
<property name="dataType">float</property>
<property name="nativeDataType">8</property>
</structure>
<structure>
<property name="position">5</property>
<property name="name">ORDERLINENUMBER</property>
<property name="nativeName">ORDERLINENUMBER</property>
<property name="dataType">integer</property>
<property name="nativeDataType">5</property>
</structure>
</list-property>
<property name="queryText">select *
from orderdetails
where ordernumber = ?</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:DataSetParameters>
<design:parameterDefinitions>
<design:inOutMode>In</design:inOutMode>
<design:attributes>
<design:name></design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:nullability>Unknown</design:nullability>
<design:uiHints/>
</design:attributes>
<design:inputAttributes>
<design:elementAttributes>
<design:defaultScalarValue>10101</design:defaultScalarValue >
<design:optional>false</design:optional>
<design:masksValue>false</design:masksValue>
<design:uiHints>
<design:promptStyle>TextField</design:promptStyle>
</design:uiHints>
</design:elementAttributes>
</design:inputAttributes>
</design:parameterDefinitions>
</design:DataSetParameters>
<design:ResultSets derivedMetaData="true">
<design:resultSetDefinitions>
<design:resultSetColumns>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERNUMBER</design:name>
<design:position>1</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>ORDERNUMBER</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRODUCTCODE</design:name>
<design:position>2</design:position>
<design:nativeDataTypeCode>12</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>PRODUCTCODE</design:label>
<design:formattingHints>
<design:displaySize>15</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>QUANTITYORDERED</design:name>
<design:position>3</design:position>
<design:nativeDataTypeCode>4</design:nativeDataTypeCode>
<design:precision>10</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>QUANTITYORDERED</design:label>
<design:formattingHints>
<design:displaySize>11</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>PRICEEACH</design:name>
<design:position>4</design:position>
<design:nativeDataTypeCode>8</design:nativeDataTypeCode>
<design:precision>15</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>PRICEEACH</design:label>
<design:formattingHints>
<design:displaySize>22</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
<design:resultColumnDefinitions>
<design:attributes>
<design:name>ORDERLINENUMBER</design:name>
<design:position>5</design:position>
<design:nativeDataTypeCode>5</design:nativeDataTypeCode>
<design:precision>5</design:precision>
<design:scale>0</design:scale>
<design:nullability>Nullable</design:nullability>
</design:attributes>
<design:usageHints>
<design:label>ORDERLINENUMBER</design:label>
<design:formattingHints>
<design:displaySize>6</design:displaySize>
</design:formattingHints>
</design:usageHints>
</design:resultColumnDefinitions>
</design:resultSetColumns>
</design:resultSetDefinitions>
</design:ResultSets>
</model:DesignValues>]]></xml-property>
</oda-data-set>
</data-sets>
<styles>
<style name="crosstab" id="4">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
<style name="crosstab-cell" id="5">
<property name="borderBottomColor">#CCCCCC</property>
<property name="borderBottomStyle">solid</property>
<property name="borderBottomWidth">1pt</property>
<property name="borderLeftColor">#CCCCCC</property>
<property name="borderLeftStyle">solid</property>
<property name="borderLeftWidth">1pt</property>
<property name="borderRightColor">#CCCCCC</property>
<property name="borderRightStyle">solid</property>
<property name="borderRightWidth">1pt</property>
<property name="borderTopColor">#CCCCCC</property>
<property name="borderTopStyle">solid</property>
<property name="borderTopWidth">1pt</property>
</style>
</styles>
<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="9">
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<list-property name="boundDataColumns">
<structure>
<property name="name">ORDERNUMBER</property>
<expression
name="expression">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<expression
name="expression">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<expression
name="expression">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<expression
name="expression">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<expression
name="expression">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
</list-property>
<column id="38"/>
<column id="39"/>
<column id="40"/>
<column id="41"/>
<column id="42"/>
<header>
<row id="10">
<list-property name="visibility">
<structure>
<property name="format">all</property>
<expression name="valueExpr">if( rwcnt == 0 ){
true;
}else{
false;
}</expression>
</structure>
</list-property>
<cell id="11">
<label id="12">
<text-property
name="text">ORDERNUMBER</text-property>
</label>
</cell>
<cell id="13">
<label id="14">
<text-property
name="text">PRODUCTCODE</text-property>
</label>
</cell>
<cell id="15">
<label id="16">
<text-property
name="text">QUANTITYORDERED</text-property>
</label>
</cell>
<cell id="17">
<label id="18">
<text-property
name="text">PRICEEACH</text-property>
</label>
</cell>
<cell id="19">
<label id="20">
<text-property
name="text">ORDERLINENUMBER</text-property>
</label>
</cell>
</row>
</header>
<detail>
<row id="21">
<cell id="22">
<data id="23">
<property
name="resultSetColumn">ORDERNUMBER</property>
</data>
</cell>
<cell id="24">
<data id="25">
<property
name="resultSetColumn">PRODUCTCODE</property>
</data>
</cell>
<cell id="26">
<data id="27">
<property
name="resultSetColumn">QUANTITYORDERED</property>
</data>
</cell>
<cell id="28">
<data id="29">
<property
name="resultSetColumn">PRICEEACH</property>
</data>
</cell>
<cell id="30">
<data id="31">
<property
name="resultSetColumn">ORDERLINENUMBER</property>
</data>
</cell>
</row>
</detail>
<footer>
<row id="32">
<cell id="33"/>
<cell id="34"/>
<cell id="35"/>
<cell id="36"/>
<cell id="37"/>
</row>
</footer>
</table>
<label id="43">
<list-property name="visibility">
<structure>
<property name="format">all</property>
<expression name="valueExpr">if( rwcnt > 0 ){
true;
}else{
false;
}</expression>
</structure>
</list-property>
<text-property name="text">No Rows to Display</text-property>
</label>
<data id="45">
<list-property name="boundDataColumns">
<structure>
<property name="name">Column Binding</property>
<expression name="expression">rwcnt;</expression>
<property name="dataType">any</property>
</structure>
</list-property>
<property name="resultSetColumn">Column Binding</property>
</data>
</body>
</report>
Andy wrote:
> Jason,
>
> the report is enclosed.
>
> Andy
>
>
> "Jason Weathersby" <jasonweathersby@alltel.net> wrote in message
> news:f7iqdm$5pm$1@build.eclipse.org...
>> Andy,
>>
>> Putting this in the data set script is probably not what you want, as
>> currently the data set may run more than once.
>>
>> If it is only tied to one report element then this approach is fine.
>> Can you post your report?
>>
>> Jason
>>
>>
>>
>> Andy wrote:
>>> I'm using Birt 2.2.
>>>
>>> In the Initialize section of the script, I have added
>>> rwcnt = 0;
>>>
>>> In the onFetch section of my data set I have
>>> rwcnt += 1;
>>> and then I am using rwcnt in the visibility section to hide or show
>>> different parts of the report if no data is returned.
>>> However when I edit the data set and try to preview the results I get the
>>> following error:
>>> A BIRT exception occurred.
>>> Plug-in Provider:Eclipse.org
>>> Plug-in Name:BIRT Data Engine
>>> Plug-in ID:org.eclipse.birt.data
>>> Version:2.2.0.v200706221
>>> Error Code:data.engine.BirtException
>>> Error Message:A BIRT exception occurred: Error evaluating Javascript
>>> expression. Script engine error: ReferenceError: "rwcnt" is not defined.
>>> (DataSet[PDI].__bm_onFetch#2)
>>> Script source: DataSet[PDI].__bm_onFetch, line: 1, text:
>>> __bm_onFetch(). See next exception for more information.
>>> Error evaluating Javascript expression. Script engine error:
>>> ReferenceError:
>>> "rwcnt" is not defined. (DataSet[PDI].__bm_onFetch#2)
>>> Script source: DataSet[PDI].__bm_onFetch, line: 1, text:
>>> __bm_onFetch()
>>>
>>> Am I doing this right? It seems to work in thje report itself, but I need
>>> to
>>> preview the data. Is there another way of doing this?
>>> Andy
>>>
>>>
>>>
>
>
|
|
|
Re: Getting the row count [message #248601 is a reply to message #248466] |
Wed, 18 July 2007 08:52  |
Eclipse User |
|
|
|
Originally posted by: andy.nospam.com
That works!
Thanks Jason.
"Jason Weathersby" <jasonweathersby@alltel.net> wrote in message
news:f7ive8$e7q$1@build.eclipse.org...
> Andy,
>
> Set the rwcnt=0 in the beforeOpen of the dataset.
>
> Take a look at the attached example.
>
>
> Jason
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.14"
> id="1">
> <property name="createdBy">Eclipse BIRT Designer Version
> 2.2.0.v20070620 Build <2.2.0.v20070626-1003></property>
> <property name="units">in</property>
> <property name="comments">Copyright (c) 2007 <<Your Company Name
> here>></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="ordernumber" id="8">
> <property name="valueType">static</property>
> <property name="dataType">integer</property>
> <property name="controlType">text-box</property>
> <property name="defaultValue">10101</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="Data Source"
> id="6">
> <text-property name="displayName"></text-property>
> <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="7">
> <structure name="cachedMetaData">
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">ORDERNUMBER</property>
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">PRODUCTCODE</property>
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="position">3</property>
> <property name="name">QUANTITYORDERED</property>
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="position">4</property>
> <property name="name">PRICEEACH</property>
> <property name="dataType">float</property>
> </structure>
> <structure>
> <property name="position">5</property>
> <property name="name">ORDERLINENUMBER</property>
> <property name="dataType">integer</property>
> </structure>
> </list-property>
> </structure>
> <property name="dataSource">Data Source</property>
> <method name="beforeOpen"><![CDATA[rwcnt = 0;]]></method>
> <method name="onFetch"><![CDATA[rwcnt++;]]></method>
> <list-property name="parameters">
> <structure>
> <property name="name">param_1</property>
> <property name="paramName">ordernumber</property>
> <property name="nativeName"></property>
> <property name="dataType">integer</property>
> <property name="nativeDataType">4</property>
> <property name="position">1</property>
> <expression name="defaultValue">10101</expression>
> <property name="isOptional">false</property>
> <property name="isInput">true</property>
> <property name="isOutput">false</property>
> </structure>
> </list-property>
> <list-property name="resultSet">
> <structure>
> <property name="position">1</property>
> <property name="name">ORDERNUMBER</property>
> <property name="nativeName">ORDERNUMBER</property>
> <property name="dataType">integer</property>
> <property name="nativeDataType">4</property>
> </structure>
> <structure>
> <property name="position">2</property>
> <property name="name">PRODUCTCODE</property>
> <property name="nativeName">PRODUCTCODE</property>
> <property name="dataType">string</property>
> <property name="nativeDataType">12</property>
> </structure>
> <structure>
> <property name="position">3</property>
> <property name="name">QUANTITYORDERED</property>
> <property name="nativeName">QUANTITYORDERED</property>
> <property name="dataType">integer</property>
> <property name="nativeDataType">4</property>
> </structure>
> <structure>
> <property name="position">4</property>
> <property name="name">PRICEEACH</property>
> <property name="nativeName">PRICEEACH</property>
> <property name="dataType">float</property>
> <property name="nativeDataType">8</property>
> </structure>
> <structure>
> <property name="position">5</property>
> <property name="name">ORDERLINENUMBER</property>
> <property name="nativeName">ORDERLINENUMBER</property>
> <property name="dataType">integer</property>
> <property name="nativeDataType">5</property>
> </structure>
> </list-property>
> <property name="queryText">select *
> from orderdetails
> where ordernumber = ?</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:DataSetParameters>
> <design:parameterDefinitions>
> <design:inOutMode>In</design:inOutMode>
> <design:attributes>
> <design:name></design:name>
> <design:position>1</design:position>
> <design:nativeDataTypeCode>4</design:nativeDataTypeCode>
> <design:nullability>Unknown</design:nullability>
> <design:uiHints/>
> </design:attributes>
> <design:inputAttributes>
> <design:elementAttributes>
> <design:defaultScalarValue>10101</design:defaultScalarValue >
> <design:optional>false</design:optional>
> <design:masksValue>false</design:masksValue>
> <design:uiHints>
> <design:promptStyle>TextField</design:promptStyle>
> </design:uiHints>
> </design:elementAttributes>
> </design:inputAttributes>
> </design:parameterDefinitions>
> </design:DataSetParameters>
> <design:ResultSets derivedMetaData="true">
> <design:resultSetDefinitions>
> <design:resultSetColumns>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>ORDERNUMBER</design:name>
> <design:position>1</design:position>
> <design:nativeDataTypeCode>4</design:nativeDataTypeCode>
> <design:precision>10</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>ORDERNUMBER</design:label>
> <design:formattingHints>
> <design:displaySize>11</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>PRODUCTCODE</design:name>
> <design:position>2</design:position>
> <design:nativeDataTypeCode>12</design:nativeDataTypeCode>
> <design:precision>15</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>PRODUCTCODE</design:label>
> <design:formattingHints>
> <design:displaySize>15</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>QUANTITYORDERED</design:name>
> <design:position>3</design:position>
> <design:nativeDataTypeCode>4</design:nativeDataTypeCode>
> <design:precision>10</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>QUANTITYORDERED</design:label>
> <design:formattingHints>
> <design:displaySize>11</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>PRICEEACH</design:name>
> <design:position>4</design:position>
> <design:nativeDataTypeCode>8</design:nativeDataTypeCode>
> <design:precision>15</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>PRICEEACH</design:label>
> <design:formattingHints>
> <design:displaySize>22</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> <design:resultColumnDefinitions>
> <design:attributes>
> <design:name>ORDERLINENUMBER</design:name>
> <design:position>5</design:position>
> <design:nativeDataTypeCode>5</design:nativeDataTypeCode>
> <design:precision>5</design:precision>
> <design:scale>0</design:scale>
> <design:nullability>Nullable</design:nullability>
> </design:attributes>
> <design:usageHints>
> <design:label>ORDERLINENUMBER</design:label>
> <design:formattingHints>
> <design:displaySize>6</design:displaySize>
> </design:formattingHints>
> </design:usageHints>
> </design:resultColumnDefinitions>
> </design:resultSetColumns>
> </design:resultSetDefinitions>
> </design:ResultSets>
> </model:DesignValues>]]></xml-property>
> </oda-data-set>
> </data-sets>
> <styles>
> <style name="crosstab" id="4">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> <style name="crosstab-cell" id="5">
> <property name="borderBottomColor">#CCCCCC</property>
> <property name="borderBottomStyle">solid</property>
> <property name="borderBottomWidth">1pt</property>
> <property name="borderLeftColor">#CCCCCC</property>
> <property name="borderLeftStyle">solid</property>
> <property name="borderLeftWidth">1pt</property>
> <property name="borderRightColor">#CCCCCC</property>
> <property name="borderRightStyle">solid</property>
> <property name="borderRightWidth">1pt</property>
> <property name="borderTopColor">#CCCCCC</property>
> <property name="borderTopStyle">solid</property>
> <property name="borderTopWidth">1pt</property>
> </style>
> </styles>
> <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="9">
> <property name="width">100%</property>
> <property name="dataSet">Data Set</property>
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">ORDERNUMBER</property>
> <expression
> name="expression">dataSetRow["ORDERNUMBER"]</expression >
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="name">PRODUCTCODE</property>
> <expression
> name="expression">dataSetRow["PRODUCTCODE"]</expression >
> <property name="dataType">string</property>
> </structure>
> <structure>
> <property name="name">QUANTITYORDERED</property>
> <expression
> name="expression">dataSetRow["QUANTITYORDERED"]</expression >
> <property name="dataType">integer</property>
> </structure>
> <structure>
> <property name="name">PRICEEACH</property>
> <expression
> name="expression">dataSetRow["PRICEEACH"]</expression>
> <property name="dataType">float</property>
> </structure>
> <structure>
> <property name="name">ORDERLINENUMBER</property>
> <expression
> name="expression">dataSetRow["ORDERLINENUMBER"]</expression >
> <property name="dataType">integer</property>
> </structure>
> </list-property>
> <column id="38"/>
> <column id="39"/>
> <column id="40"/>
> <column id="41"/>
> <column id="42"/>
> <header>
> <row id="10">
> <list-property name="visibility">
> <structure>
> <property name="format">all</property>
> <expression name="valueExpr">if( rwcnt == 0 ){
> true;
> }else{
> false;
> }</expression>
> </structure>
> </list-property>
> <cell id="11">
> <label id="12">
> <text-property
> name="text">ORDERNUMBER</text-property>
> </label>
> </cell>
> <cell id="13">
> <label id="14">
> <text-property
> name="text">PRODUCTCODE</text-property>
> </label>
> </cell>
> <cell id="15">
> <label id="16">
> <text-property
> name="text">QUANTITYORDERED</text-property>
> </label>
> </cell>
> <cell id="17">
> <label id="18">
> <text-property
> name="text">PRICEEACH</text-property>
> </label>
> </cell>
> <cell id="19">
> <label id="20">
> <text-property
> name="text">ORDERLINENUMBER</text-property>
> </label>
> </cell>
> </row>
> </header>
> <detail>
> <row id="21">
> <cell id="22">
> <data id="23">
> <property
> name="resultSetColumn">ORDERNUMBER</property>
> </data>
> </cell>
> <cell id="24">
> <data id="25">
> <property
> name="resultSetColumn">PRODUCTCODE</property>
> </data>
> </cell>
> <cell id="26">
> <data id="27">
> <property
> name="resultSetColumn">QUANTITYORDERED</property>
> </data>
> </cell>
> <cell id="28">
> <data id="29">
> <property
> name="resultSetColumn">PRICEEACH</property>
> </data>
> </cell>
> <cell id="30">
> <data id="31">
> <property
> name="resultSetColumn">ORDERLINENUMBER</property>
> </data>
> </cell>
> </row>
> </detail>
> <footer>
> <row id="32">
> <cell id="33"/>
> <cell id="34"/>
> <cell id="35"/>
> <cell id="36"/>
> <cell id="37"/>
> </row>
> </footer>
> </table>
> <label id="43">
> <list-property name="visibility">
> <structure>
> <property name="format">all</property>
> <expression name="valueExpr">if( rwcnt > 0 ){
> true;
> }else{
> false;
> }</expression>
> </structure>
> </list-property>
> <text-property name="text">No Rows to Display</text-property>
> </label>
> <data id="45">
> <list-property name="boundDataColumns">
> <structure>
> <property name="name">Column Binding</property>
> <expression name="expression">rwcnt;</expression>
> <property name="dataType">any</property>
> </structure>
> </list-property>
> <property name="resultSetColumn">Column Binding</property>
> </data>
> </body>
> </report>
>
>
> Andy wrote:
>> Jason,
>>
>> the report is enclosed.
>>
>> Andy
>>
>>
>> "Jason Weathersby" <jasonweathersby@alltel.net> wrote in message
>> news:f7iqdm$5pm$1@build.eclipse.org...
>>> Andy,
>>>
>>> Putting this in the data set script is probably not what you want, as
>>> currently the data set may run more than once.
>>>
>>> If it is only tied to one report element then this approach is fine.
>>> Can you post your report?
>>>
>>> Jason
>>>
>>>
>>>
>>> Andy wrote:
>>>> I'm using Birt 2.2.
>>>>
>>>> In the Initialize section of the script, I have added
>>>> rwcnt = 0;
>>>>
>>>> In the onFetch section of my data set I have
>>>> rwcnt += 1;
>>>> and then I am using rwcnt in the visibility section to hide or show
>>>> different parts of the report if no data is returned.
>>>> However when I edit the data set and try to preview the results I get
>>>> the
>>>> following error:
>>>> A BIRT exception occurred.
>>>> Plug-in Provider:Eclipse.org
>>>> Plug-in Name:BIRT Data Engine
>>>> Plug-in ID:org.eclipse.birt.data
>>>> Version:2.2.0.v200706221
>>>> Error Code:data.engine.BirtException
>>>> Error Message:A BIRT exception occurred: Error evaluating Javascript
>>>> expression. Script engine error: ReferenceError: "rwcnt" is not
>>>> defined.
>>>> (DataSet[PDI].__bm_onFetch#2)
>>>> Script source: DataSet[PDI].__bm_onFetch, line: 1, text:
>>>> __bm_onFetch(). See next exception for more information.
>>>> Error evaluating Javascript expression. Script engine error:
>>>> ReferenceError:
>>>> "rwcnt" is not defined. (DataSet[PDI].__bm_onFetch#2)
>>>> Script source: DataSet[PDI].__bm_onFetch, line: 1, text:
>>>> __bm_onFetch()
>>>>
>>>> Am I doing this right? It seems to work in thje report itself, but I
>>>> need to
>>>> preview the data. Is there another way of doing this?
>>>> Andy
>>>>
>>>>
>>>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.04806 seconds