SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    19
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to pass an array as argument in function

    Hi,

    Can someone please tell me how to pass array as an argument in a function. I have to check the sorting order in a web table. So I am using two functions for that.

    In one function I am storing the column value in an array and in second function i am verifying the sorting order.

    But i am not able to pass the array variable to the function.

    Below are my two functions.Can someone pls help



    Public Function Func_GetAllDataFromaColumn( ByRef rgsTest_object , ByVal sColumnName, ByRef Testitem)

    On Error Resume Next

    LogicalName=Testitem.LogicalName
    ObjectHierarchy=Testitem.ObjectHierarchy
    ObjectClass =Testitem.ObjectClass

    If ObjectHierarchy <> "" Then
    Execute "Set Test_Object ="& ObjectHierarchy ''' Creating an Object that will be used to perform the action
    End If

    iTotalRowCounts = Test_Object.getRoproperty("rows")

    ReDim arrColData(iTotalRowCounts-1)
    Dim ColData
    Dim i
    i=0

    For iRowCount= 2 to iTotalRowCounts

    arrColData(i) = Test_Object.GetCellData(iRowCount,sColumnName)
    i=i+1
    If i < iTotalRowCounts-1 Then

    ReDim preserve arrColData(i)

    End If

    Next

    ColData = arrColData(i)

    End Function


    and i am passing this ColData to function
    GetArraySortOrder(ColData)


    Thanks
    Praveen

  2. #2
    Member
    Join Date
    Dec 2003
    Posts
    43
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array as argument in function

    Can you not call the second function from within the first each time round the loop?
    This forum is about the community helping eachother. If you found the solution, say so and what it was. If you haven't, keep plugging away. Silence educates very few.

  3. #3
    Super Member
    Join Date
    Dec 2005
    Location
    USA
    Posts
    1,407
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array as argument in function

    ColData variable should be declared globally to access it out of the function scope.
    ------------
    Chikki
    when things gets harder ,the harder gets going

  4. #4
    Senior Member
    Join Date
    Aug 2006
    Location
    Montreal, Quebec, CANADA
    Posts
    106
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array as argument in function

    Replace

    ColData = arrColData(i)

    by:

    ColData = arrColData

    and call

    GetArraySortOrder(ColData())

    In the GetArraySortOrder function use Ubound(ColData) to get the size of your array.

    Thanks.

  5. #5
    Advanced Member
    Join Date
    Aug 2006
    Location
    Other side of the Computer
    Posts
    598
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to pass an array as argument in function

    Small correction here.
    <font class="small">Code:</font><hr /><pre>
    Call GetArraySortOrder(ColData) 'remove the ()

    or you can call as:
    Call GetArraySortOrder(arrColData)
    </pre><hr />
    [ QUOTE ]
    Replace

    ColData = arrColData(i)

    by:

    ColData = arrColData

    and call

    GetArraySortOrder(ColData())

    In the GetArraySortOrder function use Ubound(ColData) to get the size of your array.

    Thanks.

    [/ QUOTE ]
    ===========================================

  6. #6
    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: How to pass an array as argument in function

    Take a look at the below article as well

    http://knowledgeinbox.com/articles/v...ist-of-values/

 

 

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 9.38%
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 06:04 AM.

Copyright BetaSoft Inc.