How do I resolve an Infopath problem in calculating??

L

Lan Hoa Ha

One form includes a repeating table with 3 columes: field 1 at colume 1,
field 2 at colume 2, field 3 at colume 3. When value in field 1 multiplied
with value in field 2 and this result is in field 3, sometimes this result is
not correct.

Ex: field 1 * field 2 = field 3
4500 * 2.49 = 11205.000000000001
4500 * 2.494 = 11223.000000000001
4500 * 3.49 = 15705.000000000001
Can you help me why it is?
Thanks
 
S

S.Y.M. Wong-A-Ton

The data type of your fields is probably set to "Text (string)".

Double-click on each field to open its properties dialog box and select
"Decimal (double)" from the "Data type" dropdown list box on the "Data" tab.
The calculations should then be performed correctly.

S.Y.M. Wong-A-Ton
 
L

Lan Hoa Ha

Thanks a lot for your reply.

However, this issue has nothing to do with the Data type since I have tried
to change all the possible data types listed. It could be best if you
yourself try this calculation in Infopath, you yourself should see it. I
believe there are something wrong with some particular calculations as
follows:

(1) 2.49 * 4500 = 11,205.000000000 and
(2) 2.47 * 4500 = 11,115

(3) 2.49 * 3000 = 7,470.000000000 and
(4) 2.49 * 1000 = 2490

As you see in the (1) calculation, can you please explain me why how come
this could give a result with ".000000000" while the (2) gives no decimal?
Hope you see my point. The same thing happens for the (3) and (4). Please
also be noted these figures: 2.494, 3.49, 2.499, 2.99 also generate result
with nine decimals when multiply with 4500 or 5000 or 7000 or 9000...And they
give no decimal when multiply with 4900, ...??? It must not be because of the
data type of the field, must it ?
Just to give you more background: all the three fields here are formated as:
Data type: Decimal (double)
Decimal format: Number
Decimal places: Auto
Use a digit grouping symbol: checked
.......

Please kindly have a look at this and reply to us at your earliest
convenience.

Many thanks !
 
S

S.Y.M. Wong-A-Ton

Your original post stated that calculations where being performed
incorrectly, as in

4500 * 2.49 = 11205.000000000001

(Note the 1 as the last decimal digit)

This only happens when the data type of your fields is set to "Text
(string)". After you changed the data type to "Decimal (double)" like I
suggested, the precision of the calculation was corrected, as in

2.49 * 4500 = 11,205.000000000

So to state that this has nothing to do with data types is not entirely
correct.

You are currently being challenged by the amount of decimal places which are
inconsistently being shown for certain calculations. I DID check your
calculations and you are right, so this might be a bug in InfoPath.

If you do not want digits to be shown after the decimal point, just change
the "Decimal places" property in the "Decimal Format" dialog box from "Auto"
to 0, or use a "Whole Number (integer)" as the data type.

I'm not sure how you can submit bugs to Microsoft. Perhaps you should repost
your issue as you explained it in your second post and make the comment that
it is a suggestion for Microsoft.

Hope this helps.

S.Y.M. Wong-A-Ton
 
L

Lan Hoa Ha

Thanks a lot. It really helps though.

I did repost the question as "Incorrect results in Infopath calculation -
might be a bug?", please kindly vote for it so that Microsoft will look into
it for a better explaination.

Thanks !
 
S

S.Y.M. Wong-A-Ton

Done!

Lan Hoa Ha said:
Thanks a lot. It really helps though.

I did repost the question as "Incorrect results in Infopath calculation -
might be a bug?", please kindly vote for it so that Microsoft will look into
it for a better explaination.

Thanks !
 

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