SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Nov 2007
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Problem in writing function

    Hi,
    i was told to write a function that selects multiple items,
    that means:
    i have a list box that have 5 items, i should set a flag in such a way that if the flag is set to 2, i should be able to select 2 items similarly if the flag is set to 3 i should be able to select 3 items and so on...

    The item has unique name property and index property.
    Any help will be really appreciated.
    Regards;
    vijay

  2. #2
    Advanced Member
    Join Date
    Sep 2007
    Location
    Chennai, Tamil nadu, India
    Posts
    999
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem in writing function

    Create a function with one parameter of item index. Then directly use the parameter in selecting web list by item index method.
    i have never seen bugs sleeping

  3. #3
    Moderator
    Join Date
    Jul 2005
    Location
    Delhi
    Posts
    15,575
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    7 Thread(s)
    Total Downloaded
    0

    Re: Problem in writing function

    You can also use Array and pass the values
    <font class="small">Code:</font><hr /><pre>
    Function Test(arrBest)
    Print UBound(arrBest)
    for each sBest in arrBest
    'Process sBest
    Next
    End Function


    Call Test(Array("x","s"))

    </pre><hr />

  4. #4
    Member
    Join Date
    Nov 2007
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem in writing function

    Hi,
    I have used this way
    iOperatingSystemOptions=datatable.Value("iOperatin gSystemOptions",oSheetName)
    Select Case iOperatingSystemOptions
    Case "1"
    oPage.WebList("name:=operatingSystems").Select datatable.Value("WindowsOperatingsystem",oSheetNam e)
    Case "2"
    oPage.WebList("name:=operatingSystems").Select datatable.Value("WindowsOperatingsystem",oSheetNam e)
    oPage.WebList("name:=operatingSystems").ExtendSele ct datatable.Value("MacOperatingsystem",oSheetName)
    End Select.

    But problem over here is the other weblist has about 50 items.
    i didn't get the array function.how can this be implemented, can you please ellaborate
    Any help will be really appreciated.
    Regards;
    vijay

  5. #5
    Senior Member
    Join Date
    Mar 2009
    Posts
    184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Problem in writing function

    Have a function to which you can pass a number. That number is the number of items to select. You can either then select the first X items of the list with thsi code

    Function MultiSelect(numberToSelect)
    ' select the first item
    oPage.WebList("name:=operatingSystems").Select "#1"

    for i=1 to numberToSelect-1
    oPage.WebList("name:=operatingSystems").ExtendSele ct i
    next
    End Function

    Or select a number of random ones out of the list

    Function RandSelect(numberToSelect)
    ul=oPage.WebList("name:=operatingSystems").items.c ount
    for i=1 to numberToSelect
    oPage.WebList("name:=operatingSystems").select randomNumber(1,ul)
    next
    end function

    this may however select the same one twice.

    This is sort of pseudo code and I have not tested it....

    Peace.

 

 

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 11:40 PM.

Copyright BetaSoft Inc.