Generate Sequence Numbers in a text box.... - InfoPath Dev
in

InfoPath Dev

Generate Sequence Numbers in a text box....

Last post 12-23-2008 11:58 AM by warrtalon. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 02-19-2008 06:54 AM

    Generate Sequence Numbers in a text box....

    Hi All,
    I have a Infopath 2007 form(with some text boxes, drop downs etc) published to a sharepoint 2007 form library. So, whenever the user opens up sharepoint portal and clicks on NEW, he gets a new Infopath form. My task is: populate a text box in the Infopath form with sequence numbers that is when the user clicks on NEW for the first time, in the Infopath form text box 'ID_1' should be prefilled, when he clicks next time 'ID_2' should be pre-filled and so on. Is this acheivable at all?

    Please Advise,
    Thanks,
    Kon

  • 02-19-2008 10:07 AM In reply to

    Re: Generate Sequence Numbers in a text box....

    Hey Kon.

    What is ID_1 is it a unique for each form or a unique for records within the form?

    Can you give an example?

    If it is just a numeric then you should be able to increment it but the issue is always maintaining uniqueness with multiple form users.

  • 02-20-2008 04:29 AM In reply to

    Re: Generate Sequence Numbers in a text box....

     Hi Clay, thanks a lot for the reply. Yes, ID_1, ID_2 are supposed to be unique for each form.(not for records within). As you said it should just be numeric which increments itself. Good thing is there is only one user who  fills out the form, so we dont have to worry about multiple users filling out the same ID's.

    Also, actually i want the text box in Infopath form to prefill values starting from ID_8000, ID_8001,....and so on whenever the user clicks on New form. I was thinking maybe to bind the text control to a sharepoint list(which has values, ID_8000, ID_8001 etc entered manually to it).

    Please Advise,

    Thanks,

    Kon 

     

  • 02-20-2008 08:43 AM In reply to

    Re: Generate Sequence Numbers in a text box....

    You would still need to be careful if the user opens it twice but you should be fine in this situation.

    What you do is create a secondary data connection to recieve from the form library itself.  Make sure the ID number is in the defualt view and that all items are displayed in the view, not just the default top 100.

    Then you can use a max(ID)+1 to set the next ID on a new form.

    That should be all you need.

  • 02-20-2008 12:04 PM In reply to

    Re: Generate Sequence Numbers in a text box....

    Hi Clay, When i do a Add a secondary connection from my Infopath form--> Receive--> from sharpeoint form library.

    Then i went back to the field: double click-->Under default value: Add the formula : max(.) + 1.

    Should i export the form template back to sharepoint library. But how would i get the numbers to start with 8000 and so on?

    Am i missing something here?

     

    Thanks,

    Kon

  • 02-20-2008 01:55 PM In reply to

    Re: Generate Sequence Numbers in a text box....

    I was not sure if you already had forms or not but you could enter an initial form with 8000 or add an additional rule to your form template that says if less than 8000 set to 8000.

  • 12-23-2008 08:55 AM In reply to

    Re: Generate Sequence Numbers in a text box....

    I keep getting a error code Nan using the max function?  Using the count function when 2 people go in at the same time, it issues the same number?

     

    Can you help?

  • 12-23-2008 11:58 AM In reply to

    Re: Generate Sequence Numbers in a text box....

    Gayle, do you get the error code with max when doing the very first form in the library (or with no other forms currently in the library), or does it give you the error with forms already in there?  I ask that, because if there isn't a form in the library, then there are no ID#s to reference with the max function.

    Count and max are always going to issue the same ID if people open forms at the same time, because the ID # is not assigned until after the form is submitted, so you could have 100 forms open at once with the same custom ID.  This goes back to the whole reason you're trying to come up with an ID in the first place.  I still don't know why displaying an ID is so important, but here are a couple of other options that have come to mind over the past week:

    1. On your submit button, have it submit once to the library, which creates the ID, query the list to pull your ID into the form, then submit it again all in one button push.
    2. Make a workflow that triggers after the form is submitted, pulls the ID from the new list item, and do something with it from there.

    Unfortunately, neither of these can be used to establish a filename that includes the ID.  You could put the ID into your TITLE, though, which is better for referencing than the filename when displaying in your library view, imo.

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