Auto generate sequential numbers *I know this has been asked, please hear me out! - InfoPath Dev
in

InfoPath Dev

Auto generate sequential numbers *I know this has been asked, please hear me out!

Last post 10-18-2012 01:11 PM by KaliKa. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 10-18-2012 11:33 AM

    • KaliKa
    • Not Ranked
    • Joined on 10-18-2012
    • Posts 4

    Auto generate sequential numbers *I know this has been asked, please hear me out!

    I am brand-spanking-new to InfoPath. I thought I might be able to use it to create a form that is to be completed as an email and submitted to a common mailbox. I've been searching diligently for the last couple days for information on how to create a field that will auto generate a form ID number in sequence, to suit my situation. I'm not picky on the auto ID number, I'm sure something along the lines of a date plus unique numbers work work perfectly (eg YYYYMMDD01, YYYYMMDD02 etc) I am not working with SharePoint, and every article I come across is SharePoint related. I've tried my best to work around the instructions provided (removing SharePoint references and replacing with relevant ones), but I keep hitting dead walls. I'm not even sure what I'm trying to do is possible anymore, though it doesn't seem like it should be impossible. Does the form have to be "submitted" before a number can be generated? Does the code have to pull information from a web connection for this to work? I'm not advanced in my knowledge of these things, so when I read, "If it's just e-mail, you will have to add some code that locks a file on a server, increments a counter in that file, and saves the file so that submitters can be "synchronized" using this file counter." I have no idea how to do any of that (if it's even relevant to what I'm trying to do. Much appreciated!
  • 10-18-2012 11:53 AM In reply to

    Re: Auto generate sequential numbers *I know this has been asked, please hear me out!

    So - here's the thing that is making this tough for you.

    To "auto increment" the next number... you have to know what the last used number was. If the information isn't stored any place (like SharePoint, SQL, Access) you don't have a way to get the last used number into the next form. Does that make sense?

    Personally? I would push back on this requirement. You are not likely to find an easy way to implement this. Why must the file have an incrementing ID? Wouldn't date / time / username be more meaningful?

    Hilary Stoupa

  • 10-18-2012 12:08 PM In reply to

    • KaliKa
    • Not Ranked
    • Joined on 10-18-2012
    • Posts 4

    Re: Auto generate sequential numbers *I know this has been asked, please hear me out!

    Hi Hilary, I'm not familiar with SLQ or Access, but we do have a set of different hard drives that any employee can access through network locations on our computers. Is it possible to have files saved in such a location with auto increment file names and have a field pull the info from there? Otherwise no, it's really not crucial. These are meant to be Project Request forms and I would like a unique ID to identify with. At this point the form is still a concept and new in it's use, but we do need to track them somehow. If it's too much trouble for what it's worth, then yes, date/time would probably work just fine.
  • 10-18-2012 12:16 PM In reply to

    Re: Auto generate sequential numbers *I know this has been asked, please hear me out!

    To know what the "next" number is, you'd have to write code to loop through those file names and get the last used number. This would require your form to be full trust, because the code is touching the file system. I would find something else for my unique id. It seems to me that the date / time of the request combined with the project would be unique.

    Don't get me wrong - I understand why this is desireable - it is nice to refer to things as "PR 001" or what-have you. But it is challenging to implement - especially to implement well - and there is no reason to add the burden of code to a form for something that is just "nice to have", you know? Especially if you aren't a programmer.

    The now() function in InfoPath returns date and time to the second, in a format like this:

    2012-10-18T12:14:53

    You can use formulas to parse that out into different formats - there is a sample form here you can download that may help you.

    Hilary Stoupa

  • 10-18-2012 12:25 PM In reply to

    • KaliKa
    • Not Ranked
    • Joined on 10-18-2012
    • Posts 4

    Re: Auto generate sequential numbers *I know this has been asked, please hear me out!

    Okay, I'll play around with it a bit. I do have a very newbie question though.. I've put the now() formula into the field, but am I supposed to add something else as well? I ran a preview and all that appears in that field is exactly what is there -> ()now
  • 10-18-2012 12:32 PM In reply to

    Re: Auto generate sequential numbers *I know this has been asked, please hear me out!

    Oh - did you use the fx button? It is a function, you need to type it into the formula editor dialog.

    :-)

    Hilary Stoupa

  • 10-18-2012 01:11 PM In reply to

    • KaliKa
    • Not Ranked
    • Joined on 10-18-2012
    • Posts 4

    Re: Auto generate sequential numbers *I know this has been asked, please hear me out!

    That was it, thanks Hilary! I honestly did try that the first time around, when playing with a different function. But not when trying the one you gave me. Anyway, I appreciate your help :)
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.