DataColumn.Expression questions

  • Thread starter Jennifer Johnson
  • 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
 
M

Miha Markic

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top