SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Sep 2005
    Location
    india
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How can i call twice a function with different time stamps

    Hi folks,

    I have written a function and i am calling that function in my scripts 2 to 3 times, it is a registration form and function to create id based on time format. The very first time it is okay but the second time when i am calling to created id it is displaying same id as first created.But the id must be unique in my form for every time.. How can i use or change to call same function in different test cases and it should return current time stamp.. Thanks in advance

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Location
    delhi
    Posts
    184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can i call twice a function with different time stamps

    I could not make out where might be error in you code unless you post it...If you want to have randome values all the time, here is the code

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[-] main ()
    [ ] string sFileName
    [ ] sFileName = GetRandomName (&quot;Masiha&quot
    [ ]
    [ ] Print (sFileName)
    [ ]
    [-] string GetRandomName (string sInitial)
    [ ] integer iSecond
    [ ] string sRandomValue , sTemp
    [ ] DATETIME DayAndTime
    [ ]
    [ ]
    [ ] DayAndTime = GetDateTime ()
    [ ] iSecond = Val (FormatDateTime (DayAndTime, &quot;ss&quot)
    [ ]
    [ ] RandSeed (iSecond)
    [ ] sTemp = sInitial + Str (Abs (RandInt (9, 9999999999999)))
    [ ]
    [ ] RandSeed (iSecond + 10)
    [ ] sRandomValue = sTemp + Str (Abs (RandInt (9, 99999999999999)))
    [ ]
    [ ] return sRandomValue</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">

  3. #3
    Member
    Join Date
    Sep 2005
    Location
    india
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can i call twice a function with different time stamps

    Hi Mahisha,

    This is my code
    [ ] STRING FIRSTNAME=Create_Name()
    [ ] STRING LASTNAME=Create_Name()
    [ ]
    [ ]
    [-] string Create_Name()
    [ ] DATETIME DayAndTime
    [ ] DayAndTime=GetDateTime()
    [ ] // format current date and time
    [ ] String sTime=FormatDateTime(DayAndTime, "hh_nn_ss")
    [ ] String sDate=FormatDateTime (DayAndTime, "mm_dd_yy")
    [ ] String sName="jaggu"+sDate+sTime
    [ ] return(sName)

    I am calling 2 times this function but it is replacing same time in the text box... I have to create so many registrations with different time stamps..( why because that id should be unique) otherwise it will show errors. hope you got my problem now...

    Thanks in advance
    Temru

  4. #4
    Senior Member
    Join Date
    Feb 2003
    Location
    Romania
    Posts
    163
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can i call twice a function with different time stamps

    Hi Temru,

    Your code is executed under a one second.
    Put a sleep(1) between
    [ ] STRING FIRSTNAME=Create_Name()
    [ ] STRING LASTNAME=Create_Name()

    and the returned values will be different.

    With regards
    nelumoldovan49

  5. #5
    Advanced Member
    Join Date
    Oct 1999
    Location
    Chicago, IL
    Posts
    652
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can i call twice a function with different time stamps

    If this is a value for a specific window, you can also make this "time-stamped" name a SilkTest property saving off the last value each time you generate it. Then in your Get() method of the property, loop through generating with a new timestamp until it is different from the old one. That way, you don't have to hard-code a specific sleep time if you don't want to.

  6. #6
    Member
    Join Date
    Sep 2005
    Location
    india
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can i call twice a function with different time stamps

    Hi nelumoldovan,

    yaa sleep is working fine..I will try for Brain comments also .. Thanks to all

    Temru

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 12:21 PM.

Copyright BetaSoft Inc.