Counting rows of repeating table

J

Jono

I have a repeating table that I want the first column to automatically
display the row number it is as you add rows. How do I do that? Thanks.
 
G

Greg Collins [InfoPath MVP]

Add an expression box into the first column with the function: position()
 
C

CW

That's slick.

How come that doesn't work if you use position() as the default value
for a field specifically for that purpose eg: "itemnumber" in the
Infopath sample file Expense Request - Detailed?

CW
 
G

Greg Collins [InfoPath MVP]

It should work for default values -- IF you set it as a formula, and not as text. But if that fails to work, a better expression is:

count(preceding-sibling::my:NodeName) + 1

(I think I have that expression correct--but I didn't verify before posting).
 
C

CW

Ok, now that's wierd. I set it up as default value in function as
position(). I also used your expression box technique beside it. In
preview you see on the first item; 1 and 1 then on the second item line
you see 1 and 2. The first value is the default value of the text box
bound to the item field with default of poistion() in function and the
second value is the position() function in the expression box.

They're supposed to be the same but aren't. That's going to stick in my
claw for some time.

I like the count function too.

CW
 
K

KJL

Is It possible to create "labels" for repeating tables?
such as "F1", "F2" - rather than just a number
 
K

KJL

Sorry about all the posts.
I figured out how to get the expression to work and have the cell bound to a
data source. The expression should read; count(preceding::my:NodeName) + 1

NOW I would like to use those values in another pull down but when I use
"look up values in forms data source" all I get is blank spaces.
 

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