Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search an Array for duplicates
Message
From
22/05/2003 12:56:34
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00791559
Message ID:
00791718
Views:
16
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform