Skip to main content



      Home
Home » Archived » BIRT » Computed Columns -- how to prevent divide by zero errors
Computed Columns -- how to prevent divide by zero errors [message #153565] Fri, 14 April 2006 10:46 Go to next message
Eclipse UserFriend
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 #153566 is a reply to message #153565] Fri, 14 April 2006 12:30 Go to previous messageGo to next message
Eclipse UserFriend
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!
Re: Computed Columns -- how to prevent divide by zero errors [message #153622 is a reply to message #153566] Fri, 14 April 2006 13:20 Go to previous message
Eclipse UserFriend
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!
>
>
Previous Topic:Property Binding
Next Topic:How to change the interface language
Goto Forum:
  


Current Time: Wed May 21 05:07:34 EDT 2025

Powered by FUDForum. Page generated in 0.03025 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top