Using a comma as a delimiter with the seperate command

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
D_S
Junior Coder
Posts: 32
Joined: Sun Apr 24, 2005 6:43 pm

Using a comma as a delimiter with the seperate command

Post by D_S » Thu Jul 07, 2005 12:19 am

Am trying to use seperate with a comma delimiter and it's not working properly, the code is shown below (I'm using 7.3.11.4). If I change the delimiter to a semi-colon it works every time but the input is going to come from a 2d scan that will have data seperated by commas. Tried using a percent around the middle comma in the seperate command and I got the same results.

When run, I key in the following D123456,P98765,Q50. Instead of seeing the data in the message modal and message box I see the variable names. Anyone see what I've missed? Thanks

Input>files,Please scan now ...
Separate>files,,,names
MessageModal>Num Files: %names_count%
Message>%names_1%%CRLF%%names_2%%CRLF%%names_3%%CRLF%
Label>end

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jul 07, 2005 1:39 am

I have duplicated your problem also.

I have used period, semi-colon, tilde, pipe characters, hard coded and as a variable, all work OK.

But using a comma does not work.

Code: Select all

Let>files=D123456,P98765,Q50
Let>Break=,
Separate>files,%Break%,names
MessageModal>Num Files: %names_count%
Message>%names_1%%CRLF%%names_2%%CRLF%%names_3%%CRLF%
Label>end
Looks like you may need to do a global replace first changing the comma to another acceptable character.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Jul 07, 2005 2:03 am

For some reason it doesn't like the explicit variable (%), this (based on a post from Support a while ago) does work:

Code: Select all

Let>VAREXPLICIT=0
Let>files=D123456,P98765,Q50
Let>Break=,
Separate>files,Break,names
MessageModal>Num Files: %names_count%
Message>%names_1%%CRLF%%names_2%%CRLF%%names_3%%CRLF%
Label>end

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jul 07, 2005 3:48 am

Actually it is the % itself causing the problem.
VAREXPLICIT default is 0 and not needed.

Code: Select all

Let>files=D123456,P98765,Q50
Let>Break=,
Separate>files,Break,names
MessageModal>Num Files: %names_count%
Message>%names_1%%CRLF%%names_2%%CRLF%%names_3%%CRLF%
Label>end 
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

D_S
Junior Coder
Posts: 32
Joined: Sun Apr 24, 2005 6:43 pm

Post by D_S » Thu Jul 07, 2005 4:10 am

Me_again wrote:For some reason it doesn't like the explicit variable (%), this (based on a post from Support a while ago) does work:

Code: Select all

Let>VAREXPLICIT=0
Let>files=D123456,P98765,Q50
Let>Break=,
Separate>files,Break,names
MessageModal>Num Files: %names_count%
Message>%names_1%%CRLF%%names_2%%CRLF%%names_3%%CRLF%
Label>end
Thanks all, it worked !!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Jul 07, 2005 4:45 am

Bob Hansen wrote:Actually it is the % itself causing the problem.
VAREXPLICIT default is 0 and not needed.
Agreed. My preference now is to use VAREXPLICIT=1 so I have gotten into the habit of always defining it.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Jul 07, 2005 2:19 pm

So we have a workaround, but the Separate> command still does not work with a comma. Should probably be reported for a fix with next release.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Jul 08, 2005 2:03 am

It would be nice IMHO to have a way to use ASCII codes as you can in most languages, like CHR$(44) or #&44; '\x2C'

This would be an elegant way to handle spaces and most other character/symbol issues.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts