Auto number on submit (2 document libraries) - InfoPath Dev
in

InfoPath Dev

Auto number on submit (2 document libraries)

Last post 03-20-2012 08:57 AM by stgiesbrecht. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-19-2012 03:00 PM

    Auto number on submit (2 document libraries)

    I am looking for a way to generate a sequential number for a form when I submit it.  I can do it on a single document library with a receive data connection and taking the max(id) and then using that as the file name.  The problem is that I have two document libraries.  I create the new documents in library 1 and then when the status changes, I need to submit the ddocument to library 2 and delete it from library 1 (so that only specific users are able to edit it).  I then delete the document from library 1 using qRules.  If I then create a new document in library 1, it is using the next document id, which now is in library 2, so I end up with the same number.  I would like create the new document with the next highest number based on the max number in library 1 and library 2.

     Any ideas on how to accomplish this in the easiest way?

    Thanks,
    Scott

  • 03-19-2012 04:37 PM In reply to

    Re: Auto number on submit (2 document libraries)

    Hi Scott-

    Which command were you thinking about within qRules?

    I can't think of a qRules command that will accomplish this, but let me know what you were thinking to see if it's possible.

    Thanks.

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


  • 03-19-2012 05:10 PM In reply to

    Re: Auto number on submit (2 document libraries)

    I agree with Ernesto that this doesn't seem like something qRules could help with - but logically, couldn't you compare the max of the ID in the two libraries, and then increment the highest by 1?

    That is, create a data connection to each library, and have two rules - one with a condition that max ID in Library 1 is higher than max ID in Library 2 - if that condition is true, you'd use the max from Library 1 + 1 for your new ID. If that condition is false (in other words, if max ID in Library 2 is higher than Library 1) you'd use the max from Library 2 +1.... make sense?

    I have to add, just for the sake of completeness, that there are risks in this approach (getting a max and incrementing by 1) - even if you query the data sources right before you submit, there is always a non-zero chance you could have two forms with the same ID. qRules has a GenerateGuid command - if you used GUIDs, you could be confident of uniqueness and you wouldn't have to all this.

    Hilary Stoupa

  • 03-20-2012 04:10 AM In reply to

    Re: Auto number on submit (2 document libraries)

    Here is a document on using qRules to generate unique filenames.

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


  • 03-20-2012 08:57 AM In reply to

    Re: Auto number on submit (2 document libraries)

    Thanks for the suggestions.  I am currently trying it out with the GenerateGuid command and it looks as though it will work well.  Just have to train the users that the numbers mean nothing other than a unique id rather than wanting a simple sequential numbering sequence.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.