Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ascan with Objects
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00597875
Message ID:
00597886
Views:
15
>Hello All,
>
>I have a puzzling question. I have an array of objects which I am using as a sort of Matrix. Say I have an object an I want to determine if it is in the array and if so return the element of the array. According to the Hacker's Guide I cannot use Ascan for Objects. Does anyone know of another way to call Ascan (or something similar) with out having to create a second array?
>
Hi Matt,

You can loop thru array and check for an object
lnItem = 0
loObject = ...  && Object to search for
FOR i=1 TO ALEN(laMtarray)
  IF laMtarray[i] = loObject 
    lnItem = i
    EXIT
  ENDIF
ENDFOR

IF lnItem > 0
  * The object is in array and it's lnItem
ELSE
  * The object isn't in array
ENDIF
If array is 2-D you can get row and column using ASUBSCRIPT( ) Function.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform