SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    May 2008
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    A couple of concerns

    First concern, I have several tests which I am trying to create 500 of a certain thing. To do this I have the following setup for my script:

    function runTest1()
    {
    Test1(499) //run this routine
    }
    function Test1(Count)
    {
    var RCSTabControl;
    var agreementTypeDetailInformation;
    var textBoxMaskBox;
    var groupControl;
    var i;
    for (i=0; i <Count +1 ;i++)
    RCSTabControl = Aliases["Aquira"]["RCSTrafficMain"]["rcsTrafficMainControl"]["TaskPanel"]["Aquira_WinControls_Agreements_AgreementsTask"]["tcNavigationControls"]["zagreementTypesPage"]["zagreementTypeNavigation"]["tcNavigation"];
    RCSTabControl["tpBrowse"]["zagreementTypeGrid"]["rcsBaseGrid"]["Keys"]("^n");
    agreementTypeDetailInformation = RCSTabControl["tpDetail"]["zagreementTypeDetailInformation"];
    textBoxMaskBox = agreementTypeDetailInformation["zshortNameTextBox"]["TextBoxMaskBox"];
    textBoxMaskBox["wText"] = ("TEST" +i);
    textBoxMaskBox["Keys"]("[Tab]");
    textBoxMaskBox = agreementTypeDetailInformation["znameTextBox"]["TextBoxMaskBox"];
    textBoxMaskBox["Keys"]("![ReleaseLast]");
    textBoxMaskBox["wText"] = "TEST";
    textBoxMaskBox["Keys"]("[Tab]");
    groupControl = agreementTypeDetailInformation["zagreementTypeVisibleValueGroup"]["groupControl"];
    groupControl["zunitsPurchasedCheckBox"]["Keys"](" [Tab]");
    groupControl["znotesCheckBox"]["Keys"](" [Tab]");
    groupControl["zfillersCheckBox"]["Keys"](" [Tab]");
    groupControl = agreementTypeDetailInformation["zagreementTypeVisibleDateValueGroup"]["groupControl"];
    groupControl["zamountCheckBox"]["Keys"](" [Tab]");
    groupControl["zspotsPaidCheckBox"]["Keys"](" [Tab]");
    groupControl["zspotsBonusCheckBox"]["Keys"](" [Tab]");
    groupControl["zspotsFreeCheckBox"]["Keys"](" [Tab]");
    groupControl["zsecondsPaidCheckBox"]["Keys"](" [Tab]");
    groupControl["zsecondsBonusCheckBox"]["Keys"](" [Tab]");
    groupControl["zsecondsFreeCheckBox"]["Keys"](" ^s");
    }

    When I run the very first test I created like this it runs just fine and creates 500 of the object I need. The problem with this script is that I get 1 object called TEST500 when it should be counting from 0 and going to 499.

    What am I doing wrong?

    Second concern, I have a script that I would like to change randomly the "zagreementTypeLookupEdit" in this script:

    function runTest1()
    {
    Test1(499) //run this routine
    }

    function Test1(Count)
    {
    var RCSTrafficMain;
    var RCSTabControl;
    var agreementDetailContainer;
    var groupControl;
    var textBoxMaskBox;
    var i;
    for (i=0; i <Count +1 ;i++)
    {
    RCSTrafficMain = Aliases["Aquira"]["RCSTrafficMain"];
    RCSTabControl = RCSTrafficMain["rcsTrafficMainControl"]["TaskPanel"]["Aquira_WinControls_Agreements_AgreementsTask"]["tcNavigationControls"]["zagreementsPage"]["zagreementNavigation"]["tcNavigation"];
    RCSTabControl["tpBrowse"]["zagreementGrid"]["rcsBaseGrid"]["Keys"]("^n");
    agreementDetailContainer = RCSTabControl["tpDetail"]["zagreementDetailContainer"];
    groupControl = agreementDetailContainer["zgeneralGroup"];
    textBoxMaskBox = groupControl["zshortNameTextBox"]["TextBoxMaskBox"];
    textBoxMaskBox["wText"] = ("TEST" +i);
    textBoxMaskBox["Keys"]("[Tab]");
    textBoxMaskBox = groupControl["znameTextBox"]["TextBoxMaskBox"];
    textBoxMaskBox["wText"] = "TEST";
    textBoxMaskBox["Keys"]("[Tab]");
    groupControl["zagreementTypeLookupEdit"]["Keys"]("[Down][Tab]");
    textBoxMaskBox = groupControl["zstartDateEdit"]["TextBoxMaskBox"];
    textBoxMaskBox["wText"] = "1/1/2010";
    textBoxMaskBox["Keys"]("[Tab]");
    textBoxMaskBox = groupControl["zendDateEdit"]["TextBoxMaskBox"];
    textBoxMaskBox["wText"] = "1/1/2011";
    textBoxMaskBox["Keys"]("[Tab]");
    groupControl = agreementDetailContainer["zvaluesGroup"];
    groupControl["znotesMemoEdit"]["TextBoxMaskBox"]["Keys"]("TEST");
    RCSTabControl["tpBrowse"]["zagreementGrid"]["rcsBaseGrid"]["Keys"]("^s");
    }
    }

    What can I put in there to make that randomly change so I can get a better test? The "zagreementTypeLookupEdit" is a dropdown list with the following: Agreements, All Values, Annual Commitments, Clubs, Gold Annual in the list.

  2. #2
    Junior Member
    Join Date
    Oct 2004
    Location
    Auckland, New Zealand
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: A couple of concerns

    I would first suggest that you use copy+paste to put code samples into your posts. It doesn't look like you did, as the first version of your Test1 function is missing the parentheses around the for loop, while the second is not. I suspect there are other things missing, because neither version should produce the result you describe. Show the code that you are actually using, then maybe someone can spot the bug.

    As for selecting a random value, you can use the ComboBox's ClickItem function to select a specific item, either by caption or by index. Generate a random number from 0-4 and use that as the index. I'm not sure of the syntax in the language you're using, but I believe it would be something like:
    var index = Math["floor"]((Math["random"]()*1000))%5;
    groupControl["zagreementTypeLookupEdit"]["ClickItem"](index);

  3. #3
    Member
    Join Date
    Oct 2004
    Location
    The Netherlands
    Posts
    270
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: A couple of concerns

    I would have a hard look at this one:

    for (i=0; i <Count +1 ;i++)

    Count is the input parameter af 499 and 1 is added to it.. making the loop run from 0 to 500... (seems to me that would explain the first problem....

  4. #4
    Junior Member
    Join Date
    May 2008
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: A couple of concerns

    Thank you, I forgot to put the brackets after the for loop. I see that now.

    I will try the math thing for the random part.

  5. #5
    Junior Member
    Join Date
    May 2008
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: A couple of concerns

    Yeah it's funny how leaving out {} would mess things up. The script was only doing what I told it to do.

    I am such a noob.

    Working on the random thing now.
    Thanks for the help.

  6. #6
    Junior Member
    Join Date
    Oct 2004
    Location
    Auckland, New Zealand
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: A couple of concerns

    >>Count is the input parameter af 499 and 1 is added to it.. making the loop run from 0 to 500... (seems to me that would explain the first problem....

    No, I don't think it does explain it. For a start, the condition is "less than", so the loop will escape as soon as i reaches 500. The more common form of this would be to pass 500 as the Count, and omit the "+1". The result is exactly the same (i goes from 0 to 499), but the intent is clearer.
    Secondly, without parentheses to define the body of the loop, I believe only the line immediately following the "for" statement is looped. That line is only an assignment with no side effects, so I cannot see how that would produce 500 instances, which is what is alleged. It seems to me that it should produce a single instance called TEST500.

  7. #7
    Junior Member
    Join Date
    May 2008
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: A couple of concerns

    Which is what did. Once iteration named Test500.
    I put the brackets around the loop and now it is working as it should.

 

 

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.71%
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 02:17 AM.

Copyright BetaSoft Inc.