I'm trying to utilize the DataColumn.Expression property and am stuck on 2
issues.

1) I am running into rounding problems on decimal fields. If I have
col3.Expression = col1 / col2, col3 seems to truncate the value instead of
rounding (12.888 showing as 12.88 instead of 12.89). Is there a way to
force the field to round?

2) I have a calculation col4.Expression = ((col5 - col6) / col6) * 100 which
is returning an error message "Attempting to divide by 0". Col6 is a
calculated field that has a valid value. I tried changing the Expression to
Iif(col6=0,0,((col5 - col6) / col6) * 100) but I'm still getting the divide
by 0 error. Can I not use a calculated field to populated another
calculated field?

Thanks

Re: DataColumn.Expression questions by Miha

Miha
Fri Dec 05 15:47:55 CST 2003

Hi Jennifer,

I would strongly recommend against expressions.
Rather, calculate it yourself and put data in.
In 2) I guess the column is being calculated before col6.

--
Miha Markic - RightHand .NET consulting & development
miha at rthand com

"Jennifer Johnson" <jajohnson@epicor.com> wrote in message
news:e2l3Gj3uDHA.1888@TK2MSFTNGP10.phx.gbl...
> I'm trying to utilize the DataColumn.Expression property and am stuck on 2
> issues.
>
> 1) I am running into rounding problems on decimal fields. If I have
> col3.Expression = col1 / col2, col3 seems to truncate the value instead of
> rounding (12.888 showing as 12.88 instead of 12.89). Is there a way to
> force the field to round?
>
> 2) I have a calculation col4.Expression = ((col5 - col6) / col6) * 100
which
> is returning an error message "Attempting to divide by 0". Col6 is a
> calculated field that has a valid value. I tried changing the Expression
to
> Iif(col6=0,0,((col5 - col6) / col6) * 100) but I'm still getting the
divide
> by 0 error. Can I not use a calculated field to populated another
> calculated field?
>
> Thanks
>
>