Avg radio buttons

D

Daktari

I'm new to Infopath. I'm trying to design an employee evaluation using radio
buttons, on a scale of 1-5 and n/a. There are two sections that must be
rated--General Tasks and Specific Tasks, each having about 15 items. I have
each task in a table and I'd like to have each section averaged and then a
TOTAL avg of the two sections.

I used the ApplicantRating template as a model, but created my own from
scratch. I cannot get the AVG formula to work for the tables with radio
buttons. When I look at their ApplicantRating template in design mode, I
don't see any AVG formula used.

Anyone have a clue how to average a table using radio buttons? I have tried
to calculate the average INSIDE the table, but have tried it both inside and
outside of the table. I used AVG1 and AVG1A as the two fields for the avg of
the table. I get a NaN error.

I've also tried using an expression box for the avg of the two sections, but
get a #QNAN error. I also understand if I use expression boxes that I won't
be able to use that calculation for the TOTAL avg section. Is this correct?

Is there any way to create an avg formula using multiple fields or multiple
items?

I have Service Pack 1 and 2 installed and InfoPath 2003.

Any help is appreciated. Thanks.
 
B

Bojana Marjanovic [MSFT]

The problem you are running into is caused by the fact that radio buttons
are linked to text fields, not number fields, by default, so when you try to
run a mathematical operation on them, you're getting a NaN error.

What you can do is go into the properties of each of your radio buttons and
set the data type to whole number. Then you want to specify which value will
get stored when a user selects this button. That is the value that will be
averaged out in the end.

Now you should be able to use the AVG function on the fields that the radio
buttons are bound to without any problems.

Let me know if you need more information,
Bojana
 
D

Daktari

I checked each of my radio button properties. They are set to whole number
integer, the value when selected corresponds to the number in the table's row
1-5. The n/a button is set to whole number integer, blank value, selected by
default.

I can get the answers to the radio buttons to total using SUM (field1) +
(field2), etc. Is there a way to take that answer and divide by a set
number (that wouldn't change) to get an average? The AVG formula won't work.

Thanks for your help. I appreciate your answering so that a "newbie" can
understand.
 
D

Daktari

I'll give this a try. Thanks for giving such clear directions.

I really appreciate your posting this solution.
 
D

Denniso6

This is exactly what I've been trying to do for the past couple of weeks;
without much success I might add. I'm looking to reproduce the option-button
functionality along with an average result, almost exactly as it's presented
in the applcant form.

I'm thinking however that I’m backing myself into a corner by using the
orignal ‘applicant eval’ form for the following reason; as you're no doubt
aware, the fields are locked and can't be changed.

Since I'm going to needing to capture responses (via export to Excel) in
order to generate monthly reporting, this might be difficult if not
impossible.

So, I'm back to the original question: is there a way to derive an average
of all option button responses within a group by using a function or formula
in field ? (rather than relying jscript code as in the orignal applicant eval
form

Thanks in advance your assistance.

DennisO
----------------------
 
D

Daktari

I've followed all 27 steps from your document. Now I'm geting an "only
integers allowed" error message when I click on any radio button.

Again, I checked my radio button properties in the repeating table. Each is
set to whole number integer, with corresponding values of 0-5. The zero was
set as default for the n/a button.

My "Average Rating" field is set decimal double, with 1 decimal place.

I think my problem might be with step #26.

In the rules on the helperfield in first part of #26:
Action: Set a field's value
Field: AvgJobExperience
Value: averageJobExperience = avg(experienceRating)

In the rules on the experience rating second part of #26:
Action: Set a field's value
Field: experienceRating
Value: helperField = " "

Action: Set a field's value
Field: experienceRating
Value: helperField = .

Is this correct?

Thanks so much for any help.
 
S

S.Y.M. Wong-A-Ton

You are looking at the "Action" dialog box, instead of the "Rule" dialog box.
The rules listed in the "recipe" on the website are the results for when you
are viewing the "Rule" dialog box.

So let's try and do it your way... :)
In the rules on the helperfield in first part of #26:
Action: Set a field's value
Field: AvgJobExperience
Value: averageJobExperience = avg(experienceRating)

Try this for the helperfield field when you are in the "Action" dialog box
for its rule:
Action: Set a field's value
Field: AvgJobExperience
Value: avg(experienceRating)
In the rules on the experience rating second part of #26:
Action: Set a field's value
Field: experienceRating
Value: helperField = " "

Try this on the experienceRating field when you are in the "Action" dialog
box for its rule:
Action: Set a field's value
Field: helperField
Value: ""
Action: Set a field's value
Field: experienceRating
Value: helperField = .

Try this for the second action for the rule on experienceRating:
Action: Set a field's value
Field: helperField
Value: .

Now you should be good to go.
 
D

Daktari

I'm jumping up and down!!!
I can't tell you how happy you've made me.
This works perfectly.

Thanks a million times over!
 
D

Daktari

Just a note in case anyone else experiences this problem....
I had to change the value of the n/a column. The directions say to make the
value set to zero (0). If you do that, it "penalizes" the average score by
averaging in a zero value for each n/a chosen.

I made the value blank for the n/a field and this made the average formula
work correctly.

Thanks again for your easy-to-understand directions and your quick response.
 
M

Michael

How do you get it to average all of the rows? I am finding that I can get it
to average for the row that I have in the AVG(..) funciton, but in the
article it only attaches to one row.

What am I missing?

Michael
 
S

S.Y.M. Wong-A-Ton

It is best to retrace all of the steps in the article and make sure that
you've done each correctly.

There are a two things that are important for this solution to work:
1. Using a repeating group to place the option button field in.
2. Not calculating the average from within the option button field in the
repeating group, but use the helperField to do this.

It does not matter that the AVG function is only attached to the first row.
Since the option button field is placed in a repeating group, the formula in
the helperField will calculate the average for the option button field over
all rows in the repeating group.
 
S

shedragon713

Thank you so much. I just started using InfoPath this week and was at a loss
as to how to do all these things. Their documentation is less than
user-friendly--I've been searching for hours... Your solution worked like
magic!!!
Thanks again!

The only problem I'm having is with the description field -- it's coming up
blank. I'll go through those steps again to see what I'm doing wrong.
 
M

mynewliver

I was trying to use the link below but it no longer works. Is there another
way to get to this information?
 
M

mynewliver

Do you know if it is possible to have more than one table on each form? I am
trying to do more than one table (for different sections) but the second
section does not work. The first table worked just fine.
 

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