Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / March 2006

Tip: Looking for answers? Try searching our database.

automatically number items in repeating table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Janie - 28 Feb 2006 16:25 GMT
I have a repeating table and would like the first column (I'm calling Item
No.) to automatically fill in with numbers in the order the items are entered.
Greg Collins [InfoPath MVP] - 28 Feb 2006 21:07 GMT
If you are storing the number, set the default value formula to: position()

If you are not storing the number, use an expression box with the same formula: position()

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

I have a repeating table and would like the first column (I'm calling Item
No.) to automatically fill in with numbers in the order the items are entered.
Janie - 28 Feb 2006 21:36 GMT
Greg, that worked for the first item.  But then when I click "insert item,"
the number still comes up as the number 1, instead of the next number (in
this case 2).  

> If you are storing the number, set the default value formula to: position()
>
> If you are not storing the number, use an expression box with the same formula: position()
>
> I have a repeating table and would like the first column (I'm calling Item
> No.) to automatically fill in with numbers in the order the items are entered.
Philip Colmer - 01 Mar 2006 16:08 GMT
Try this:

count(preceding-sibling::item) + 1

You will probably need to change "item" to the name of the parent node of
the repeating row.

--Philip

> Greg, that worked for the first item.  But then when I click "insert
> item,"
[quoted text clipped - 11 lines]
>> No.) to automatically fill in with numbers in the order the items are
>> entered.
Janie - 01 Mar 2006 16:25 GMT
thank you, Philip.  I get a message saying this:  Invalid number of arguments.

-->position(preceding-sibling::TouchItemNo)<-- + 1

The "TouchItemNo" is the name of the field in the repeating table I am
trying to get to number.  Is that the same as the parent node?

> Try this:
>
[quoted text clipped - 20 lines]
> >> No.) to automatically fill in with numbers in the order the items are
> >> entered.
Philip Colmer - 01 Mar 2006 17:00 GMT
No - you want the name of the node above it.

--Philip

> thank you, Philip.  I get a message saying this:  Invalid number of
> arguments.
[quoted text clipped - 29 lines]
>> >> No.) to automatically fill in with numbers in the order the items are
>> >> entered.
Janie - 01 Mar 2006 17:09 GMT
Okay, so the node above it will just have a default value of 1.  But since
it's a repeating table, there is no "second node".  Should I create a hidden
node to be the parent node?

> No - you want the name of the node above it.
>
[quoted text clipped - 33 lines]
> >> >> No.) to automatically fill in with numbers in the order the items are
> >> >> entered.
Philip Colmer - 02 Mar 2006 11:42 GMT
Sorry - it is my terminology that I think is confusing :-).

You've got a field called TouchItemNo. What you need is for the position
calculation to refer to the GROUP that contains TouchItemNo.

If you are still struggling, open the Purchase Request sample that comes
with InfoPath. The equivalent to TouchItemNo is the Item Number in the
itemized list. The group that contains itemNumber is called item - you need
to put in the name of the group that contains TouchItemNo.

Hope that helps a bit more.

--Philip

> Okay, so the node above it will just have a default value of 1.  But since
> it's a repeating table, there is no "second node".  Should I create a
[quoted text clipped - 43 lines]
>> >> >> are
>> >> >> entered.
Janie - 02 Mar 2006 15:28 GMT
Philip, I looked at the Purchase Request template, but I noticed that the
field "Item Number" field does not number itself as I add items to the list.

I tried this function, but got errors:  position(preceding-sibling::group2)
+ 1
I also tried count(preceding-sibling::group2) + 1  did not work

Thanks for putting up with me.

> Sorry - it is my terminology that I think is confusing :-).
>
[quoted text clipped - 57 lines]
> >> >> >> are
> >> >> >> entered.
Greg Collins [InfoPath MVP] - 28 Mar 2006 00:52 GMT
position(preceding...) is definitely wrong. Position doesn't take any parameters. You definitely want to use count().

You likely need to discover the correct XPath. It could be:
count(../preceding-sibling::group2) + 1
or something else based on the schema you have. An understanding of XPath and the current location the path is starting from will make things easier.

Signature

Greg Collins [InfoPath MVP]
Visit http://www.InfoPathDev.com

Philip, I looked at the Purchase Request template, but I noticed that the
field "Item Number" field does not number itself as I add items to the list.

I tried this function, but got errors:  position(preceding-sibling::group2)
+ 1
I also tried count(preceding-sibling::group2) + 1  did not work

Thanks for putting up with me.

"Philip Colmer" wrote:

> Sorry - it is my terminology that I think is confusing :-).
>
[quoted text clipped - 63 lines]
> >> >> >> are
> >> >> >> entered.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.