Survey Form: calculations - adding columns

J

Jeff

Hi,

I'm new to InfoPath and was wondering if there is a more simplified
way to add columns. For example, I have a repeating table of survey
questions that has a drop-down box with ratings (0-N/A to 5-Best).
The result would be a "total" field displaying the score and a box for
the "average" (extracting any zeros from the average calculations
since zeros are for N/A).

I could add a function: sum(field1)+(field2)+so on... but this isn't
very flexible if there are a lot data. I placed the ratings field
into a Group hoping that I could just use: sum(ratings), but found out
that you cannot calculate a Group since it doesn't "technically" have
data. How come the program won't let you just add what's inside the
folder/group?

Please advise.
Thank you in advance.

Jeff
 
A

Andrew Watt [MVP - InfoPath]

Hi,

I'm new to InfoPath and was wondering if there is a more simplified
way to add columns. For example, I have a repeating table of survey
questions that has a drop-down box with ratings (0-N/A to 5-Best).
The result would be a "total" field displaying the score and a box for
the "average" (extracting any zeros from the average calculations
since zeros are for N/A).

I could add a function: sum(field1)+(field2)+so on... but this isn't
very flexible if there are a lot data. I placed the ratings field
into a Group hoping that I could just use: sum(ratings), but found out
that you cannot calculate a Group since it doesn't "technically" have
data. How come the program won't let you just add what's inside the
folder/group?

Please advise.
Thank you in advance.

Jeff

Jeff,

I am becoming a little muddled by your description, so will describe a
simple scenario which you can hopefully apply to your own situation.

Assume a repeating table with three columns and you want to sum column
3.

This is one way to do it.

Add an expression box control outside the repeating table.

Click the fx button.

Select the Insert Field or Group button and click on the field (not
the group) for the column.

That will give you something like

my:group1/my:group2/my:field3

Check the edit XPath check box. Edit the XPath as follows:

sum(my:group1/my:group2/my:field3)

The expression box should then contain the sum of the fields in column
3.

Does that help you get to a solution?

Andrew Watt
MVP - InfoPath
 
C

Cate

And is there a way to take this one step further? I have two repeating tables
and have got the sum of column 3 from each table in two expression boxes. But
I need to add the total from each expression field together (basically a
subtotal and a subtotal to get a grand total).

Do I need to find a way to nest the both repeating tables and the subtotal
expression fields inside another table?
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