Alpha Video Training
Results 1 to 9 of 9

Thread: Random # generator in field rules or a button?

  1. #1
    Member
    Real Name
    Jim Gatton
    Join Date
    Jun 2006
    Posts
    35

    Default Random # generator in field rules or a button?

    I have followed/copied a couple of examples of random number generators that I have found while searching through the forum but could not find anything that would work properly for my situation even though it is a very simple situation, I think.

    When I enter a new record (customer) I would like a random string generated in each of two fields that would not later change for that record, at least not automatically. The only formula I found that would work kept changing whenever I opened the record again.

    One I tried, its limitation was it was date based, I believe, and then the second record I tried it in a few minutes later gave me the same unique number.

    And, I would like numbers, letters upper case and lower case, ala, tQvRqO8. I'm current using 7 digit unique numbers copied manually from RoboForm but I can see an advantage in a span of 5 to 8 digits, or something along those lines.

    I believe it is not possible to tie something like this to a field rule preventing duplicates but I gather the odds are really stacked against this actually happening.

    Anyone know how best to approach this?

  2. #2
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Random # generator in field rules or a button?

    Hi Jim,
    I'm having a hard time thinking of a way that has not already been covered in the forums.....do you actually need it to be random or is it the uniqueness that you want? BTW, instead of using date() use the time function now() to create an easy unique number---well, possible to have a duplicate but if something else from the record is added as well the chances really get slim...and could check for if it exists before saving and either manually or with code keep adding to it until it is.

    There is also a function that will generate a unique ID but believe it is a 32 character result.

    Let us know more specifics....and also tell us exactly why the several ways mentioned in previous posts will not work for your situation--check out the preselected "Similar Threads" area at the bottom of this thread before doing additional searching as I believe your answer may very well be in one of them.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  3. #3
    Member
    Real Name
    Jim Gatton
    Join Date
    Jun 2006
    Posts
    35

    Default Re: Random # generator in field rules or a button?

    I will have to get back to this later but to answer your easiest question uniqueness is the goal. Doesn't have to be random at all, once I think about it. It's all about being unique and a combination of alpha numeric.
    If nothing else then, thanks for helping me to clarify the problem better.

  4. #4
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Random # generator in field rules or a button?

    In the interim you may want to check out the various threads regarding the creation of your own auto-increment as it sounds like you need 2 unique IDs created which, for one table, the Alpha auto-increment in field rules may not do it for you (never even considered trying it though to see if 2 fields in the same table could be an auto-incremented though). Creating your own auto-increment has definitely been covered many times here so it should not be difficult to find several threads on it. If you can't find any that are applicable let us know and maybe link to one that is closest to what is required so that we have something to base our guess on!.
    Mike
    __________________________________________
    It is only when we forget all our learning that we begin to know.
    It's not what you look at that matters, it's what you see.
    Henry David Thoreau
    __________________________________________




  5. #5
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,607

    Default Re: Random # generator in field rules or a button?

    Jim

    It would be easier to prescribe a solution if you would describe what your application is trying to accomplish with the field(s).
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  6. #6
    Member
    Real Name
    Jim Gatton
    Join Date
    Jun 2006
    Posts
    35

    Default Re: Random # generator in field rules or a button?

    The very short explanation: I do some article marketing via two routes. One or the other code is placed in an article submission which later makes it easy to track through a search engine where the article has actually been published.

  7. #7
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,607

    Default Re: Random # generator in field rules or a button?

    So make each field a character type and autoincrement and use the default value to 'seed' each field with a value that won't overlap over the life of your data.
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  8. #8
    Member
    Real Name
    Jim Gatton
    Join Date
    Jun 2006
    Posts
    35

    Default Re: Random # generator in field rules or a button?

    And what formula do I insert in order to get my mix of alpha lower/upper case and numeric? Or where do I find the instructions will be appreciated.

    Up to today I had been focused on a formula for totally random numbers but I realize now that I don't need that piece and will be starting over looking for the simpler answer that I can now work with.

    Thanks, guys.

  9. #9
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,607

    Default Re: Random # generator in field rules or a button?

    Quote Originally Posted by JimGatton View Post
    And what formula do I insert in order to get my mix of alpha lower/upper case and numeric? Or where do I find the instructions will be appreciated.

    Up to today I had been focused on a formula for totally random numbers but I realize now that I don't need that piece and will be starting over looking for the simpler answer that I can now work with.

    Thanks, guys.
    http://www.alphafivewiki.com/How%20A...0Fields%20Work
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

Similar Threads

  1. (True) Random Number Generator
    By goldberg2727 in forum Code Archive
    Replies: 0
    Last Post: 01-25-2011, 04:51 PM
  2. Button Generator in Detail View
    By lfagerman in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 08-26-2010, 02:08 PM
  3. Report GENERATOR
    By DaveM in forum Archived Wishlist
    Replies: 1
    Last Post: 08-06-2010, 03:35 PM
  4. Test generator, answers in random order
    By Stan Mathews in forum Code Archive
    Replies: 0
    Last Post: 03-12-2010, 04:49 PM
  5. Using Field Rules vs Calculated Field Rules
    By MortieM in forum Alpha Five Version 7
    Replies: 11
    Last Post: 01-24-2006, 10:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •