| View previous topic :: View next topic |
| Author |
Message |
moke Contributor

Joined: 02 Jan 2002 Posts: 162
|
Posted: Fri Dec 13, 2002 7:33 pm Post subject: |
|
|
I think we have 2 issues here.
1. Does the parse command removal of spaces constitute a bug?
2. Is there a standard when creating CSV's? And does it include spaces.
I already stated my opinion for #1
As for number 2; After further testing with Access and Excel here's what I found:
Access DOES include quotes when exporting to CSV but only on fields
with a text property. All other fields export without quotes.
Excel DOES NOT include quotes regardless of cell formatting.
I think we can safely conclude that there is no REAL standard (although
there must be a CSV standards committee somewhere with a different
opinion). I must also admit that using quotes on text fields is probably a
good practice to use and I will be changing my code and repenting the
errors of my ways.
Amen & Alleluia
moke |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Dec 13, 2002 9:05 pm Post subject: |
|
|
| Tommy wrote: | On my opinion:
I think it is indeed a bug that the parse command removes the spaces even if you use
quotes (").
|
OK - I must be really dense....
It makes perfect sense to me that using standard quotes
in a parsable string doesn't retain spaces. PARSE never sees
them, because standard quotes cannot be added to a string
(although they are seen when loaded from a file). And using
@chr(34) works fine, because it actually puts the quotes in the
string.
Also, a single set of quotes around the whole string (which
must be added with @chr(34), remember?), makes the string
a single text string. In other words, the field separators are
counted as text along with the rest of the string.
Fields are separate data items, and for each field to be
treated separately, the quotes must be added around each
field...
Doesn't this make sense to anyone else?
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Fri Dec 13, 2002 10:26 pm Post subject: |
|
|
You really can't count on the parsed fields to be surrounded by quotes, that quite defeats
the purpose of parse (parse splits based on one character (eg. |), not three characters ("|")).
Like Prakash already mentioned, PARSE was never specifically meant for parsing CSV files.
I think the main reason for parse is parsing field separated values, such as the values
returned by @DLGPOS(). Never I've seen VDS's field separated values to be surrounded by
@CHR(34). So I still think it's a bug. |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Dec 13, 2002 10:32 pm Post subject: |
|
|
Well, without quotes, the field separator character can
never be included as text. Otherwise it will parse there.
And hopefully I made clear the reason for @chr(34) instead
of standard quotes...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Sat Dec 14, 2002 6:24 am Post subject: |
|
|
In just about any other language you would have to have quotes around a string. These quotes wouldn't really be passed to the commands or displayed when used in static text elements, something like @CHR(34) would have to be used.
Using DIALOG SET,Text1,"Test" doesn't show the quotes around Test..why should PARSE be any different really?
We are talking about PARSE removing spaces though..it doesn't seem like it should do that.
I agree with you for the most part Mac, but the bottom line is PARSE removes spaces you are trying to preserve. I'm a firm believer in not having to "work around" things in something you pay for.
Sorry to gang up on ya but I figured I'd speak my 2 cents..now I'm broke so I'll be off  _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Dec 14, 2002 6:39 am Post subject: |
|
|
Well, PARSE only removes spaces in the same manner
as assigning any other value to a variable - without
quotes, leading and trailing spaces are omitted.
LOL, being clearly outvoted however, I surrender.
I'll move this to the Bug Reports forum.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
cnodnarb Professional Member


Joined: 11 Sep 2002 Posts: 767 Location: Eastman, GA
|
Posted: Sat Dec 14, 2002 4:06 pm Post subject: |
|
|
Mac the Mammoth falls under the weight of the pack of sabre toothed VDS users and a snarling sheep
NodNarb
(Sorry, been having to watch "Ice Age" with my kids too much I guess) |
|
| Back to top |
|
 |
PGWARE Web Host

Joined: 29 Dec 2001 Posts: 1566
|
Posted: Sat Dec 14, 2002 6:35 pm Post subject: |
|
|
| [post overwritten on accident] |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Dec 14, 2002 7:47 pm Post subject: |
|
|
| Tommy wrote: | You really can't count on the parsed fields to be surrounded by quotes, that quite defeats
the purpose of parse (parse splits based on one character (eg. |), not three characters ("|")).
Like Prakash already mentioned, PARSE was never specifically meant for parsing CSV files. |
You know, I'm almost sure that I've used more than one character before
in the option fieldsep. I'll have to try that and see.
Actually, PK was only stating an opinion on whether or not Parse had CSV
in mind at all. And when I brought that up, I ony said that *maybe* csv
was in mind with the Parse.
Niether PK, Tommy nor I can confirm this.
-Garrett |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Dec 14, 2002 8:23 pm Post subject: |
|
|
Ah gees!!!! How did I end up writing over PK's post????
-Garrett |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Sat Dec 14, 2002 8:24 pm Post subject: |
|
|
| Code: |
option fieldsep,[
%A = |" hello [|" world [|" ok |"
parse "%%part1;%%part2;%%part3", %A
info @len(%%part1)/@len(%%part2)/@len(%%part3)@cr()%%part1 - %%part2 - %%part3
|
Well, I'm thinking there is a bug now. Try the above code and watch
what happens.
-Garrett |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Dec 14, 2002 10:12 pm Post subject: |
|
|
Show 'em on separate lines and it makes more sense
Garrett. Each parsed item is still trimmed because it
doesn't see the quotes...
__________________________________________________________________________________________________________________________
| Code: |
option fieldsep,[
%A = |" hello [|" world [|" ok |"
parse "%%part1;%%part2;%%part3", %A
info @len(%%part1)/@len(%%part2)/@len(%%part3)@cr()@cr()>%%part1<@cr()@cr()>%%part2<@cr()@cr()>%%part3<
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Tommy Admin Team
Joined: 16 Nov 2002 Posts: 746 Location: The Netherlands
|
Posted: Sat Dec 14, 2002 10:14 pm Post subject: |
|
|
What I think is there's no need for parse to see the quotes at all, as long as it is able to
"see" the separator character. |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Sat Dec 14, 2002 10:32 pm Post subject: |
|
|
Well, PARSE only does two things:
1. Captures the portion of the string between two separators.
2. Assigns that portion to a variable (in the same way other
values are assigned to vars).
Apparently (most) everyone thinks it should assign values in
a different manner than usual. I just haven't figured out why...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Dec 14, 2002 10:38 pm Post subject: |
|
|
Here we go again....  |
|
| Back to top |
|
 |
|