I am trying to do some math on LaborDtl.LaborHrs and compare it to the LaborHed.PayHours in a customization and it is often off by .01
After digging I see that the field value is .41667 but when I use the following iteration:
foreach(DataRowView row in myEDV.dataView)
{
MessageBox.Show(row[“LaborDtl.LaborHrs”].ToString());
}
…it reports .42
What is the easiest way around this? I tried converting the value to double as well as setting extended properties but it still comes through as .042000 rounding up.
The string of the field value is going to round it but the math should be performed on the datatype of that field. Are you just asking why the string is a rounded version?
That field is already a decimal, you are doing a .ToString() on it and thus turning it into a string. When you do math do math directly on the field. As @Aaron_Moreng suggested.
Ugh, found it…sorry. I was iterating through a dashboard view and the BAQ itself was formatting to a >>9.99 on the LaborHrs field and I was iterating through that thinking I was drawing it from an adapter dataset field.
Sorry for the confusion and thank you for the assistance.