forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Parsing problems
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
moke
Contributor
Contributor


Joined: 02 Jan 2002
Posts: 162

PostPosted: Fri Dec 13, 2002 7:33 pm    Post subject: Reply with quote

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 Smile

moke
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Dec 13, 2002 9:05 pm    Post subject: Reply with quote

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.... Confused

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? Confused

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Fri Dec 13, 2002 10:26 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Dec 13, 2002 10:32 pm    Post subject: Reply with quote

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... Wink

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
SnarlingSheep
Professional Member
Professional Member


Joined: 13 Mar 2001
Posts: 759
Location: Michigan

PostPosted: Sat Dec 14, 2002 6:24 am    Post subject: Reply with quote

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 Wink

_________________
-Sheep
My pockets hurt...
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Dec 14, 2002 6:39 am    Post subject: Reply with quote

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. Confused

LOL, being clearly outvoted however, I surrender. Razz Laughing

I'll move this to the Bug Reports forum. Wink

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
cnodnarb
Professional Member
Professional Member


Joined: 11 Sep 2002
Posts: 767
Location: Eastman, GA

PostPosted: Sat Dec 14, 2002 4:06 pm    Post subject: Reply with quote

Mac the Mammoth falls under the weight of the pack of sabre toothed VDS users and a snarling sheep Laughing

NodNarb

(Sorry, been having to watch "Ice Age" with my kids too much I guess)
Back to top
View user's profile Send private message AIM Address
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1566

PostPosted: Sat Dec 14, 2002 6:35 pm    Post subject: Reply with quote

[post overwritten on accident]
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Dec 14, 2002 7:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Dec 14, 2002 8:23 pm    Post subject: Reply with quote

Ah gees!!!! How did I end up writing over PK's post????

-Garrett
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Dec 14, 2002 8:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Dec 14, 2002 10:12 pm    Post subject: Reply with quote

Show 'em on separate lines and it makes more sense
Garrett. Each parsed item is still trimmed because it
doesn't see the quotes... Wink
__________________________________________________________________________________________________________________________
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 Smile

_________________
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
View user's profile Send private message Send e-mail
Tommy
Admin Team


Joined: 16 Nov 2002
Posts: 746
Location: The Netherlands

PostPosted: Sat Dec 14, 2002 10:14 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Sat Dec 14, 2002 10:32 pm    Post subject: Reply with quote

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... Confused

Cheers, Mac Smile

_________________
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
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Dec 14, 2002 10:38 pm    Post subject: Reply with quote

Here we go again.... Confused
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Bug Reports All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group