Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Translating txt file (from scanner) to records in VFP 6
Message
From
14/08/2002 15:29:24
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
14/08/2002 14:22:57
Lynette Tillner
Associated Valuation Services
Modesto, California, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00689678
Message ID:
00689703
Views:
33
It seems to me that, since this is no standard text-format, you have to read the data line-by-line, and write a little program to convert it to the desired format.

In VFP6, you can read an entire text-file with FileToStr(), and convert the result to an array (one element per line) with alines().

If you have an older version of VFP, or expect some files to exceed the array limitations (65000 elements / rows), you can use fopen(), fgets() and fclose() instead.

HTH, Hilmar.

>I have scanned barcode data that I need to make single records out of.
>It's easy enough to move import the text file into one field (A)and move the data to separate fields (B)
>
>But my question is, once I have the data in separate fields, how do I fill that for each record to look like (C)
>Any pointers in the right direction would be greatly appreciated!
>
>See example:
>
>(A) The text file format is:
>
>$Site%130
>$RM%999
>$DATE%MMDDYY
>$QTY%1
>99999
>99998
>99997
>99996
>$RM%990
>$DATE%MMDDYY
>$QTY%1
>99995
>99994
>etc.....
>
>(B) I end up with :
>
>IMPORT --- SITE ----ROOM --- DATE ----- QTY ------ TAG
>$SITE%130 130
>$RM%999 999
>$DATE%MMDDYY MMDDYY
>$QTY1 1
>99999 99999
>99998 99998
>99997 99997
>99996 99996
>$RM%990 990
>$DATE%MMDDYY MMDDYY
>$QTY1 1
>99995 99995
>99994 99994
>
>(C) and what I need is:
>
> 130 999 MMDDYY 1 99999
> 130 999 MMDDYY 1 99998
> 130 999 MMDDYY 1 99997
> 130 999 MMDDYY 1 99996
> 130 990 MMDDYY 1 99995
> 130 990 MMDDYY 1 99994
>
>Thanks!
>
>Lynette
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform