Exabytes beginner

Wednesday, June 27, 2007

Convert elements in multidimensional array to single dimensional array

function to_single_array(aelement,arr_col)
' convert multidimension array to single array
if isarray(aelement) then
for i=0 to ubound(aelement,2)
strval=strval & aelement(arr_col,i) & ","
next
strval=left(strval,len(strval)-1)
to_single_array=split(strval,",")
'response.write strval & "strval"
end if
end function

aelement is the name of multi dimensional array while arr_col is the column number which we want to converts into single array
this is the example of the multidimensional array

tr>


NameAge


Amy Jefferson

17




Mark Tan

25




John Grissam

29



Kathleen Rowling

35




so if the array name is ainfo, the way to extract the name into a single dimension array is
ainfo2=to_single_array(ainfo,0)

ainfo2 elements to will be:

Amy Jefferson
Mark Tan
John Grissam
Kathleen Rowling

any errors or feedback forward it to : nor@melur.com

No comments:

Post a Comment