Computed Columns -- how to prevent divide by zero errors [message #153565] |
Fri, 14 April 2006 10:46  |
Eclipse User |
|
|
|
Originally posted by: morangatang.xxxxxxxxxxxxxxxxx.com
I'm loving BIRT and I have found a *lot* of great information in this
newsgroup, however this week I have been struggling with computed
columns and divide by zero errors.
Let's say I have columns a, b, c, and d.
I want to display a column equal to (a-b)/(c-d)
(c-d) is occasionally equal to zero, exposing me to divide-by-zero
errors at runtime.
I created computed columns called e = (a-b) and f = (c-d)
I have attempted a bunch of times to create a computed column called g
that conditionally calculates (e / f) if f != 0 but I'm getting killed
with all kinds of errors -- javascript formatting, ; missing before , etc.
Here are some of the ways I tried to make computed column g so far:
(row["f"] = 0) ? 0 : row["e"]/row["f"]
<VALUE-OF>(row["f"] = 0) ? 0 : row["e"]/row["f"]</VALUE-OF>
if row["f"] = 0
0;
else
row["e"]/row["f"];
Am I missing something simple here? Should I abandon computed columns
and do this another way?
I'm using the Callisto M5 build
SDK Version: 3.2.0
Build id: I20060223-1656
BIRT 2.1.0.M20060303-0920
Anybody who helps is goin' on my Xmas list!
|
|
|
|
Re: Computed Columns -- how to prevent divide by zero errors [message #153622 is a reply to message #153566] |
Fri, 14 April 2006 13:20  |
Eclipse User |
|
|
|
Originally posted by: morangatang.xxxxxxxxxxxxxxxxx.com
Outstanding!
Der Spunk rules.
morangatang
Der Spunk wrote:
> Try:
> if (row["f"]==0) {0} else {row["f"]/row["e"]}
>
>
> "morangatang" <morangatang@xxxxxxxxxxxxxxxxx.com> schrieb im Newsbeitrag
> news:e1ocn7$b91$1@utils.eclipse.org...
>> I'm loving BIRT and I have found a *lot* of great information in this
>> newsgroup, however this week I have been struggling with computed columns
>> and divide by zero errors.
>>
>> Let's say I have columns a, b, c, and d.
>>
>> I want to display a column equal to (a-b)/(c-d)
>>
>> (c-d) is occasionally equal to zero, exposing me to divide-by-zero errors
>> at runtime.
>>
>> I created computed columns called e = (a-b) and f = (c-d)
>>
>> I have attempted a bunch of times to create a computed column called g
>> that conditionally calculates (e / f) if f != 0 but I'm getting killed
>> with all kinds of errors -- javascript formatting, ; missing before , etc.
>>
>> Here are some of the ways I tried to make computed column g so far:
>>
>>
>> (row["f"] = 0) ? 0 : row["e"]/row["f"]
>>
>>
>> <VALUE-OF>(row["f"] = 0) ? 0 : row["e"]/row["f"]</VALUE-OF>
>>
>>
>> if row["f"] = 0
>> 0;
>> else
>> row["e"]/row["f"];
>>
>>
>> Am I missing something simple here? Should I abandon computed columns and
>> do this another way?
>>
>> I'm using the Callisto M5 build
>> SDK Version: 3.2.0
>> Build id: I20060223-1656
>> BIRT 2.1.0.M20060303-0920
>>
>> Anybody who helps is goin' on my Xmas list!
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03025 seconds