Random ID Number - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Random ID Number

Last post 05-07-2007 10:28 PM by Matt Faus. 12 replies.
Page 1 of 1 (13 items)
Sort Posts: Previous Next
  • 02-23-2006 05:06 AM

    Random ID Number

    Hi All Friends,

    I a new in InfoPath, I created a form to submit the data to ACCESS table but I got the problem, I don't know how to handle the sequence ID, because I would like to have new ID every times the user fill out the form and also the ID number could not be overlapsed or in the case the user fill out the form with the new ID then the user decide to cancel that form (ex: by close that form without submit) so that ID need to be available for the next user. Please give me the advice,

    Thank you very much, that will be the big help for me.

    Have a great day

    vdang

    Vinh Dang
  • 02-23-2006 11:36 PM In reply to

    Hi Vinh Dang and welcome to our forum!
    This is an often discussed topic. Please use the "Search the InfoPathDev Forums for:" link in the upper right corner and search for "auto number Access database". I'm sure you will find something.

    Patrick Halstead [InfoPath MVP]
    InfoPath Dev Seattle
    Patrick Halstead
    Project Manager at Qdabra
  • 02-24-2006 12:08 PM In reply to

    Thank you very much for your supports,

    I will try it and I will let you know how far I could go, because some section in there I need to read more.

    Happy Friday to you,

    vd


    quote:
    Originally posted by Patrick Halstead

    Hi Vinh Dang and welcome to our forum!
    This is an often discussed topic. Please use the "Search the InfoPathDev Forums for:" link in the upper right corner and search for "auto number Access database". I'm sure you will find something.

    Patrick Halstead [InfoPath MVP]
    InfoPath Dev Seattle

  • 02-24-2006 06:29 PM In reply to

    Hi Patrick,
    I read that subject but I found something I concern about: What if two users fill out the forms in the same times so the query will give two of users with the same AUTONUMBER. That will create the duplicate number if they submit.

    Another thing, if in Access, I use AutoNumber, I will have the problem, the new AutoNumber will create when we append the new entry, but the query just pull out the number only. How could we do append query during the regular query.

    Please give me more advice in that situation. The whole purpose, I just want to create auto unique number for my form, and also I would like to upload that form to SharePoint Portal Server for multi-users in the same time.

    Again, thanks for your advice,

    vd

    quote:
    Originally posted by Patrick Halstead

    Hi Vinh Dang and welcome to our forum!
    This is an often discussed topic. Please use the "Search the InfoPathDev Forums for:" link in the upper right corner and search for "auto number Access database". I'm sure you will find something.

    Patrick Halstead [InfoPath MVP]
    InfoPath Dev Seattle

  • 02-27-2006 08:23 PM In reply to

    If you wait to grab the autonumber from the database until immediatly before you submit, you should be able to stay pretty safe. As long as the retrieval of the autonumber and the submission are within a couple lines of each other, you will have less than a 1 second window for two uses to get the same autonumber. Depending on connection speed, etc.

    Otherwise, you could use something else as a unique identifier, like a datetime stamp carried out to the milliseconds.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 02-28-2006 12:21 PM In reply to

    Hi,
    When you submit a form to sharepoint, sharepoint creates an ID for your form, this is a sequesnce number. What we normally in our projects is,
    1. Submit the form to sharepoint
    2. Get the ID created by sharepoint and set this value in the form. This is done using sharepoint "_vti_bin/lists.asmx" webservice.
    3. Submit the form to sharepoint again.
  • 03-01-2006 08:56 AM In reply to

    Hi All,

    First of All, thank you for your reply. I am try to use VSTO based on C# to make the connection to my Form. But now it come up another situation,

    Here is my data:

    + myFields
    +queryFields
    +dataFields
    - PLD_MAIN
    + AutoTrackingNum
    + Project
    + Rev

    (Maybe format will give confusion result: queryFields and dataFields are subgroup of myFields, PLD_MAIN is subgroup of dataFields,
    AutoTrackingNum, Project, Rev are fields of PLD_MAIN's group)

    Here is the story, I would like to combine the value of Project (Drop down list selected) + the value of Rev (Drop down list selected) with
    AutoNumber (Random number). And after that use that combination to submit back to the my database (table).

    And below is the code I used MS Studio with C# to test the value of "Rev" field:

    string str = thisXDocument.DOM.selectSingleNode("/myFields/dataFields/PLD_MAIN/Rev").ToString();

    thisXDocument.UI.Alert(str);

    My concern is my string ("/myFields/dataFields/PLD_MAIN/Rev") sent to selectSingleNode, I am not sure I done right ?
    Because system still give me the message "MESSAGE REFERENCE NOT SET TO AN INSTANCE OF OBJECT".

    Please help me through this situation, I spent already one week on that subject.

    Thank you very much,

    vd

  • 05-07-2007 01:10 AM In reply to

    Hi Agni,

    I've been looking for the way to grab the sharepoint ID using lists.asmx and could only stumbled across this article (written by Agni too):

    http://www.infopathdev.com/blogs/agni/archive/2006/05/15/Query-for-Items-in-SharePoint-Form-Library-Using-GetListItems-Web-Method.aspx

     
    Would I be able to use that article (using GetListItems method) to retrieve the sharepoint ID?

    And if it's a yes, is it going to be similar?

     

    Thanks

    p.s: Cant believe it's so complicated to just grab a sharepoint ID :S
     

  • 05-07-2007 04:53 AM In reply to

    Have you thought about just using the GUID. You could use System.GUID.NewID() method to receive a unique number/string.

    Listen to Motörhead cos they play Rock'n Roll :)
  • 05-07-2007 06:13 AM In reply to

    Nukkumati has the right idea if you're just looking to generate a random number (as is the basis of this thread), but if you're trying to grab the SharePoint ID (which is also a GUID), you will have to do that by checking out the Address Bar in a web browser. Check out my blog post on Adding SharePoint List Items from InfoPath and you should find the information you need.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 05-07-2007 07:05 PM In reply to

    Hi Matt and Nukkumati,

     

    Thanks for the input and I think I used the term 'sharepoint ID' incorrectly here.

    What I meant was the unique form ID that's created by the sharepoint when the form is submitted to sharepoint.

    But yes both of you are right that the basis of this thread is about random ID number, I'll just post my question in other thread and truly sorry about the confusion :( 

     

  • 05-07-2007 08:55 PM In reply to

    Actually, I was following up Agni's solution: 

    Agni Jonnalagadda:
    Hi, When you submit a form to sharepoint, sharepoint creates an ID for your form, this is a sequesnce number. What we normally in our projects is, 1. Submit the form to sharepoint 2. Get the ID created by sharepoint and set this value in the form. This is done using sharepoint "_vti_bin/lists.asmx" webservice. 3. Submit the form to sharepoint again.

     

    Would you be able to give me pointers on how to obtain the ID created using the GetListItems method from the "_vti_bin/lists.asmx" webservice?
     

  • 05-07-2007 10:28 PM In reply to

    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (13 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.