Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy from a Cursor to text file
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01540524
Message ID:
01540530
Views:
37
>>>Hi,
>>>
>>>I need (customer actually) to store data from a cursor into a text file delimited with tab. When use command COPY as
>>>
>>>
>>>SELECT MYCURSOR
>>>COPY TO MyText.TXT DELIMITED WITH TAB
>>>
>>>
>>>the content of MyText.txt shows each value in quotation marks. My understanding is that the customer wants the data to be in columns of certain length (for each column) and then tab between each column. For example, here is how I think he wants the data:
>>>
>>>
>>>3934447      04/06/2012    100.00       M34444       This is description of item              ABCD            33333
>>>                                                                                 from memo field
>>>
>>>
>>>Note that all column above (except the one showing date and 100.00 are coming from Character fields. How can I output/store a cursor in the above-type format?
>>>
>>>I would appreciate any suggestions.
>>
>>Try
>>
>>
COPY TO 'TabDelimitedFile.txt' DELIMITED WITH "" WITH CHARACTER TAB
>
>Thank you very much. It works! The only thing (and it is not a big deal) is I am trying to figure how to make the first column (which comes from a char field of 15 characters) is aligned to the max width. That is, in my test, the second column (date) is indented from the left margin according to the actual value in the first column.

Hmm, one possibility (I guess) is to append some invisible character that looks like space, e.g. in the cursor instead of select myCharField have something like

select(padr(myCharFiled, 15, chr(7)) && pick the right character here.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform