Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy to Text File to Retain Trailing Spaces
Message
 
To
08/01/2003 17:12:48
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00739440
Message ID:
00739664
Views:
25
Steve,

I think it would be a good idea for me to explain the scenario in real terms.

Let's say that the app VFP is a purchase order system. There are headers, details and the header might have a free form note (MEMO).
When the data is imported into the existing accounting package (written in another language with no source) it must be in ASCII format.
The accounting app wants the data as follows:
Header
Detail
Detail
Note (in 50 characters segments, if there is one)

The train of thought that we are working on at the moment is:
Extract all of the headers we need into header.dbf, details into detail.dbf and the 50 character segments into multiple records in notes.dbf.

Then issue:

select header
scan
Copy to header.txt next 1 delimited && header
select detail
copy to detail.txt for detail.ponum = header.ponum delimited && details
select notes
copy to notes.txt for notes.ponum = header.ponum delimited && notes
select curmemo && dummy file used for a memo
zap
append blank
Append Memo curmemo.memo1 From header.txt
Append Memo curmemo.memo1 From detail.txt
Append Memo curmemo.memo1 From notes.txt
Fwrite(lnhandle,curmemo.memo1) && add to ASCII File
select header
endscan

I am wondering if the code is efficient?
Also, based upon all of this info... what is the best way to handle the memo field assuming that I want to retain spaces?

TIA.



>Allan,
>
>Are there other fields (non-memo) being exported into the same text file? If so, and if the memo field for a given record is longer than 50 characters, how are the other fields supposed to be represented in the export file?
>
>As an example, lets assume the user types 78 characters (not all spaces) in the memo field. Do you need 2 records (lines) in the export file?
>
>>Steve,
>>
>>The scenario is as follows:
>>We have developed an application that allows the user to enter free form notes (stored in VFP MEMO).
>>Our application has to be able to 'export' our data to the end user's accounting app in an ASCII format.
>>They would like this MEMO field to be segmented into 50 character records in the ASCII file.
>>Now, if the user (in our VFP app) enters 50 or more consecutive spaces, that
>>portion of the memo creates a record with "" in the ASCII file.
>>I would like to be able to retain these spaces.
>
>>>Why is the empty string a problem?
>>>
Regards,

Allan Coganovitch
allanc@proven-solutions.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform