How do I assign a value to a text field based on values in other f

B

brettopp

I think my question is simple, but being from an Excel background, trying to
convert my Excel way of doing things to InfoPath is messing me up. Here is
what I want to do:

I have a text field named "WWAccountVolume". In this field, I would like to
populate a percentage based on data listed in three other fields ("DealType",
"TotalDealValue", and "WWActVolCheckbox" -- this last field is a True/False
checkbox). There are three arguments total that drive the behavior of field
"WWAccountVolume", as listed below.

Argument #1
IF DealType = "Global Invoicing -- Formal" AND TotalDealValue < 2000000 AND
WWActVolCheckbox = "TRUE" THEN WWAccountVolume = "0%"

Argument #2
IF DealType = "Global Invoicing -- Formal" AND TotalDealValue >= 2000000 AND
TotalDealValue <5000000 AND WWActVolCheckbox = "TRUE" THEN WWAccountVolume =
"2%"

Argument #3
IF DealType = "Global Invoicing -- Formal" AND TotalDealValue >5000000 AND
WWActVolCheckbox = "TRUE" THEN WWAccountVolume = "4%"

I know how to do this in Excel very easily, but I am stumped on how to do it
in InfoPath.
 
S

S.Y.M. Wong-A-Ton

You need to add 3 rules on each of the fields that can change the value of
the "WWAccountVolume" field. These rules must have an Action that sets the
value of the "WWAccountVolume" field to 0% (rule 1), 2% (rule 2), or 4% (rule
3). Once you've created the rules, you can add a Condition on each rule to
simulate your IF....THEN logic for each rule. You may find the following
documentation helpful:

Add a rule:
http://office.microsoft.com/en-us/infopath/HP011002671033.aspx

Set a field's value:
http://office.microsoft.com/en-us/infopath/HP011002661033.aspx
 
S

samuel

This is what I needed. Thanks for the article.

However, I'm using a text box to display a currency amount to send back to
the local database. It displays the box as invalid data.

Is there something I"m missing?
 
S

S.Y.M. Wong-A-Ton

I'm not sure what you're talking about. What data type is the text box set
to? Give an example of the currency you're trying to enter into the text box
and which displays as invalid data. And what is your regional setting for
displaying numbers and currencies on your PC?
 
S

samuel

the field in my access table is data type - number (single)

the field in infopath has binding greyed out. i can format the infopath to
be currency, but the form shows as invalid data, and multiple decimal places.
 
S

S.Y.M. Wong-A-Ton

The field is greyed out, because InfoPath created it for you and it is bound
to the database; you cannot do much about that.

I've tried re-creating your scenario and have had no issues. I used a number
field (single) in my Access table like you did. This was converted to an
optional_float field in InfoPath. I then formatted to a currency (English
(New Zealand) in my case), set my Decimal places to 2, removed the tick from
"Use a digit grouping symbol (,), and entered a currency like 31.90 with no
problem. Submission to the database went smoothly too.

If you use a format, make sure that you're entering data as dictated by that
format, otherwise it will display as invalid data. If your Decimal places is
set to "Auto", you'll get multiple decimal places in your currencies.
InfoPath shows inaccuracies where displaying multiple decimal places is
concerned.

Hope this helps.
 

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