I have an urgent need to import a csv file and some of the data has
trailing spaces which I have to retain and later use this data intact
by sending it to a printer.

Every time I import the data I lose the trailing spaces.

An example of the file with 6 fields is below:

IDNO, LNAME, FNAME, code1, code2, code3
1033501, ALEXANDER, JOHN,1,PAQVSBUJA0 .9W20.WPSUG8J7P9YA,15071
1007267, ALEXANDER, BILL,1,PA1QSBUJA0 .9W-.V0PSUG8J7P7ZU,31910
1032692, ALEXANDER, JEAN,2,PAQVSBUJA0 .9W-9.-ZSUG8J7RGT9,32216
1032027, ALEXANDER, PAUL,1,PAQVSBUJA0 .9W2ERYPSUG8J7R - ,12386

Note that the code 3 field sometimes has a record with a trailing space
(see last record)


Can anybody advise how I should go ?

Thanks.

Re: Import csv file and keep trailing spaces - URGENT REQUEST by Stefan

Stefan
Wed Nov 01 06:08:46 CST 2006

A VarChar type seems to keep the trailing space in the
"something" field of the last row for me.
CREATE CURSOR temp ;
(id c(10), surname c(20), firstname c(20), ;
otherid c(10), something varchar(50), thirdid c(20))
APPEND FROM GETFILE() TYPE CSV
BROWSE


hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------

<sbs@sensibus.com.au> schrieb im Newsbeitrag
news:1162378353.843481.290960@h48g2000cwc.googlegroups.com...
>I have an urgent need to import a csv file and some of the data has
> trailing spaces which I have to retain and later use this data intact
> by sending it to a printer.
>
> Every time I import the data I lose the trailing spaces.
>
> An example of the file with 6 fields is below:
>
> IDNO, LNAME, FNAME, code1, code2, code3
> 1033501, ALEXANDER, JOHN,1,PAQVSBUJA0 .9W20.WPSUG8J7P9YA,15071
> 1007267, ALEXANDER, BILL,1,PA1QSBUJA0 .9W-.V0PSUG8J7P7ZU,31910
> 1032692, ALEXANDER, JEAN,2,PAQVSBUJA0 .9W-9.-ZSUG8J7RGT9,32216
> 1032027, ALEXANDER, PAUL,1,PAQVSBUJA0 .9W2ERYPSUG8J7R - ,12386
>
> Note that the code 3 field sometimes has a record with a trailing space
> (see last record)
>
>
> Can anybody advise how I should go ?
>
> Thanks.
>


Re: Import csv file and keep trailing spaces - URGENT REQUEST by sbs

sbs
Wed Nov 01 06:27:37 CST 2006

Thanks, Stefan.

This seems to work fine in VFP 9.

The app is currently in VFP8. Is there any way to achieve this in VFP8?



On Nov 1, 11:08 pm, "Stefan Wuebbe" <stefan.wue...@gmx.de> wrote:
> A VarChar type seems to keep the trailing space in the
> "something" field of the last row for me.
> CREATE CURSOR temp ;
> (id c(10), surname c(20), firstname c(20), ;
> otherid c(10), something varchar(50), thirdid c(20))
> APPEND FROM GETFILE() TYPE CSV
> BROWSE
>
> hth
> -Stefan
>
> --
> |\_/| ------ ProLib - programmers liberty -----------------
> (.. ) Our MVPs and MCPs make the Fox run....
> - / See us atwww.prolib.deorwww.AFPages.de
> -----------------------------------------------------------
>
> <s...@sensibus.com.au> schrieb im Newsbeitragnews:1162378353.843481.290960@h48g2000cwc.googlegroups.com...
>
>
>
> >I have an urgent need to import a csv file and some of the data has
> > trailing spaces which I have to retain and later use this data intact
> > by sending it to a printer.
>
> > Every time I import the data I lose the trailing spaces.
>
> > An example of the file with 6 fields is below:
>
> > IDNO, LNAME, FNAME, code1, code2, code3
> > 1033501, ALEXANDER, JOHN,1,PAQVSBUJA0 .9W20.WPSUG8J7P9YA,15071
> > 1007267, ALEXANDER, BILL,1,PA1QSBUJA0 .9W-.V0PSUG8J7P7ZU,31910
> > 1032692, ALEXANDER, JEAN,2,PAQVSBUJA0 .9W-9.-ZSUG8J7RGT9,32216
> > 1032027, ALEXANDER, PAUL,1,PAQVSBUJA0 .9W2ERYPSUG8J7R - ,12386
>
> > Note that the code 3 field sometimes has a record with a trailing space
> > (see last record)
>
> > Can anybody advise how I should go ?
>
> > Thanks.- Hide quoted text -- Show quoted text -


Re: Import csv file and keep trailing spaces - URGENT REQUEST by Bernhard

Bernhard
Wed Nov 01 07:22:47 CST 2006

Hi sbs,

> This seems to work fine in VFP 9.
>
> The app is currently in VFP8. Is there any way to achieve this in VFP8?
A field of type C is allways padded with spaces so that the field is completely
filled. So I wonder, how you loose trailing spaces on import. There is merely
the other problem: how to distinguish padded spaces from "wanted" spaces (which
is not possible with C fields).


Regards
Bernhard Sander

Re: Import csv file and keep trailing spaces - URGENT REQUEST by Stefan

Stefan
Wed Nov 01 08:34:30 CST 2006


<sbs@sensibus.com.au> schrieb im Newsbeitrag
news:1162384057.274014.84960@b28g2000cwb.googlegroups.com...
> Thanks, Stefan.
>
> This seems to work fine in VFP 9.
>
> The app is currently in VFP8. Is there any way to achieve this in VFP8?

In addition to Bernhards comment, I'd try Memo fields to store trailing
spaces. The "Append " part would not work directly, but you can
oc read the import file via FOpen(), FRead() etc. or use FileToStr()



hth
-Stefan



--
|\_/| ------ ProLib - programmers liberty -----------------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de or www.AFPages.de
-----------------------------------------------------------


Re: Import csv file and keep trailing spaces - URGENT REQUEST by sbs

sbs
Wed Nov 01 15:01:47 CST 2006

Thanks guys for your help.

I'll see how I go.


On Nov 2, 1:34 am, "Stefan Wuebbe" <stefan.wue...@gmx.de> wrote:
> <s...@sensibus.com.au> schrieb im Newsbeitragnews:1162384057.274014.84960@b28g2000cwb.googlegroups.com...
>
> > Thanks, Stefan.
>
> > This seems to work fine in VFP 9.
>
> > The app is currently in VFP8. Is there any way to achieve this in VFP8?In addition to Bernhards comment, I'd try Memo fields to store trailing
> spaces. The "Append " part would not work directly, but you can
> oc read the import file via FOpen(), FRead() etc. or use FileToStr()
>
> hth
> -Stefan
>
> --
> |\_/| ------ ProLib - programmers liberty -----------------
> (.. ) Our MVPs and MCPs make the Fox run....
> - / See us atwww.prolib.deorwww.AFPages.de
> -----------------------------------------------------------