views:

794

answers:

2

Within my InfoPath form (which has to be loaded within a SharePoint Portal by the browser)I have a repeating table containing multiple fields. Now I would like to make the first textfield autoincrement starting by 1. How exactly can I do this?

I have already heard of a way by using the "count" function but this produces errors or in best case a static number which unfortunately does not count. The function I have added for the field is "count(.) + 1"

Any suggestions?

+1  A: 

Let's say your repeating group is called "item" and your autoincrement field is called "index". The default value of the index field should be

count(/my:myFields/my:item)

This should count correctly for you.

Alex
Of cause! The trick is to count the groups and not the fields, thats why it did not work earlier. (I had also tried it the same way but including the field name as well, which led to a lot of errors)Thanks!
Marcus
A: 

I suspect you really want position(). Count is just going to return the total count of nodes that match the xpath expression you give it.