Codeless and dataconnection-less random number generator challenge + now() - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Codeless and dataconnection-less random number generator challenge + now()

Last post 03-07-2012 02:55 PM by s3ttt. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-06-2012 04:46 PM

    • s3ttt
    • Not Ranked
    • Joined on 03-06-2012
    • Posts 4

    Codeless and dataconnection-less random number generator challenge + now()

    Here was my formula to generate a random number.

    Step 1:  number(concat(substring(string(today()), 6, 2), substring(string(today()), 9, 2)))

          This formula will return the month and day so 3-06-2012 is returned as a number (not a date) as 306.

    Step 2:  string-length(CreatedBy) * Step 1

          This formula multipled the previous monthday number by the number of characters in someone's name.

     By limiting the result to 3 characters I sort of get a random number.  By then concatenating this with now(), I can ensure that the form name is never duplicated by just using now.

     How can I improve Step 1 or Step 2 so that the number is even more random.  Right now if the same user on the same day creates a form their form number will be the same for that date?

    Filed under: , , ,
  • 03-07-2012 04:14 AM In reply to

    Re: Codeless and dataconnection-less random number generator challenge + now()

    I think there is a simpler way to get a unique key. How about concat(username, " - ", now())? It's pretty difficult for the same user to submit two forms within the same second, so I think this should be unique, and you wouldn't need to resort to custom code to generate a more complex random number or a GUID.

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


  • 03-07-2012 02:55 PM In reply to

    • s3ttt
    • Not Ranked
    • Joined on 03-06-2012
    • Posts 4

    Re: Codeless and dataconnection-less random number generator challenge + now()

     Creating a unique key isn't so much the impossible challenge.  The fact that basic and short identifiers are even a challenge is annoying.  Form numbers are simple, succinct, and not distracting.  It'd be nice to be able to make them without slowing down performance or requiring huge file names. 

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