Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / cant get Array Index Valid() to work

Author
Message
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 17th Jun 2009 07:41
hi

i can't get Array Index Valid() to work properly. it's supposed to return false if the index specified is not valid, but I don't know where to specify the index, as the only argument it takes is the array name. I tried Array Index Valid( Array_Name(index) ) but that never returns false, even when i know the index is invalid.

how do i prevent my array-manipulating functions from being foiled by invalid indices being passed to them??


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Jun 2009 15:25
The function doesn't do what you think it does.

Behind the scenes, DBPro maintains a 'current pointer' so that when you access an array item without specifying the index, it uses this pointer instead - 'x = MyArray()' will fetch the value from MyArray using the current pointer and put the value into x.

The ARRAY INDEX VALID simply tells you whether that pointer points to a valid item within the array.



You probably want to check your index against 0 and ARRAY COUNT():


Login to post a reply

Server time is: 2024-11-24 05:22:50
Your offset time is: 2024-11-24 05:22:50