Autopopulate a field with incremental ID # and set # of digits. - InfoPath Dev
in

InfoPath Dev

Autopopulate a field with incremental ID # and set # of digits.

Last post 07-30-2010 08:31 AM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-29-2010 10:58 AM

    • AlexG
    • Not Ranked
    • Joined on 07-29-2010
    • Posts 2

    Autopopulate a field with incremental ID # and set # of digits.

    Hello, I'm somewhat new to Infopath and this is my first time to the forums.

    I'm trying to get a textbox to autopopulate an ID number that will increment based on the number of forms submitted to a sharepoint library.  Also, I need it to be a set number of digits, so that it will be 0001, 0002, and so on, instead of "1", "2". 

    1. is it possible to set a text box to look like "0001" "0002" instead of simplifying to "1" or "2"

    2. I want this text box to autopopulate upon form creation/the form being opened, not based on a button as with this example.

    Any suggestions?

  • 07-30-2010 05:51 AM In reply to

    Re: Autopopulate a field with incremental ID # and set # of digits.

    To have the increment ID, create a Data connection to your sharepoint library, with only the column ID taken from it. Then, set the default value of your field to Max([ID from the data connection])+1. For the "0001" thing, i do not know how to do this. Maybe someone else could help?

  • 07-30-2010 06:13 AM In reply to

    Re: Autopopulate a field with incremental ID # and set # of digits.

    To get it zero filled, concat a field with four zeroes onto the front of the ID number field, then use the 'substring' function to grab the four right-most digits. Concatted field:  00002, after substring: 0002

    So, if you have a larger number it would look like this:  0000102, and the substring would look like this: 0102

  • 07-30-2010 08:31 AM In reply to

    Re: Autopopulate a field with incremental ID # and set # of digits.

    One issue with generating an ID when the form opens -- most methods suggest getting the max ID currently in use and incrementing... but what happens if I open a form, and the ID I get is 2, and you open a form before I submit mine? You also get an ID of 2. You really need to consider using a SQL table where you can "reserve" an ID for your form -- the general idea is outlined here.

    Hilary Stoupa

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.