Claculating Percentages in InfoPath 2003 - NaN Erors

P

Pam

Hi!

I am attempting to calculate a percentage off of 2 fields into a third
field. I have defaulted Fields 1 & 2 to zero. Field 3 defaults to:

round(Field 2 / Field 1 * 100)

I am formatting Field 3 as a whole number - the decimal as a percentage
option does not seem to calculate if I use it.

I have a Rule where if Field 1 = 0, then set Field 3 to zero. This works the
first time I publish and open a new form. After that, the form seems to
ignore the rule and produce NaN errors on every one of the calculated fields.
Why? How do I make the rule apply each time? Is there a way to default using
an If/Then type of statement for the default instead?

Thank you!
 
J

Jim R

concat((field1 / field2) * 100, "%")



Pa wrote:

Claculating Percentages in InfoPath 2003 - NaN Erors
19-Jan-09

Hi!

I am attempting to calculate a percentage off of 2 fields into a third
field. I have defaulted Fields 1 & 2 to zero. Field 3 defaults to:

round(Field 2 / Field 1 * 100)

I am formatting Field 3 as a whole number - the decimal as a percentage
option does not seem to calculate if I use it.

I have a Rule where if Field 1 = 0, then set Field 3 to zero. This works the
first time I publish and open a new form. After that, the form seems to
ignore the rule and produce NaN errors on every one of the calculated fields.
Why? How do I make the rule apply each time? Is there a way to default using
an If/Then type of statement for the default instead?

Thank you!
--
Pam

Previous Posts In This Thread:

Claculating Percentages in InfoPath 2003 - NaN Erors
Hi!

I am attempting to calculate a percentage off of 2 fields into a third
field. I have defaulted Fields 1 & 2 to zero. Field 3 defaults to:

round(Field 2 / Field 1 * 100)

I am formatting Field 3 as a whole number - the decimal as a percentage
option does not seem to calculate if I use it.

I have a Rule where if Field 1 = 0, then set Field 3 to zero. This works the
first time I publish and open a new form. After that, the form seems to
ignore the rule and produce NaN errors on every one of the calculated fields.
Why? How do I make the rule apply each time? Is there a way to default using
an If/Then type of statement for the default instead?

Thank you!
--
Pam

Rules are fired when the value of a field changes, so if the field that your
Rules are fired when the value of a field changes, so if the field that your
rule is based on doesn't change, the rule won't fire. If it is an open rule,
it will fire when the form opens.

I use the second method mentioned in this post a lot for conditional default
values:
http://blogs.msdn.com/infopath/archive/2006/11/27/conditional-default-values.aspx


--
Hilary Stoupa
Visit InfoPathDev at http://www.infopathdev.com


Submitted via EggHeadCafe - Software Developer Portal of Choice
Parallel Programming in C# 4.0: A Short Synopsis
http://www.eggheadcafe.com/tutorial...4-b0f20bdc955a/parallel-programming-in-c.aspx
 

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