Generate a random number and make it STAY after "save"

I searched around this forum and found that I can use this code to generate a random number:
//this.rawValue = Math.round(Math.random() * 1000000);
Works great. only problem is, once I practice on the "real" form and save, close, and reopen - it changes the random number every time. I need to figure out a way to make it save the 1st number it generates when someone opens the form and types info in it....then they save and close, etc.
Can anyone help me? Thanks!!

Example steps:
1. Add a hidden field to the same subform with name 'hiddenField'.
2. First time you open 'hiddenField' rawValue will be null.
3. where ever you run the code to generate random number use scenario like this.
if (hiddenField.isNull) {
this.rawValue = Math.round(Math.random() * 1000000);
}else {
this.rawValue = hiddenField.rawValue;
Hope this thelps.
SekharN

Similar Messages

  • How generate a random number that is between 0 and 15! (0-15)

    how generate a random number that is between 0 and 15 ??? (0-15)
    pls tell me, thx!!!!!!!!!!!!!!!!!

    import java.util.Random;
    Random r = new Random();
    int mynumber = r.nextInt()%16;
    For (2^1)-1 number use:
    -> int mynumber = r.nextInt()&15; // speedup

  • Generate random number and letter in a text field ...

    Hi All,
    I having a bit trouble when trying to generate random number and letter in application express in a text field. Say I have a licence form and when user wants to create a licence, it will provide a random licence number in the licence number field but it has to be unique. the number should be something like HQ2345. I was trying to set the following sql in default value for that text field but it is not working -
    select DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999))
    from dual;
    any suggesion !!!!
    thanks

    Put this as default value for your text-item
    DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999))
    with type PL/SQL Expression. It have tested it and it works fine.
    DickDral

  • How to Build a VI that generates a random number between 1 and 80 ....Help!!!!

    Build a VI that generates a random number between 1 and 80 
    Divides the random number by a number specified in the front panel.
    If the inputted number is zero, the VI program should turn on a LED in the front-panel to indicate a divide by zero error.
    Solved!
    Go to Solution.

    One quick question Edward, was the answer just in time for your monday morning class.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How to generate a random number with at least 6 digits?

    Hi all,
    All is in the question. :-)
    I would like to generate a random number but the function "random
    number" in Labview isn't accurate enough.
    Do you know an algorithm to generate a random number of 6 or more
    digit?
    Thanks,
    PF

    Hi PF,
    It's simple. Use 2 random number functions in the same process. Now you
    should have 2 distinct random numbers that have the same accuracy. Let's say
    LV gives accuracy up to the thousandth (0.XXX), now if you divide one number
    by 1000 and then add to the other number you should then have something like
    0.XXXXXX. Actually, LV random number function can give up to about 17 digits
    (decimal). If you are looking for more digits (>17 digits), the idea above
    may not work, then the last thing you may want try is to generate two or
    three random numbers then convert all these decimal numbers to fractional
    strings chop off the 0 and dot then concatinate them together. After all
    it's still a random number. How many digits do you want to get? Make sure
    the indicators acce
    pt that many digits?
    Good luck
    Louis.
    P-F wrote in message
    news:[email protected]..
    > Hi all,
    >
    > All is in the question. :-)
    >
    > I would like to generate a random number but the function "random
    > number" in Labview isn't accurate enough.
    >
    > Do you know an algorithm to generate a random number of 6 or more
    > digit?
    >
    > Thanks,
    >
    > PF

  • How can I create a random number and letter in a text field...

    Hi All,
    I am using application express. I want to get a random number and letter for a text field but not sure how to do this. Say I have a licence form and I want to get the licence number automatically when user wants to create a new licence and it needs to be unique. The format I am looking for is - HQ2631 something like this.
    I am thinking I have to create a trigger but not sure how to go about this....
    advanced thanks,
    Tajuddin

    Something to play with:
    Your method can generate 26 * 26 * 10000 different licence_ids
    Generating one million ids takes 20 seconds but produces between 70000 and 80000 duplicates and is rapidly getting worse (if that is something over 7%, doubling the ids generated that grows to something under 30%)
    Just see if you can live with that.
    select sum(collisions) all_duplicates,count(*) distinct_duplicates,max(collisions) max_multiple
      from (select licence_id,count(*) - 1 collisions
              from (select DBMS_RANDOM.STRING('',2) || trunc(DBMS_RANDOM.VALUE(1000,9999)) licence_id
                      from dual
                     connect by level <= :to_generate
             group by licence_id
             having count(*) > 1
           )Regards
    Etbin

  • How can you generate a random number?

    Say I have a timer, and I need it to choose a random number between 100 and 1000. How would I do that?
         timer.delay(***RANDOM***);Thanks!

    I have this, and it's working for me:
    int j = rand.nextInt(500);
    But I actually want it to generate a random number between 100 and 500, not 0 and 500. How could I do this?
    ~Dac

  • Generate a random number

    How do you generate a random number?

    You can also check out Math.random() which returns a
    double value between [0..1)You could, depending on your needs, but if you do want ints then you're better off using nextInt from java.util.Random, as outlined by the author here:
    http://java.sun.com/docs/books/effective/excursion-random.html
    (and what was wrong with 125?! I thought that was a perfectly fine random number...)

  • How do i make a tab active and make it stay that way always. If i put a website in my home page in order for the tabs to open automatically in that same homepage , this setting is not working, every time I open a tab , a white window appears .

    How do i make a tab active and make it stay that way always. If i put a website in my home page in order for the tabs to open automatically in that same homepage , this setting is not working, every time I open a tab , the window appears white .

    By default Firefox opens a blank page for a new Tab, there is no setting to change that action without installing an add-on.
    New Tab Homepage extension: <br />
    https://addons.mozilla.org/en-US/firefox/addon/777

  • How to generate a random number within a specified tolerance and control that tolerance.

    I am trying to simulate data without using a DAQ device by using a random number generator and I want to be able to control the "range" of the random number generated though.  On the front pannel, the user would be able to input a nominal number, and the random number generator would generate numbers within plus or minus .003 of that nominal number.  The data would then be plotted on a graph.  Anyone know how to do this?  Or if it's even possible?
    Just for information sake, the random number is supposed to look like thickness measurements, that's why I want to simulate plus and minus .003 because the data could be thinner or thicker than the nominal.  
    Thanks in advance!!
    Solved!
    Go to Solution.

    You can create a random number with a gaussian probability profile using two equal distributed (0...1) random numbers and applying the Box Muller transform.
    I wrote one many years ago, her it is. (LabVIEW 8.0). 
    Message Edited by altenbach on 04-12-2010 09:13 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    BoxMuller.vi ‏10 KB

  • Re: Generating a random number between 1-10;

    How do I generate a number between 1-20? I saw how to on this forum once, but I can't find it, and I don't have much time to look. Sorry for any inconvinience. What I want to do is assign to the variable x the random number.
    Thanks.
    Virum

    Random rnd = new Random();
    int x = rnd.nextInt(20)+1;

  • _dynSessConf - How to tweak logic to generate the random number.

    Hi,
    Can someone please let me know how we can tweak the logic when the random session confirmation number is generated and added as _dynSessConf.
    We have a requirement where this random number needs to be a bit longer than the currently generated default value.
    Regards,
    Saurav

    The session confirmation number used for _dynSessConf is already a randomly generated cryptographic number of long type which is hard to guess. Anyways, if you want to further modify it here is one of the approach that I can suggest.
    You can probably start with the component /atg/dynamo/servlet/sessiontracking/SessionIdGenerator in the component browser. In its details you will find it has a uniqueIdGenerator property which points to /atg/dynamo/servlet/sessiontracking/UniqueIdGenerator. Following on further it would eventually lead you to the components /atg/dynamo/service/random/SecureRandom and /atg/dynamo/service/random/SecureRandomConfiguration. Look at the service configurations of these components and see if you can get something which you can change or customize to meet your requirements.

  • How do i turn off automatic download and make it stay off

    I use the preferences in ITUNES to turn off automatic down loads and every time i start iTunes it  tries to force me to sign to an ICLOUD account and automatic download. I have tried everything I can find on apple help sites. But you Apple carefully stays away from the subject of how to make it stay off. I have 10.9.4 system
    and 11-3 (54) iTunes.

    Hello, jadetorchwood. 
    Thank you for visiting Apple Support Communities.
    Here is an article that I would recommend going through when experiencing error -50.
    iTunes Store: "Error (-50)" when downloading purchased content
    http://support.apple.com/kb/TS1583
    You can also disable automatic downloads via the steps in the article below. 
    iTunes Store: How to enable Automatic Downloads
    http://support.apple.com/kb/HT4539
    Cheers,
    Jason H. 

  • Any function generating a random number ?

    Is there any function which yields a random number every time from a given list of numbers ?
    e.g.
    Consider table t as :
    invoice_no
    123
    456
    789
    654
    321
    987
    I want a function executed manually yielding a random invoice no.
    How can i achieve ?
    Regards
    Capri !!!

    Cannot reproduce. There must be some misunderstanding.
    The selected invoices are just numbered and the required number of random positions is extracted.
    Don't know how a valid position can contain a nonexisting invoice number as (valid I presume) invoice numbers were selected before being numbered.
    I think the first version was a little unfair: The last invoice couldn't be extracted as dbms_random.value(low,high) can return low but cannot return high.
    select invoice_no
      from (select invoice_no,row_number() over (order by null) the_row
              from invoices
             where <your criteria here>
    where the_row in (select trunc(dbms_random.value(1,(select count(*) + 1 from invoices)),0)
                         from dual
                        connect by level <= :how_many_to_draw
                      )Regards
    Etbin
    In my solution I overlooked the possibility that the same invoice could be extracted more than once. So better to follow Dave's suggestion and choose MichaelS's solution
    with
    invoices as
    (select trunc(dbms_random.value(:lower_limit,:upper_limit),0) invoice_no
       from dual
      connect by level <= :number_of_rows
    select invoice_no
      from (select invoice_no
              from invoices
    --          where <your criteria here>
             order by dbms_random.value
    where rownum <= :how_manyMessage was edited by:
    Etbin

  • Generating a random password and sending a userid through mail to the user

    HI,
    I have a field named UserID in the process form,this user id can only be accessed by the GIA PROVISIONING ANALYST for updation of the userid to provision the resource to some related id of the user .I want to send this user ID from the process form in a mail to the target user,moreover i also want to include a password field nd also send a random password to the user.In short i want to obtain the values of user id and password send it in a email to the target user

    This is the body of my email template:
    Request number: <Request Information.Request ID>
    The following access has been granted:
    Name: <Request Information.List of user targets being requested for>
    ID: <User Profile Information.User Login>
    Resource: <Object Information.Object Name>
    Updated UserID:<Process Data Information.RSS User Name>
    In this case the "Updated UserID " is to be obtained from the Process Form and has to be sent in the mail.
    "RSS User Name" is the field label in the process form.when this email is sent iam not able to retrieve the values .The same statement ie."Updated UserID:<Process Data Information.RSS User Name>" is displayed in the email .
    I have even tried giving <Process Information.RSS User Name> and <Process Data Information.Process Name.RSS User Name> still the value is not obtained.Plz guide me through this.

Maybe you are looking for

  • HT204391 youtube support in ibooks author v2?

    Hi y'all I started creating an ebook in ibooks author version 1 that included a widget I found on the 'net that embedded a youtube video that played from the web. There's also http://bookry.com/author/widget/library/youtube/ widget and http://ibooksg

  • How do I update when Cloud says already updated?

    Apps would not run because of error, so I deleted them. Cloud says they are updated when actually the programs (Fireworks and Flash) have been deleted. How do I update those programs?

  • Non Stock Item- G/L accounts

    Hi , Can anyone tell me how do the consumable items/non stockable items pick or are assigned the G/L accnts.?? Thanks and Regards. Deepika

  • Download of Designer Hangs upon completion

    So that we may better diagnose DOWNLOAD problems, please provide the following information. - Server name download-east.oracle.com - Filename Oracle Designer 6i Release 4.1.1 for Windows Download the Complete Files des6ir411.zip (251,078 kb) - Design

  • Some Internet hypertext links or pop-ups not reacting

    Hi, Please, please I really need some help. I am about to throw Windows Vista and my Toshiba out the window!! For whatever reason some internet links that I try and click on - from trusted sights just don't work - I get absolutely no reaction from my