Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing DBF File Structures on the Fly
Message
 
To
10/11/1998 11:20:48
Vernon Moeller
Texas Adjutant General's Department
Austin, Texas, United States
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00156177
Message ID:
00156192
Views:
36
>In addition to working in FPW2.6, I also use a product called Monarch which I feed printouts into, and it extracts data from them and sticks the data into a DBF file.
>
>Unfortunately, Monarch often misinterprets data. It will look at 2 character fields separated by a slash (/) and, since they contain only numbers, create 2 numeric fields. Then it will look at a transaction amount field, clearly numeric because of the dollar sign and decimal point in it, and because the dollar sign is not a number, create a character field.
>
>Then, since I am running Monarch as part of a "batch" file, when I get back into FPW, of course, nothing prints out or calculates correctly.
>
>So my question is this: is there any way I can create code which will automatically open my DBF and change some of its numeric fields to character and vice-versa without losing my data? When Monarch writes the new DBF, it will overwrite a file with the same name even though that file (the old one) has the correct format, so setting up something in advance won't work. Of course, I can do this manually, but with all the reports our people run, I don't want to sit there changing field types all day long.
>
>And this is a real long-shot question, but do any of you know of a product out there that works like Monarch but doesn't have this glitch where it reads character fields as numeric and vice-versa?
>
>Thanks for whatever help you may have to offer!
>
Hiya Vernon,

Change fields on the fly? How about this...Open your table, issue a call to AFIELDS(), do an ASCAN for the field name (be care about the setting for EXACT here) to locate the field name if need be. Then change the second column from numeric to character ('N' to 'C'). Next issue a CREATE CURSOR whatever FROM ARRAY amyarray, and append in the text file.

BTW, sorry I haven't gotten back with you regarding your last email. Been very busy.

hth,
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform