Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic array

Status
Not open for further replies.

SirEddy

Programmer
Oct 24, 2005
10
US
I am a bit lost here and think I did something like this in the past. Say I have array that I want to call the record length as follows:

dataRecords = data_fish.length
or
dataRecords = data_dogs.length

But I want to have a function to dynamicaly call the length but want to use variables like:

recordCatagory = fish
getLength(recordCatagory)

function getLength(recordCatagory) {
arrayToCall= "data_" + recordCatagory
dataRecords = arrayToCall.length
}

Is it possible?
 
That won't work because arrayToCall is a string. If you want to find the length of a string you must use Len() but I don't think that is what you want to do...
 
I think what you want to do is recordCatagory.length. You should be able to do this if recordCatagory is an array.
 
Actually, I'm sorry. I'm getting javascript and vbscript mixed up. Try using UBound(array) + 1
 
Actually, I'm really messed up. For some reason I thought this was the vbscript forum. You probably shouldn't listen to anything I said. I think I need to get some sleep...
 
ok no one else reply to this thread cause I am going to repost it. And thanks griity for your help. Go get some sleep. LMAO.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top