Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subscript
Message
From
15/11/2021 19:31:07
 
 
To
12/11/2021 15:46:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01682701
Message ID:
01682725
Views:
88
>Just stepped through. i think the value is greater than the size of the array. When i step through it at the catch error, it shows adv as numeric 48, and the afield amount is 49. There are only 48 fields/columns in the spreadsheet I am trying to import.
>
To eliminate such uncertain areas, either guard with if or use Assert, which was added in the more current (cough) vfp versions.

Also ALWAYS better in vfp to prefix memory variables with mDot ("m.") when accessing / reading them, as vfp will access a table field with the same name, if such exists in currently selected table.

Vfp has some of such weird angles and corners unexpected even by seasoned programmers fluent in other languages -
if you have to maintain for longer stretches of time, buying a few of the Hentzenwerke classics will explain some of the "weird" stuff and time invested will be well spent. The Hackers Guide by Tamar as basic, KiloFox by Marcia and Andy to "grok" ideas, concepts and controls of vfp up to vfp6, MegaFox if you have many external tools (esp. COM based) to maintain, What's new in 8/9 to grok the later offerings like Cursoradapter, Event Binding and more.

Some of the stuff is available online for free - I think "concept stuff" is easier to handle on paper first, then read again by jumping in electronic format, but I am weird as well. Spending time with those books/articles will speed you up if your task goes on for more than 2 or 3 weeks.

As a side effect your code will be less ambiguous for readers here, better flashing out real problem.

my 0.02€ and regards
thomas

>
>>
>>IF ALEN(aDV, 1) = 0
>>    FOR nIdx = 1 TO nCFldCnt
>>        nField = cCFlds[nIdx]
>>        IF aDV[nField]==["]  && wgcs
>>            * Remove surrounding quotes
>>
>>            aDV[nField] = SUBSTR( aDV[nField], 2, LEN(aDV[nField])-2 )  && wgcs
>>        ENDIF
>>    ENDFOR
>>ENDIF
>>
>>
>>You're retrieving value nField from array cCFlds (the value I presume is numeric) -- are you absolutely sure that the value you're obtaining isn't less than 1 or is greater than the size of the array aDV ?
Previous
Reply
Map
View

Click here to load this message in the networking platform