Home » Archived » BIRT » Several table filters : "or" condition
|
Re: Several table filters : "or" condition [message #368628 is a reply to message #368618] |
Tue, 16 June 2009 15:04 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.windstream.net
Loïc,
Not currently, but you should be able to use an expression on one filter
to implement your own or.
if( ( row["QUANTITYORDERED"] > 50 ) || (row["ORDERNUMBER"] == 10101 )){
1;
}else{
0;
}
equals 1
See attached example
Jason
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.17"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.3.2.r232_20090202 Build <2.3.2.v20090218-0730></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
id="7">
<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>
<property name="OdaConnProfileName"></property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set" id="8">
<list-property name="columnHints">
<structure>
<property name="columnName">ORDERNUMBER</property>
<property name="displayName">ORDERNUMBER</property>
</structure>
<structure>
<property name="columnName">PRODUCTCODE</property>
<property name="displayName">PRODUCTCODE</property>
</structure>
<structure>
<property name="columnName">QUANTITYORDERED</property>
<property name="displayName">QUANTITYORDERED</property>
</structure>
<structure>
<property name="columnName">PRICEEACH</property>
<property name="displayName">PRICEEACH</property>
</structure>
<structure>
<property name="columnName">ORDERLINENUMBER</property>
<property name="displayName">ORDERLINENUMBER</property>
</structure>
</list-property>
<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>
<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</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>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:uiHints>
<design:displayName>ORDERNUMBER</design:displayName>
</design:uiHints>
</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:uiHints>
<design:displayName>PRODUCTCODE</design:displayName>
</design:uiHints>
</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:uiHints>
<design:displayName>QUANTITYORDERED</design:displayName>
</design:uiHints>
</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:uiHints>
<design:displayName>PRICEEACH</design:displayName>
</design:uiHints>
</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:uiHints>
<design:displayName>ORDERLINENUMBER</design:displayName>
</design:uiHints>
</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="report" id="4">
<property name="fontFamily">"Verdana"</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab" 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>
<style name="crosstab-cell" id="6">
<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">
<property name="topMargin">0.25in</property>
<property name="leftMargin">0.25in</property>
<property name="bottomMargin">0.25in</property>
<property name="rightMargin">0.25in</property>
<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>
<property name="displayName">ORDERNUMBER</property>
<expression
name="expression">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<property name="displayName">PRODUCTCODE</property>
<expression
name="expression">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<property name="displayName">QUANTITYORDERED</property>
<expression
name="expression">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<property name="displayName">PRICEEACH</property>
<expression
name="expression">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<property name="displayName">ORDERLINENUMBER</property>
<expression
name="expression">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
</list-property>
<list-property name="filter">
<structure>
<property name="operator">eq</property>
<expression name="expr">if( (
row["QUANTITYORDERED"] > 50 ) || (row["ORDERNUMBER"] == 10101 )){
1;
}else{
0;
}</expression>
<simple-property-list name="value1">
<value>1</value>
</simple-property-list>
</structure>
</list-property>
<column id="38"/>
<column id="39"/>
<column id="40"/>
<column id="41"/>
<column id="42"/>
<header>
<row id="10">
<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>
</body>
</report>
Loïc Bertholet wrote:
> Hi all,
>
> When adding several items to a Table Filters, an "and" condition is
> applied between each of them (ie the result is the intersection of each
> filter).
> Is there a way to indicate that an "or" condition should be applied (ie
> the result is the addition of each filter) ?
>
> Thanks,
>
> Loïc
>
|
|
| |
Re: Several table filters : "or" condition [message #368678 is a reply to message #368657] |
Thu, 18 June 2009 16:47 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.windstream.net
Try
BirtComp.like(row["PRODUCTCODE"],'S18%');
equals
true
Jason
Loïc Bertholet wrote:
> Ok thank you Jason.
> Can you tell me where can I find how to use "like" and other operators
> in an expression ?
>
> I've tried :
> if( row["NAME"] like "A%")
> if( row["NAME"] like 'A%')
> if( row["NAME"] like "A*")
> if( row["NAME"] like 'A*')
>
> But nothing works...
>
> Thanks,
>
> Loïc
>
> Jason Weathersby wrote:
>
>> Loïc,
>
>> Not currently, but you should be able to use an expression on one
>> filter to implement your own or.
>
>> if( ( row["QUANTITYORDERED"] > 50 ) || (row["ORDERNUMBER"] == 10101 )){
>> 1;
>> }else{
>> 0;
>> }
>
>> equals 1
>
>
>> See attached example
>
>> Jason
>
>> Loïc Bertholet wrote:
>>> Hi all,
>>>
>>> When adding several items to a Table Filters, an "and" condition is
>>> applied between each of them (ie the result is the intersection of
>>> each filter).
>>> Is there a way to indicate that an "or" condition should be applied
>>> (ie the result is the addition of each filter) ?
>>>
>>> Thanks,
>>>
>>> Loïc
>>>
>
>
|
|
| |
Re: Several table filters : "or" condition [message #368728 is a reply to message #368725] |
Mon, 22 June 2009 15:08 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.windstream.net
What version of BIRT are you using?
Loïc Bertholet wrote:
> Thanks for your answer.
> When rendering in HTML, I have the following error...
> Am I missing sommething ?
>
> + The filter definition using expression "if( BirtComp.like(row["name"],
> "A%") ){
> 1;
> }else{
> 0;
> }" is not valid.
> A BIRT exception occurred: There are errors evaluating script "if(
> BirtComp.like(row["name"], "A%") ){
> 1;
> }else{
> 0;
> }":
> ReferenceError: "BirtComp" is not defined (<inline>#1).. See next
> exception for more information.
> There are errors evaluating script "if( BirtComp.like(row["name"], "A%") ){
> 1;
> }else{
> 0;
> }":
> ReferenceError: "BirtComp" is not defined (<inline>#1).
>
> Thanks.
>
> Jason Weathersby wrote:
>
>> Try
>
>> BirtComp.like(row["PRODUCTCODE"],'S18%');
>
>> equals
>
>> true
>
>> Jason
>
|
|
| |
Re: Several table filters : "or" condition [message #368754 is a reply to message #368733] |
Wed, 24 June 2009 14:12 |
Eclipse User |
|
|
|
Originally posted by: jasonweathersby.windstream.net
Loïc
Try the attached report. BTW what Java version are using?
(specifically IBM, Sun, OpenJdk..)
Jason
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.17"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.3.2.r232_20090202 Build <2.3.2.v20090218-0730></property>
<property name="units">in</property>
<property name="iconFile">/templates/blank_report.gif</property>
<property name="bidiLayoutOrientation">ltr</property>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.jdbc" name="Data Source"
id="7">
<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>
<property name="OdaConnProfileName"></property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set" id="8">
<list-property name="columnHints">
<structure>
<property name="columnName">ORDERNUMBER</property>
<property name="displayName">ORDERNUMBER</property>
</structure>
<structure>
<property name="columnName">PRODUCTCODE</property>
<property name="displayName">PRODUCTCODE</property>
</structure>
<structure>
<property name="columnName">QUANTITYORDERED</property>
<property name="displayName">QUANTITYORDERED</property>
</structure>
<structure>
<property name="columnName">PRICEEACH</property>
<property name="displayName">PRICEEACH</property>
</structure>
<structure>
<property name="columnName">ORDERLINENUMBER</property>
<property name="displayName">ORDERLINENUMBER</property>
</structure>
</list-property>
<list-property name="filter">
<structure>
<property name="operator">like</property>
<expression name="expr">row["ORDERNUMBER"]</expression>
<simple-property-list name="value1">
<value>'101%'</value>
</simple-property-list>
</structure>
</list-property>
<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>
<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</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>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:uiHints>
<design:displayName>ORDERNUMBER</design:displayName>
</design:uiHints>
</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:uiHints>
<design:displayName>PRODUCTCODE</design:displayName>
</design:uiHints>
</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:uiHints>
<design:displayName>QUANTITYORDERED</design:displayName>
</design:uiHints>
</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:uiHints>
<design:displayName>PRICEEACH</design:displayName>
</design:uiHints>
</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:uiHints>
<design:displayName>ORDERLINENUMBER</design:displayName>
</design:uiHints>
</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="report" id="4">
<property name="fontFamily">"Verdana"</property>
<property name="fontSize">10pt</property>
</style>
<style name="crosstab" 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>
<style name="crosstab-cell" id="6">
<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">
<property name="topMargin">0.25in</property>
<property name="leftMargin">0.25in</property>
<property name="bottomMargin">0.25in</property>
<property name="rightMargin">0.25in</property>
<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>
<property name="displayName">ORDERNUMBER</property>
<expression
name="expression">dataSetRow["ORDERNUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRODUCTCODE</property>
<property name="displayName">PRODUCTCODE</property>
<expression
name="expression">dataSetRow["PRODUCTCODE"]</expression >
<property name="dataType">string</property>
</structure>
<structure>
<property name="name">QUANTITYORDERED</property>
<property name="displayName">QUANTITYORDERED</property>
<expression
name="expression">dataSetRow["QUANTITYORDERED"]</expression >
<property name="dataType">integer</property>
</structure>
<structure>
<property name="name">PRICEEACH</property>
<property name="displayName">PRICEEACH</property>
<expression
name="expression">dataSetRow["PRICEEACH"]</expression>
<property name="dataType">float</property>
</structure>
<structure>
<property name="name">ORDERLINENUMBER</property>
<property name="displayName">ORDERLINENUMBER</property>
<expression
name="expression">dataSetRow["ORDERLINENUMBER"]</expression >
<property name="dataType">integer</property>
</structure>
</list-property>
<list-property name="filter">
<structure>
<property name="operator">eq</property>
<expression
name="expr">BirtComp.like(row["PRODUCTCODE"],'S18%');</expression >
<simple-property-list name="value1">
<value>true</value>
</simple-property-list>
</structure>
</list-property>
<column id="38"/>
<column id="39"/>
<column id="40"/>
<column id="41"/>
<column id="42"/>
<header>
<row id="10">
<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>
</body>
</report>
Loïc Bertholet wrote:
> BIRT 2.3.1
>
> Jason Weathersby wrote:
>
>> What version of BIRT are you using?
>
>> Loïc Bertholet wrote:
>>> Thanks for your answer.
>>> When rendering in HTML, I have the following error...
>>> Am I missing sommething ?
>>>
>>> + The filter definition using expression "if(
>>> BirtComp.like(row["name"], "A%") ){
>>> 1;
>>> }else{
>>> 0;
>>> }" is not valid.
>>> A BIRT exception occurred: There are errors evaluating script "if(
>>> BirtComp.like(row["name"], "A%") ){
>>> 1;
>>> }else{
>>> 0;
>>> }":
>>> ReferenceError: "BirtComp" is not defined (<inline>#1).. See next
>>> exception for more information.
>>> There are errors evaluating script "if( BirtComp.like(row["name"],
>>> "A%") ){
>>> 1;
>>> }else{
>>> 0;
>>> }":
>>> ReferenceError: "BirtComp" is not defined (<inline>#1).
>>>
>>> Thanks.
>>>
>>> Jason Weathersby wrote:
>>>
>>>> Try
>>>
>>>> BirtComp.like(row["PRODUCTCODE"],'S18%');
>>>
>>>> equals
>>>
>>>> true
>>>
>>>> Jason
>>>
>
>
|
|
| |
Re: Several table filters : "or" condition [message #890071 is a reply to message #890022] |
Wed, 20 June 2012 21:59 |
|
What are some of your values for quotationPlace and what is its data
type. BTW look at the first table's filter in the attached example.
Jason
On 6/20/2012 11:43 AM, Stephane Turpin wrote:
> To follow this old discussion, I have the same problem as Loic had.
>
> I am trying to add a "Like" filter in an "OR" clause.
> In the report design perspective of Eclipse, in the "Filters" tab of the
> property editor of the table, I added the following filter expression:
>
> BirtComp.like(row["quotationPlace"], "%025%");
>
> then I set the operator to:
> Equal to
>
> and the Value1 to:
> true
>
> The result is a blank report, no row pass through the filter.
>
> I am using Eclipse Indigo and Birt 3.7.0
>
> If someone has the answer, it would be very helpful.
|
|
|
Re: Several table filters : "or" condition [message #890072 is a reply to message #890022] |
Wed, 20 June 2012 21:59 |
|
What are some of your values for quotationPlace and what is its data
type. BTW look at the first table's filter in the attached example.
Jason
On 6/20/2012 11:43 AM, Stephane Turpin wrote:
> To follow this old discussion, I have the same problem as Loic had.
>
> I am trying to add a "Like" filter in an "OR" clause.
> In the report design perspective of Eclipse, in the "Filters" tab of the
> property editor of the table, I added the following filter expression:
>
> BirtComp.like(row["quotationPlace"], "%025%");
>
> then I set the operator to:
> Equal to
>
> and the Value1 to:
> true
>
> The result is a blank report, no row pass through the filter.
>
> I am using Eclipse Indigo and Birt 3.7.0
>
> If someone has the answer, it would be very helpful.
|
|
|
Re: Several table filters : "or" condition [message #890073 is a reply to message #890022] |
Wed, 20 June 2012 21:59 |
|
What are some of your values for quotationPlace and what is its data
type. BTW look at the first table's filter in the attached example.
Jason
On 6/20/2012 11:43 AM, Stephane Turpin wrote:
> To follow this old discussion, I have the same problem as Loic had.
>
> I am trying to add a "Like" filter in an "OR" clause.
> In the report design perspective of Eclipse, in the "Filters" tab of the
> property editor of the table, I added the following filter expression:
>
> BirtComp.like(row["quotationPlace"], "%025%");
>
> then I set the operator to:
> Equal to
>
> and the Value1 to:
> true
>
> The result is a blank report, no row pass through the filter.
>
> I am using Eclipse Indigo and Birt 3.7.0
>
> If someone has the answer, it would be very helpful.
|
|
|
Re: Several table filters : "or" condition [message #890074 is a reply to message #890022] |
Wed, 20 June 2012 21:59 |
|
What are some of your values for quotationPlace and what is its data
type. BTW look at the first table's filter in the attached example.
Jason
On 6/20/2012 11:43 AM, Stephane Turpin wrote:
> To follow this old discussion, I have the same problem as Loic had.
>
> I am trying to add a "Like" filter in an "OR" clause.
> In the report design perspective of Eclipse, in the "Filters" tab of the
> property editor of the table, I added the following filter expression:
>
> BirtComp.like(row["quotationPlace"], "%025%");
>
> then I set the operator to:
> Equal to
>
> and the Value1 to:
> true
>
> The result is a blank report, no row pass through the filter.
>
> I am using Eclipse Indigo and Birt 3.7.0
>
> If someone has the answer, it would be very helpful.
|
|
| |
Re: Several table filters : &quot;or&quot; condition [message #890306 is a reply to message #890113] |
Thu, 21 June 2012 20:26 |
|
Stephane,
This makes sense that all would get filtered out then. In the filter
you are saying if the string contains 025 filter it out. Try setting to
false.
Jason
On 6/21/2012 3:42 AM, Stephane Turpin wrote:
> Thanks for your answer.
>
> The datas I use for my report all have a quotation place of value "025".
>
> Tha data type of quotationPlace is string.
>
> I joined the rptdesign with the filter set if you wish to take a look at it.
>
> Stephane
>
|
|
| |
Re: Several table filters : &amp;quot;or&amp;quot; condition [message #890583 is a reply to message #890451] |
Fri, 22 June 2012 15:47 |
|
You are correct the value should be true. I am not certain why this is
not working for you. In the example I posted a couple messages back, I
filter the first table with virtually the same expression and it works.
Where you able to test that example report?
Jason
On 6/22/2012 6:27 AM, Stephane Turpin wrote:
> So it's working the other way around when we use BirtComp.like ?
>
> If , for example, I just want to filter on quotationPlace = "025", the
> filter will look like:
>
> Expression = row["quotationPlace"]
> Oparator = Equal to
> Value 1 = "025"
>
> and that works well. And you're saying that for BirtComp.like it would be:
>
> Expression = BirtComp.like(row["quotationPlace"], "%025%");
> Oparator = Equal to
> Value 1 = false
>
> ??
>
> Anyway, I tried with a Value1 set to false and it still produces a
> report with no row, only the headers.
>
> It looks like there is a problem with the BIRT function or the javascript.
>
|
|
| |
Re: Several table filters : &amp;amp;quot;or&amp;amp;quot; condition [message #892593 is a reply to message #892434] |
Thu, 28 June 2012 16:12 |
|
Stephane,
Can you try one more thing. Modify your filter expression to something
like:
importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/filterevents.txt", true ) );
out.println( "--"+row["PRODUCTCODE"]);
out.println( "---"+BirtComp.like(row["PRODUCTCODE"], "%S18%"));
out.close();
BirtComp.like(row["PRODUCTCODE"], "%S18%");
Kind of a bad way to debug, but while birt has javascript event handler
debugging, filtering does not.
Jason
On 6/28/2012 4:32 AM, Stephane Turpin wrote:
> Hi,
>
> sorry for the delay.
> I tried your report design and indeed the filter applied on the table
> works.
>
> The only difference I see between you report and mine is the data
> source, but I do not see how it could interfere in the result set.
>
> So, I am still stuck.
> Even if it works in an "AND" clause, we cannot reasonably explain to our
> clients that they can use it in an "AND" but not in an "OR" clause.
>
> So in the mean time, I took off the option of "Like" and "Between" in
> the filter choices of our product.
>
> My last resort is to download BIRT sources and in debugging mode try to
> see why it does not work.
|
|
|
Re: Several table filters : &amp;amp;quot;or&amp;amp;quot; condition [message #892978 is a reply to message #892593] |
Mon, 02 July 2012 08:21 |
Stephane Turpin Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hi Jason,
ok, I tried your debugging code on a simple report design with a column "routingMode" with values in ("Electronique", "Sans routage", "Trade blotter").
If I put this code in the filter expression (Operator still at "Equal to" and value1 at "true):
importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true ) );
out.println( "---" + row["routingMode"] + "---");
out.close();
true
In the filterevents.txt I have:
---Electronique---
---Trade blotter---
---Electronique---
---Electronique---
---Sans routage---
etc...
and my report is complete (normal, I put "true" in the last line of the filter expression)
But if I had to the filter expression a dummy BirtComp.like like this:
importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true ) );
out.println( "---" + row["routingMode"] + "---");
out.println( "---" + BirtComp.like("Electronique", "%ctro%") + "---");
out.close();
true
then the filterevents.txt is created but empty, so is the report.
It seems that something in my environment does not recognize the BirtComp and stop processing the report.
Stephane
|
|
|
Re: Several table filters : &amp;amp;amp;quot;or&amp;amp;amp;quot; condition [message #893151 is a reply to message #892978] |
Mon, 02 July 2012 22:25 |
|
Are you running 3.7.0? Can you try the attached?
Jason
On 7/2/2012 4:21 AM, Stephane Turpin wrote:
> Hi Jason,
>
> ok, I tried your debugging code on a simple report design with a column
> "routingMode" with values in ("Electronique", "Sans routage", "Trade
> blotter").
>
> If I put this code in the filter expression (Operator still at "Equal
> to" and value1 at "true):
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true
> ) );
> out.println( "---" + row["routingMode"] + "---");
> out.close();
> true
>
> In the filterevents.txt I have:
>
> ---Electronique---
> ---Trade blotter---
> ---Electronique---
> ---Electronique---
> ---Sans routage---
> etc...
>
> and my report is complete (normal, I put "true" in the last line of the
> filter expression)
>
> But if I had to the filter expression a dummy BirtComp.like like this:
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true
> ) );
> out.println( "---" + row["routingMode"] + "---");
> out.println( "---" + BirtComp.like("Electronique", "%ctro%") + "---");
> out.close();
> true
>
> then the filterevents.txt is created but empty, so is the report.
>
> It seems that something in my environment does not recognize the
> BirtComp and stop processing the report.
>
> Stephane
|
|
|
Re: Several table filters : &amp;amp;amp;quot;or&amp;amp;amp;quot; condition [message #893152 is a reply to message #892978] |
Mon, 02 July 2012 22:25 |
|
Are you running 3.7.0? Can you try the attached?
Jason
On 7/2/2012 4:21 AM, Stephane Turpin wrote:
> Hi Jason,
>
> ok, I tried your debugging code on a simple report design with a column
> "routingMode" with values in ("Electronique", "Sans routage", "Trade
> blotter").
>
> If I put this code in the filter expression (Operator still at "Equal
> to" and value1 at "true):
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true
> ) );
> out.println( "---" + row["routingMode"] + "---");
> out.close();
> true
>
> In the filterevents.txt I have:
>
> ---Electronique---
> ---Trade blotter---
> ---Electronique---
> ---Electronique---
> ---Sans routage---
> etc...
>
> and my report is complete (normal, I put "true" in the last line of the
> filter expression)
>
> But if I had to the filter expression a dummy BirtComp.like like this:
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true
> ) );
> out.println( "---" + row["routingMode"] + "---");
> out.println( "---" + BirtComp.like("Electronique", "%ctro%") + "---");
> out.close();
> true
>
> then the filterevents.txt is created but empty, so is the report.
>
> It seems that something in my environment does not recognize the
> BirtComp and stop processing the report.
>
> Stephane
|
|
|
Re: Several table filters : &amp;amp;amp;quot;or&amp;amp;amp;quot; condition [message #893153 is a reply to message #892978] |
Mon, 02 July 2012 22:25 |
|
Are you running 3.7.0? Can you try the attached?
Jason
On 7/2/2012 4:21 AM, Stephane Turpin wrote:
> Hi Jason,
>
> ok, I tried your debugging code on a simple report design with a column
> "routingMode" with values in ("Electronique", "Sans routage", "Trade
> blotter").
>
> If I put this code in the filter expression (Operator still at "Equal
> to" and value1 at "true):
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true
> ) );
> out.println( "---" + row["routingMode"] + "---");
> out.close();
> true
>
> In the filterevents.txt I have:
>
> ---Electronique---
> ---Trade blotter---
> ---Electronique---
> ---Electronique---
> ---Sans routage---
> etc...
>
> and my report is complete (normal, I put "true" in the last line of the
> filter expression)
>
> But if I had to the filter expression a dummy BirtComp.like like this:
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true
> ) );
> out.println( "---" + row["routingMode"] + "---");
> out.println( "---" + BirtComp.like("Electronique", "%ctro%") + "---");
> out.close();
> true
>
> then the filterevents.txt is created but empty, so is the report.
>
> It seems that something in my environment does not recognize the
> BirtComp and stop processing the report.
>
> Stephane
|
|
|
Re: Several table filters : &amp;amp;amp;quot;or&amp;amp;amp;quot; condition [message #893155 is a reply to message #892978] |
Mon, 02 July 2012 22:25 |
|
Are you running 3.7.0? Can you try the attached?
Jason
On 7/2/2012 4:21 AM, Stephane Turpin wrote:
> Hi Jason,
>
> ok, I tried your debugging code on a simple report design with a column
> "routingMode" with values in ("Electronique", "Sans routage", "Trade
> blotter").
>
> If I put this code in the filter expression (Operator still at "Equal
> to" and value1 at "true):
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true
> ) );
> out.println( "---" + row["routingMode"] + "---");
> out.close();
> true
>
> In the filterevents.txt I have:
>
> ---Electronique---
> ---Trade blotter---
> ---Electronique---
> ---Electronique---
> ---Sans routage---
> etc...
>
> and my report is complete (normal, I put "true" in the last line of the
> filter expression)
>
> But if I had to the filter expression a dummy BirtComp.like like this:
>
> importPackage( Packages.java.io );
> out = new PrintWriter( new FileWriter( "c:/Temp/filterevents.txt", true
> ) );
> out.println( "---" + row["routingMode"] + "---");
> out.println( "---" + BirtComp.like("Electronique", "%ctro%") + "---");
> out.close();
> true
>
> then the filterevents.txt is created but empty, so is the report.
>
> It seems that something in my environment does not recognize the
> BirtComp and stop processing the report.
>
> Stephane
|
|
| |
Goto Forum:
Current Time: Tue Sep 24 11:15:01 GMT 2024
Powered by FUDForum. Page generated in 0.06624 seconds
|