DataColumn.Expression questions

  • Thread starter Thread starter Jennifer Johnson
  • Start date Start date
J

Jennifer Johnson

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
 
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.
 
Back
Top