Home » Archived » BIRT » help computed columns question
| help computed columns question [message #36306] |
Wed, 11 May 2005 15:24  |
Eclipse User |
|
|
|
so I'm using the data editor, computed columns
and I'm trying to create a piece of data that
will contain my total of rows for a particular data set column
say I have table with the following columns.
name address phone
I want to count the total of name and assign the count to a variable
that is then added to bottom of report
I have tried the following expression
=Total.count(null,["name"]);
but I get the following error in the preview window
org.eclipse.birt.data.engine.core.DataException occurred
Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
Error Message:Error evaluating script (source:ComputedColumn,
line:0): ReferenceError: "Total" is not defined..
ReferenceError: "Total" is not defined.
hmmm total is a birt object, any ideas how to do this correctly?
it would be cool if the expression could be validated when you enter it.
|
|
| | |
| Re: help computed columns question [message #36700 is a reply to message #36666] |
Thu, 12 May 2005 12:01   |
Eclipse User |
|
|
|
well I traced into the source and since row["name"] is a string type in
my data set, looking at the Birt definition of
Total.count(,) it is Total.count(filter, group)
so in the original case it tries to evaluate this as a filter and this
fails. so what I did was
Total.count("true", 0)
which seems to work, it simply says, use everything (filter is true
always) and use group 0. I'd rather specify a row to count up, but I
can't seem to get it to work I tried Total.count("true", row["name"])
but it errors out as row["name"] really isn't a group.
anyway.... thought I'd throw this up here for communication sake :D
- M
Mike Boyersmith wrote:
> Thanks for the info, I tried this and I get an error
>
> There are errors on the report page:
> Error1:An error is thrown by DataTypeUtil.
>
> If I remove the data element with Total.count(row["name"]) the
> rest of my report renders. not sure whats up, will keep looking around.
>
>
>
> wins wrote:
>
>> BIRT defines three(3) points at which the computed column may be run
>> and one of those is Factory time, w/c I understand you cannot use
>> aggregate function such as 'Total.count' w/c you are trying to do.
>>
>> If you want you can try these steps
>> 1. Insert 'Data' element on the report footer or group footer
>> depending on your needs (report or group level)
>> 2. Double-Click it and in the expression builder type
>> Total.count(row["name"])
>>
>> 3. Click OK
>> 4. Click Preview
>>
>> good luck...
>>
>> wins
>>
>>
>> Mike Boyersmith wrote:
>>
>>> so I'm using the data editor, computed columns
>>> and I'm trying to create a piece of data that
>>> will contain my total of rows for a particular data set column
>>> say I have table with the following columns.
>>
>>
>>
>>> name address phone
>>
>>
>>
>>
>>
>>> I want to count the total of name and assign the count to a variable
>>> that is then added to bottom of report
>>
>>
>>
>>> I have tried the following expression
>>
>>
>>
>>> =Total.count(null,["name"]);
>>
>>
>>
>>
>>> but I get the following error in the preview window
>>
>>
>>
>>> org.eclipse.birt.data.engine.core.DataException occurred
>>> Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
>>> Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
>>> Error Message:Error evaluating script (source:ComputedColumn,
>>> line:0): ReferenceError: "Total" is not defined..
>>> ReferenceError: "Total" is not defined.
>>
>>
>>
>>
>>> hmmm total is a birt object, any ideas how to do this correctly?
>>
>>
>>
>>> it would be cool if the expression could be validated when you enter
>>> it.BIRT
>>
>>
>> defines three(3) points at which the computed column may be run and
>> one of those is Factory time, w/c I understand you cannot use
>> aggregate function such as 'Total.count'
>>
>>
|
|
|
| Re: help computed columns question [message #36734 is a reply to message #36666] |
Thu, 12 May 2005 11:59   |
Eclipse User |
|
|
|
Hi Mike,
If you inserted the data element outside the table then you need to bind
that to the data set as well.
Regards,
Roshan
Mike Boyersmith wrote:
> Thanks for the info, I tried this and I get an error
>
> There are errors on the report page:
> Error1:An error is thrown by DataTypeUtil.
>
> If I remove the data element with Total.count(row["name"]) the
> rest of my report renders. not sure whats up, will keep looking around.
>
>
>
> wins wrote:
>
>> BIRT defines three(3) points at which the computed column may be run
>> and one of those is Factory time, w/c I understand you cannot use
>> aggregate function such as 'Total.count' w/c you are trying to do.
>>
>> If you want you can try these steps
>> 1. Insert 'Data' element on the report footer or group footer
>> depending on your needs (report or group level)
>> 2. Double-Click it and in the expression builder type
>> Total.count(row["name"])
>>
>> 3. Click OK
>> 4. Click Preview
>>
>> good luck...
>>
>> wins
>>
>>
>> Mike Boyersmith wrote:
>>
>>> so I'm using the data editor, computed columns
>>> and I'm trying to create a piece of data that
>>> will contain my total of rows for a particular data set column
>>> say I have table with the following columns.
>>
>>
>>
>>> name address phone
>>
>>
>>
>>
>>
>>> I want to count the total of name and assign the count to a variable
>>> that is then added to bottom of report
>>
>>
>>
>>> I have tried the following expression
>>
>>
>>
>>> =Total.count(null,["name"]);
>>
>>
>>
>>
>>> but I get the following error in the preview window
>>
>>
>>
>>> org.eclipse.birt.data.engine.core.DataException occurred
>>> Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
>>> Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
>>> Error Message:Error evaluating script (source:ComputedColumn,
>>> line:0): ReferenceError: "Total" is not defined..
>>> ReferenceError: "Total" is not defined.
>>
>>
>>
>>
>>> hmmm total is a birt object, any ideas how to do this correctly?
>>
>>
>>
>>> it would be cool if the expression could be validated when you enter
>>> it.BIRT
>>
>>
>> defines three(3) points at which the computed column may be run and
>> one of those is Factory time, w/c I understand you cannot use
>> aggregate function such as 'Total.count'
>>
>>
|
|
| |
| Re: help computed columns question [message #36836 is a reply to message #36436] |
Thu, 12 May 2005 13:50   |
Eclipse User |
|
|
|
Count turns out to be a special aggregate. All other aggregates require a
column:
Total.sum( row.amount )
Total.max( row.height )
But, count just counts rows, no need to specfy an expression:
Total.count( )
All aggregates take optional second and third arguments. The second is a
condition to apply:
Total.max( row.orderTotal, row.custType == "GOV" )
Total.count( row.custType == "GOV" )
(In this case, since Count does not take a column, the condition appears as
the second argument.)
Give this a try & let us know if you encounter further problems.
- Paul
Paul Rogers
BIRT PMC
"wins" <winstonguadiz@yahoo.com> wrote in message
news:7801052f88b197ec3abba2bce070f950$1@www.eclipse.org...
> BIRT defines three(3) points at which the computed column may be run and
> one of those is Factory time, w/c I understand you cannot use aggregate
> function such as 'Total.count' w/c you are trying to do.
>
> If you want you can try these steps
> 1. Insert 'Data' element on the report footer or group footer depending on
> your needs (report or group level)
> 2. Double-Click it and in the expression builder type
> Total.count(row["name"])
>
> 3. Click OK
> 4. Click Preview
>
> good luck...
>
> wins
>
>
> Mike Boyersmith wrote:
>
>> so I'm using the data editor, computed columns
>> and I'm trying to create a piece of data that
>> will contain my total of rows for a particular data set column
>> say I have table with the following columns.
>
>> name address phone
>
>
>
>> I want to count the total of name and assign the count to a variable that
>> is then added to bottom of report
>
>> I have tried the following expression
>
>> =Total.count(null,["name"]);
>
>
>> but I get the following error in the preview window
>
>> org.eclipse.birt.data.engine.core.DataException occurred
>> Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
>> Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
>> Error Message:Error evaluating script (source:ComputedColumn, line:0):
>> ReferenceError: "Total" is not defined..
>> ReferenceError: "Total" is not defined.
>
>
>> hmmm total is a birt object, any ideas how to do this correctly?
>
>> it would be cool if the expression could be validated when you enter
>> it.BIRT
> defines three(3) points at which the computed column may be run and one of
> those is Factory time, w/c I understand you cannot use aggregate function
> such as 'Total.count'
>
>
>
|
|
|
| Re: help computed columns question [message #36938 is a reply to message #36666] |
Thu, 12 May 2005 23:57  |
Eclipse User |
|
|
|
Mike,
Try removing the contents of count: Total.count( ). I think the row.name is
being evaluated as a Boolean filter condition.
- Paul
Paul Rogers
BIRT PMC
"Mike Boyersmith" <mjboyers@us.ibm.com> wrote in message
news:d5vqe6$b2n$1@news.eclipse.org...
> Thanks for the info, I tried this and I get an error
>
> There are errors on the report page:
> Error1:An error is thrown by DataTypeUtil.
>
> If I remove the data element with Total.count(row["name"]) the
> rest of my report renders. not sure whats up, will keep looking around.
>
>
>
> wins wrote:
>> BIRT defines three(3) points at which the computed column may be run and
>> one of those is Factory time, w/c I understand you cannot use aggregate
>> function such as 'Total.count' w/c you are trying to do.
>>
>> If you want you can try these steps
>> 1. Insert 'Data' element on the report footer or group footer depending
>> on your needs (report or group level)
>> 2. Double-Click it and in the expression builder type
>> Total.count(row["name"])
>>
>> 3. Click OK
>> 4. Click Preview
>>
>> good luck...
>>
>> wins
>>
>>
>> Mike Boyersmith wrote:
>>
>>> so I'm using the data editor, computed columns
>>> and I'm trying to create a piece of data that
>>> will contain my total of rows for a particular data set column
>>> say I have table with the following columns.
>>
>>
>>> name address phone
>>
>>
>>
>>
>>> I want to count the total of name and assign the count to a variable
>>> that is then added to bottom of report
>>
>>
>>> I have tried the following expression
>>
>>
>>> =Total.count(null,["name"]);
>>
>>
>>
>>> but I get the following error in the preview window
>>
>>
>>> org.eclipse.birt.data.engine.core.DataException occurred
>>> Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
>>> Error Code:DATA_EXCEPTION_SCRIPT_EVAL_ERROR
>>> Error Message:Error evaluating script (source:ComputedColumn,
>>> line:0): ReferenceError: "Total" is not defined..
>>> ReferenceError: "Total" is not defined.
>>
>>
>>
>>> hmmm total is a birt object, any ideas how to do this correctly?
>>
>>
>>> it would be cool if the expression could be validated when you enter
>>> it.BIRT
>>
>> defines three(3) points at which the computed column may be run and one
>> of those is Factory time, w/c I understand you cannot use aggregate
>> function such as 'Total.count'
|
|
|
Goto Forum:
Current Time: Sat Oct 25 05:42:57 EDT 2025
Powered by FUDForum. Page generated in 0.04971 seconds
|