Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
COPY TO...DELIMITED bug?
Message
From
23/10/2006 04:03:45
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
20/10/2006 16:42:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01163003
Message ID:
01163880
Views:
15
Hi Fabio,

BOK.

Now let me answer.
The first is a small problem with varchar itself.
O.k I understand now that additional spaces not mean trailing spaces for varchar.
Something new to me thanks for the clarification.
I understand that this is by design - but in the very same moment I feel that I'm not to happy with. I can see good and bad sides on this.

I'm still at the point that that all output to CSV/SDF should go without any space on the left site of the last non space sign. At least for character field type. I own that for varchar way the field on non exports acts a export of entered spaces make some sense. But I think that behaviour must be mentioned on COPY TO's help and on behaviour change too. If I would use DELIMITED WITH BLANK, I would be very puzzled. Wouldn't you? (I do not do this)


Agnes

>>Hi Fabio,
>>
>>after playing a little bit more I have
>>
>>CREATE CURSOR test1 (c1 c(1),v1 v(1),v3v v(4) DEFAULT 'v ',v3e v(3),c3v c(3) DEFAULT 'v  ',c3e c(3),i I)
>>APPEND BLANK
>>COPY TO test1.txt DELIMITED WITH "" WITH CHARACTER "|"
>>MODIFY FILE test1.txt
>>
>>
>>My return is
>>
>> ||v ||v||0
>>
>>
>>I think the result is a wrong because
>>wrong use of CSV
>>csv is without trailing spaces. if we would have trailing spaces on an CSV file its mostly the same as a SDF, we would waste a lot of space for nothing
>>wrong use of types
>>VFP fieldtypes have no meaning in CSV so CHAR and VARCHAR should be stored in the same way.
>>the result is not consitent
>>some times we get spaces, sometimes not
>>the result is not consitent even if we consider that it may have different results for differnt VFP field types.
>>Character is sometimes trimmed and sometimes not
>
>>Varchar is sometimes trimmed and sometimes not
>
>where do you see this?
>v1='' is not trimmed,
>v3v='v ' is not trimmed
>v3e='' is not trimmed
>
>
>CREATE CURSOR test1 (c1 c(1),v1 v(1),v3v v(4) DEFAULT 'v ',v3e v(3),c3v c(3) DEFAULT 'C  ',c3e c(3),i I)
>APPEND BLANK
>COPY TO test1.txt DELIMITED WITH "" WITH CHARACTER "|"
>
>DEFINE WINDOW output AT 0,0 SIZE 10,50 IN DESKTOP FONT "Courier New",20 CLOSE
>MOVE WINDOW output CENTER
>
>ACTIVATE WINDOW output
>
>? "RECORD DATA"
>LOCATE
>? C1+"|"+V1+"|"+v3v+"|"+v3e+"|"+c3v+"|"+c3e+"|"+TRANSFORM(I)
>? "DELIMITED"
>? FILETOSTR("test1.txt")
>? "SDF"
>COPY TO test1.txt TYPE SDF
>? FILETOSTR("test1.txt")
>
>
>>the result is missleading
>>for VARCHAR, why we get one trailing space if we have two in reality?
>
>IT IS ONE!
>
>>If we consider that the result will somehow show the VFP fieldtype than it does the wrong way
>>VARCHAR gets the trailing spaces and CHAR is trimmed
>>
>>BTW:
>>COPY TO ... CSV generates the same result
>>
>>Agnes
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Reply
Map
View

Click here to load this message in the networking platform