what is the best way to autonum a form? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

what is the best way to autonum a form?

Last post 04-18-2013 03:17 PM by sudlev. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 04-03-2013 12:01 PM

    what is the best way to autonum a form?

    I am currently am using the max + 1 technique but sometimes it is creating duplicate numbers and I am not sure why. I thought it is because a form gets deleted but that logic doesnt always hold up.  I know you can do a count as well. What are some of the best practices for doing auto num? I dont have a problem writing C# if I have to.
  • 04-03-2013 07:38 PM In reply to

    Re: what is the best way to autonum a form?

    Hi,

    Can you provide more information? Is this a SharePoint form library form template? A SQL bound form?

    Autonumbering is troublesome at times, but knowing more about your scenario will get you some accurate responses from the community.

    Thanks!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 04-04-2013 05:51 AM In reply to

    Re: what is the best way to autonum a form?

    this is a SharePoint form library form template. I have ran across these solutions.

    http://www.bizsupportonline.net/blog/2012/05/3-ways-auto-number-infopath-forms-submitted-sharepoint-form-library/

    Currently. I am using solution #1. I am considering the #2 solution.  I have the cookbook 3.

  • 04-04-2013 05:44 PM In reply to

    Re: what is the best way to autonum a form?

    Have you considered using workflow? I have a number of forms where I set the file name to the sharepoint item ID which is very simple.

    1. Create a text field called FileName in the datasource
    2. In your data connection to 'submit to sharepoint library', ensure you use the FileName field as the file name.
    3. When you publish the form, make sure the FileName field is promoted and editable in sharepoint
    4. Create a new workflow that runs when a new form is created. Set the workflow to rename 'Name' and 'FileName' fields to the ID.

    That should do it.

     

  • 04-05-2013 04:56 AM In reply to

    Re: what is the best way to autonum a form?

    I figured out why we were seeing duplicates.  When IP retrieves the max(ID) it uses the default view in SP List of 50 item count. when an item is removed from that view, it uses the next max ID which may not be the latest.  I didnt ex[ect the user to delete items as they should have these for archives. I did test the workflow and it seem promising and SIMPLE. :) thanks for the reply. another option would be to retrieve all IDs using a web service or SOAP or owssfilter, if possible
  • 04-05-2013 07:57 AM In reply to

    Re: what is the best way to autonum a form?

    I already have complex approval workflow. Is it ok to add an autonumber wf to start on item creation?
  • 04-07-2013 09:53 PM In reply to

    Re: what is the best way to autonum a form?

    The problem with Sudlev's approach is that it requires property demotion to get the ID back into the form. And, that's not on by default  nor is it a best practice.

    I would rather suggest that you just do a double submit from the form using a rule that has an action to submit, another action to query and set the value, and a final action to submit again. I've responded to others with this technique in more depth. Please search for "double submit SharePoint ID" or something and you should find them. If not, let me know.

    Thanks! 

    Patrick Halstead
    Project Manager at Qdabra
  • 04-14-2013 05:28 PM In reply to

    Re: what is the best way to autonum a form?

    Hi Patrick,

    I'm interested in more details on your double submit method! I wasn't able to find more details on the forum and was unsuccessful in my own experimentation.

    When time permits can you please provide more detail?

    Appreciate your help.

    Danny

  • 04-16-2013 10:22 AM In reply to

    Re: what is the best way to autonum a form?

    sudlev,the double submit is something like this

    In your submit button, do a double submit by doing this:

    1. Add a new retrieve data connection for the current form library
    2. Use my article here to generate your filename: InfoPath – Auto-Generating Filenames (you should always do this, but it's especially important when you want to retrieve the ID). Also, be sure you promote the strFilename field to the form library so that you can use it for comparison
    3. In the Submit rule from above, be sure to add an action to query the data connection from step 1 (the query must occur after the first submit)
    4. The next step should be an action to "Set a Field's Value." This is where you'll want to set the value of your form's ID field to the ID node of the secondary data connection WHERE strFilename (SharePoint) is equal to strFilename (InfoPath). Here, you are using a filter to compare the filename saved in the form to the filename saved in the form library.
    5. Next, re-submit so that the ID is saved in your InfoPath ID field
    6. Display this ID field wherever you want in the form, but make sure it's read-only
  • 04-16-2013 04:33 PM In reply to

    Re: what is the best way to autonum a form?

    Hi cpluce,

    Following this method won't the actual file name remain the same (e.g. as "user - timeofsubmit"). What I am trying to achieve is have the file name to be the same as the sharepoint ID.

    Danny

  • 04-18-2013 05:35 AM In reply to

    Re: what is the best way to autonum a form?

    why do you need the filename to contain the ID of current item ID?   That would be redundant.  Just use the current item ID field if you need to reference the ID of item.  it isnt considered best practice to use the ID in filename.  If it is a must than the best way to do it is to write C# to achieve this feature.

  • 04-18-2013 03:17 PM In reply to

    Re: what is the best way to autonum a form?

    It's because users interact with the forms in the library and the filename field needs to be on display so they can access the context menu. Having a long name like 'username - time' is meaningless to the users and takes up space in the view. None of these are huge problems but it just makes it generally easier for them.

    It's OK, I already have the solution I mentioned above working in multiple libraries and have never had any problems with it, I just thought someone had a better way of doing it.

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