Auto generate number - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Auto generate number

Last post 08-30-2011 10:43 AM by RoccoNH. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 09-19-2005 01:02 PM

    Auto generate number

    Hi All,

    I'm new to InfoPath and I have a really simple question here: how to auto generate number for one field?

    For example, a "Change Request" form has a field "Title". The field "Change Request #" should be a combination of

    "CR" + "Current Date" + "The sequence of the file" + "Title".

    I can figure out the other three but just "the sequence of the file" part is quite challenging to me. I'm wondering maybe you can help me?

    Thanks in advance!


    rachel

  • 09-19-2005 10:48 PM In reply to

    Hi Rachel,
    This depends on where you are storing the file. If you are submitting to SharePoint, you can look up the ID from the SharePoint list and there are several threads discussing how to do that. If you are submitting to a database, you'll need to return the new row ID for the submitted form. If you are just saving to a filesystem, you'll unfortunately need to generate your own unique identifier. There are various ways to do this. Search for "GUID" in the forum or on the website. Hope this helps!

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 02-06-2009 04:11 AM In reply to

    Hi  Patrick,

    i am considerably new to infopath and sharepoint, but and I have to create a form for Change Request. I need a unique number for a change request number, which follows a sequence. I am publishing the form on Sharepoint. I know how to use the library with a data connection and to find the highest ID of the form. But then simply using the capabilities of Infopath I cannot add 1 to the largest ID? maybe I do have to write a code with Jscript. I would like to concatenate "CR"  and the last "ID+1" in order to recieve the correct answer. I need some advice and if a scipt will have to be written can you advice me to some topic where I can learn more about scripting and retrieving data from sharepoint. I am using infopath 2003.

    Thank you in advance

    Svetoslav

  • 02-06-2009 05:23 AM In reply to

    Svetoslav,

     

    For ID numbers, I make a seperate group for generating ID numbers. In that group, I make an integer field named CRIDSeed with a default value of 1.  make the default value of the Change Request ID Field: concat("CR",CRSeed).  Next in the rules of the change request section, add a rule to change the value of the CRIDSeed to CRIDSeed+1.  This will increment the number eachtime there is a new Change Request.  Also, this keeps the number unique if there are deletions.

     

    The xml would look like this:

     

    <GrpChangeRequest>  The repeating group that holds all of your change request data and you set the rule to change the CRIDSeed field to CRField+1

    <CRID/> This is the field the you set the default value to: concat("CR",CRSeed)

    </GrpChangeRequest> 

    <GrpIDSeeds>

     <CRIDSeed> This is the field that you set the default to 1

    </GrpIDSeeds>

     

    Hope this helps,

     

    Ren

  • 10-09-2009 11:14 AM In reply to

    Svetoslav,

    I actually was checking out this site for resolves to something I had and found your question. I solved this problem simply using SharePoint.

    In SP, I created a List called "Counter." To the list, I added two columns. "Count" and "Check"  both are "Single line of text" types. Their default value is "y." I made "count" required. Then I went ot the view in Sharepoint and modified the view to include these two columns. In the view, chose the count verision "count (linked to item with edit menu). " The ID is autogenerating.

    In InfoPath, i created a text box and through a dataconnection I told it to look to the list and tell me what the highest number is and to add one. The actual Formula that goes in the IP under the data tab for that text box is "max(@ID) + 1"  Also, make sure you click the box in InfoPath "update the value when the result of the formula is recalculated.

    It works for me, but if you have any issues, you can contact me. I'll walk you though it.

  • 08-03-2011 03:46 AM In reply to

    Hi, To create a Unique ID dynamically without referring to the list or library by having the value of Date with seconds,which will have unique ID. eg:- Create a text box with data type "Text(String)" and in the default value create this formula concat(userName(), now()) - it concatenates username with Date and Time. The value should be a Unique One.

    Hope it was helpful.

    Good Luck

    John Jay
  • 08-30-2011 10:22 AM In reply to

    Hey RoccoNH  can you give me detailed steps for for following step which you mentioned? I am not sure how you are making textbox and list dataconnected? Thanks

    In InfoPath, i created a text box and through a dataconnection I told it to look to the list and tell me what the highest number is and to add one. The actual Formula that goes in the IP under the data tab for that text box is "max(@ID) + 1"  Also, make sure you click the box in InfoPath "update the value when the result of the formula is recalculated.

  • 08-30-2011 10:43 AM In reply to

    I have a word doc to follow if you can provide your email I would be happy to provide to you.  Just give credit where credit is due. thanks.

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