Repeating Table

T

TomH

I am an InfoPath newbie.

I want to recreate a Word macro as an InfoPath form. I believe I need to
create a repeating table that has 3 columns. The first column should
automatically provide a sequential number, the second column should
automatically provide a total number and the third column, a space for the
user to type in a description. For example,

1 of 2 Box 1 containing correspondence
2 of 2 Box 2 containing photos

Also, in the above example, if the second row is deleted, will the first row
update the total to reflect the change, i.e., 1 of 1 Box 1 containing
correspondence? Thanks in advance for your help and patience.
 
T

TomH

Thanks for the response. I am able to get the first sequential number, but
am still having difficulty getting the total number. I need the second
column to automatically display a total number of rows, for example:

1 of 3
2 of 3
3 of 3

If the second row is deleted, the second column should change to:

1 of 2
2 of 2

Thanks in advance.
 
S

S.Y.M. Wong-A-Ton

You need to use a technique as I've described in one of my solutions (see
http://enterprise-solutions.swits.net/infopath/avg-function-infopath.htm) for
the second part of your scenario.

If you used a normal text box instead of an expression box for the first
field in your repeating table, you should be able to set a rule on it. If you
haven't, change it to a text box. Having done that, add a new text field to
the main node of your form (myFields) and call it "helperField". Then add two
rules to the first field in the repeating table: The first rule should set
the value of "helperField" to an empty string and the second rule should set
the value of "helperField" to any text that's not an empty string, e.g.
"calc". Then add a rule to "helperField" to set the value of the second field
in your repeating table to count(field2), where "field2" is the second field
in your repeating table. That should take care of the total number.
 
T

TomH

The total box works great, but my autogenerated row number no longer works
when the expression box is changed to a text box.
 
S

S.Y.M. Wong-A-Ton

Strange... worked fine when I tried it...

Did you use count(../preceding-sibling::my:Row) + 1 instead of position() as
the Default Value for the first field?
 
T

TomH

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

This worked out great! I had some weirdness happening with my repeating
table. Once I fixed that, your instructions worked perfectly! Thanks, again!
 

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