Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Search an Array for duplicates
Message
De
22/05/2003 12:56:34
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00791559
Message ID:
00791718
Vues:
15
I am trying the For lopp, but am getting 'subscript is out of range' errors. Perhaps I need to give a little more info. The array I am trying to search is created by AFields().
I am searching for a duplicate field name in the table.
(I know it is not supposed to happen, but it is a weird thing from an EXCEL export)
so, I get the number of fields from the temp table:
lnFieldNumber = afields(laDBFInfo,'temp')

The want to use ASCAN() to find any duplicate coloumn names.
This is the section of code I have now:

if ascan(laDBFInfo,'primekey',1,lnFieldNumber,1,1) = 0
llFoundErrors = .t.
gcmessage = gcmessage + 'Required column PRIMEKEY is missing.
'
else
lnOccurs = 0
for i=1 to lnFieldNumber
if ascan(laDBFInfo,'primekey',i,lnfieldnumber,1,7) <> 0
lnOccurs = lnOccurs + 1
endif
endfor
if lnOccurs > 1
llFoundErrors = .t.
gcmessage = gcmessage + 'Duplicate column PRIMEKEY found.
'
endif

CAn anyone see what I am doing wrong here?
TIA
Amanda Morton
System Analyst
Harrisburg Project
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform