Auto Numbering in Repeating Tables - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

Auto Numbering in Repeating Tables

Last post 01-04-2012 11:28 AM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-04-2012 11:12 AM

    Auto Numbering in Repeating Tables

    Good afternoon all, I've got a question regarding autonumbering in repeating tables. 

    Scenario/Current Solution:

    First of all, I'm using InfoPath 2007 and SharePoint 2007. I'm creating a form that has several tables that will be used to record requirements and each time a user enters a new one, the number needs to be incremented by one. I've figured out the basic way to do the autonumbering via using this forum. For example, 1, 2, 3, etc., via the Text Box properties --> Data tab> I've entered the following into the default value field: count(preceding-sibling::BusReqTable) + 1 where the BusReqTable is the name of the repeating table/row. This works all well and good, however there are two additional requirements that need to be factored into the final number. I'm asked to 1.) add a prefix and 2.) make the sequential number three digits, for example: BR001, BR050, BR100, BR900, and so on. The other thing that the user wants is to limit the number of rows that can be entered into the table, for example 15. I didn't know if it was on the same principle as creating an incremental file name when a form is published to SharePoint. For example, BR001-UserName. If it is, any ideas of how to do an internal numbering scheme similar to that of the file name? Additionally, what would happen if the user deletes a row, are all the other ones after it automatically updated? For example if I have 11 rows, I delete row 3, so now row 11 would be row 10. Is this possible as well?

    I've tried everything I can think of to add a prefix and the two other digits, but have come up empty handed. This forum has been great source of information for the basics, and there appears to be really good code. However, keep in mind with your responses that I'm not a programmer and have no idea on how to use code. If that is the only way it can be done, so be it. I'm just hoping that there will be an easier, less painful way of creating the numbering scheme that I have been asked to add to my form.

    I've also tried changing the source files, as described elsewhere, but again, couldn't get it to work for me. Limiting the number of requirement rows isn't that big of a deal, but the numbering is something that I really need to have happen.

    Eventually, we will be migrating to SharePoint 2010 and InfoPath 2010, but for now I'm kind of stuck with working in 2007. So, whatever help/advice anyone can provide would be most welcome.

  • 01-04-2012 11:28 AM In reply to

    Re: Auto Numbering in Repeating Tables

    I suggest using two fields for the auto numbering - one that's not displayed and just uses that formula you have to contain the raw integer value (1,2,3), and a second one that has the prefix and zero-padding.

    Then for the second field, you could use this formula.

    concat('BR', substring('00', 1, 3 - string-length(RowNum)), RowNum)

    Yes, this should automatically update when rows are removed.


    There are ways to limit the number of rows in a table, and it's a question that has been asked here several times.  Please have a search through the forum threads to see if you can find anything.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.