Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344079 - Aggregation value is null when no line returned in the dataSet
Summary: Aggregation value is null when no line returned in the dataSet
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 2.5.2   Edit
Assignee: Birt-Data-inbox@eclipse.org CLA
QA Contact: Xiaoying Gu CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-28 03:25 EDT by Anne Racine CLA
Modified: 2011-09-15 10:11 EDT (History)
3 users (show)

See Also:


Attachments
dataset using sampledb (34.06 KB, application/octet-stream)
2011-04-29 03:18 EDT, Xiaoying Gu CLA
no flags Details
Report file with aggregation (35.33 KB, application/octet-stream)
2011-05-02 03:53 EDT, Anne Racine CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anne Racine CLA 2011-04-28 03:25:10 EDT
Build Identifier: 20100617-1415

When using COUNT aggregation with Birt 2.5.1, if no line in the dataSet, 
the value equals 0. With Birt 2.5.2, value is null. 

Example : 
  DataSet : "Select code from customer"
  Data Aggregation : Count (expression = row["code"])
  If table customer empty, 
     value = 0.0 with Birt 2.5.1
     value = null with Birt 2.5.2





Reproducible: Always

Steps to Reproduce:
1.Create a dataSet on an empty table. 
2.Create an aggregation with function COUNT. 
3.Display the data aggregation.
Comment 1 Xiaoying Gu CLA 2011-04-29 03:12:54 EDT
I can not reproduce this issue with 2.5.2 release.
Please fine the attached sample report and preview. The aggregation on last line show 0 when previewing.
Comment 2 Xiaoying Gu CLA 2011-04-29 03:18:36 EDT
Created attachment 194333 [details]
dataset using sampledb
Comment 3 Anne Racine CLA 2011-05-02 03:53:15 EDT
Created attachment 194462 [details]
Report file with aggregation
Comment 4 Anne Racine CLA 2011-05-02 03:53:54 EDT
I don't reproduce it either in preview mode, only when running in the application, after deployment.
Comment 5 Xiaoying Gu CLA 2011-05-02 22:03:06 EDT
(In reply to comment #4)
> I don't reproduce it either in preview mode, only when running in the
> application, after deployment.

Were you using the WebViewerExample birt runtime for deployment? And which application server do you deploy the birt on?
Comment 6 Anne Racine CLA 2011-05-03 02:27:08 EDT
Thanks for your investigation, sorry for my imprecision...
The application server is JBoss 4.2.2.
Comment 7 Xiaoying Gu CLA 2011-05-04 05:33:23 EDT
(In reply to comment #6)
> Thanks for your investigation, sorry for my imprecision...
> The application server is JBoss 4.2.2.

I can not open your report design with 2.5.2 all-in-one release build.
Could please create the report design again?

BTW, can you reproduce this issue with my report which is using the sample database?
Comment 8 Anne Racine CLA 2011-05-04 06:09:32 EDT
Thanks to you report file, I found out the difference between our reports.

The difference is that I created the aggregation directly from the cell, using the "Aggregation" item from the context menu. 
This creates the data directly in the cell (no need to create another data and do the binding).
And it works, unless there is no data in the data set !

Does it mean that I should add a data in all my reports ? 

Thanks for your help.

Initial mine contained : 
              <structure>
                    <property name="name">user_count</property>
                    <property name="dataType">integer</property>
                    <property name="aggregateFunction">COUNT</property>
                    <list-property name="arguments">
                        <structure>
                            <property name="name">Expression</property>
                            <expression name="value" type="javascript">row["user_code"]</expression>
                        </structure>
                    </list-property>
                </structure>



New mine, with 0 displayed, contains : 
               <structure>
                    <property name="name">Aggregation</property>
                    <property name="dataType">integer</property>
                    <property name="aggregateFunction">COUNT</property>
                    <list-property name="arguments">
                        <structure>
                            <property name="name">Expression</property>
                            <expression name="value" type="javascript">row["user_code"]</expression>
                        </structure>
                    </list-property>
                </structure>
                <structure>
                    <property name="name">user_count</property>
                    <expression name="expression" type="javascript">row["Aggregation"]</expression>
                    <property name="dataType">integer</property>
                </structure>
Comment 9 meltie CLA 2011-09-15 10:11:36 EDT
(In reply to comment #8)
> The difference is that I created the aggregation directly from the cell, using
> the "Aggregation" item from the context menu. 
> This creates the data directly in the cell (no need to create another data and
> do the binding).
> And it works, unless there is no data in the data set !
> 
> Does it mean that I should add a data in all my reports ? 
> 
> Thanks for your help.

I have the same problem. If I add the aggregation directly to the cell or if I add the aggregation as a computed column, nothing is displayed if the result is 0. If I add a data to the cell and add the aggregation this way, the 0 is displayed. Adding a data is a workaround for this, but rather inconvenient in large reports using a lot of aggregations.