Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ascan with Objects
Message
 
 
À
23/12/2001 23:59:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00597875
Message ID:
00597886
Vues:
12
>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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform