in

InfoPath Dev

Assigning Sequential Form Number

Last post 08-06-2008 01:28 PM by barmatt80. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 06-30-2008 08:55 AM

    • MarkB
    • Not Ranked
    • Joined on 06-30-2008
    • Posts 3

    Assigning Sequential Form Number

    I'm trying to create an infopath form that publishes to a Sharepoint database.  I'm using a custom submit buttom to assign a sequential form number when posting to database.  The submit button uses a rule an a data connection to assign the form number as max(formnum) + 1.  Where I'm having a problem is on the initial form.  I run into this problem because when running max(formnum) on an empty database, I get the result "NaN".  I've tried using rules to replace "NaN" with 10001 during the submission process, but it doesn't seem to apply the rule.  I'm sure it's probably something very simple that I need to change, but I can't figure it out.  Does anyone out there have any ideas as to how I could go about doing this?  I also tried an if-else statement, but it gives me an error which has something to do with node-sets.  I'm running Infopath 2003 and Sharepoint 2007.

     -Mark

  • 06-30-2008 10:02 AM In reply to

    Re: Assigning Sequential Form Number

    you will need to use the nz function in conjunction with what you have.  what that does is return zero if there are no other number or other problems.

    Also it is best to have this done on the database side to handle multiple people using the form at once.

  • 06-30-2008 10:45 AM In reply to

    • MarkB
    • Not Ranked
    • Joined on 06-30-2008
    • Posts 3

    Re: Assigning Sequential Form Number

    Thanks.  That seems to work fine.  Since you mentioned the thing about the database, why would it be better to have the database handle the form assignment?  The database is simply an infopath forms library, so I'm not sure if I can set it up on the database end.  I have the form querying the database on submission instead of on opening in order to deal with multiple users opening the form at the same time.  Can you see any problems with this?

     -Mark

  • 08-06-2008 10:03 AM In reply to

    Re: Assigning Sequential Form Number

    Problem I have found is that if you are only looking at the max value in a column, it is only looking at the DEFAULT view's column.  So, I had 2 views - Open Items and Closed Items.  Assigning new doc #'s to each record sequentially.  This is not a problem if you are viewing ALL documents as it is defaultly set up.  However, when the highest record was in the "closed items" view and not appearing in the default view, the next number would be a duplicate.

     This would be a prime example of needing the SharePoint database to maintain the next number sequence.

  • 08-06-2008 01:28 PM In reply to

    Re: Assigning Sequential Form Number

    The database that i mentioned is the best practice of infopath.  The best practice is to have infopath form save all values into a database backend, like SQl server.  This would help ensure no data is lost.

     By allowing the database to handle the incrementing of the form or the sequential number is the best way to do it.  That way if 10 forms are opened simultaneously, the number isn't generated on open, as this would put the forms out of order as far as the sequential number is concerned or if a user closed the form without submitting would generate a gap in the numbering.  This way by using a database to produce your sequential number, it would generate it on submit(or you should set it up on submit) to query, find the highest number and increment, save the data to the database as the form is submitted to a sharepoint form library.

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