Problem using Separate

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Guest

Problem using Separate

Post by Guest » Tue Nov 11, 2003 7:20 pm

Am I doing something wrong or is there a better way to do this?

I pull a series of variables as one text string from a VBScript. The string looks like this.

21.88,71.38,39,10,79,99,99,99

The string contains 8 variables separated by a commas. I want to separate them into individual variables. I tried to use the Separate> command but it doesn't seem work with a , as the delimiter.

Separate>RetValIs,,,new_values

doesn't work.

Is there a way to separate these variables? The 2 digit numbers are sometimes only 1 so the MidStr> command does not work all the time.

Thanks
-Joe

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 » Wed Nov 12, 2003 2:38 am

I tried this and got the same problem: it did not work. :(

I added Let>DL=, and used %DL% as a variable for the delimiter, same results. :(

I tried with a semicolon (;) and it worked fine. :)
I tried with an underscore (_) and it worked fine. :)
I tried changing delimiter of , to "," and got an unending loop. :(

:idea: Hmmm, might actually be a bug here? Maybe some more tests will explain..... :arrow:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Wed Nov 12, 2003 10:40 am

Would this work?

Let>DL=\,

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 » Wed Nov 12, 2003 3:59 pm

Would this work?

Let>DL=\,
Good try Lumumba........................
But no success. :(

Who's next :?:

Step right up, lot's of good seats up front :!:

Who's the hero out there :?:

Step right up :D
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

JBurger
Junior Coder
Posts: 33
Joined: Wed Nov 12, 2003 7:16 pm
Location: NY

Post by JBurger » Wed Nov 12, 2003 7:18 pm

Good to know it's not just me.

I tried putting the DL , in quotes and with spaces. No deal.

-Joe

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 » Wed Nov 12, 2003 7:52 pm

Hello Joe.....would you be the original "Guest", signed Joe, who started this problem :?:

Just curious........if Yes, thanks for the name :D

Temporary work around until this is corrected would be to do a Search and Replace. Replace the , with a ; or some other unique character. Then do the Separate process. Replace can be done using VBS script in the Macro Script.

:idea: Easiest solution is to use Visual Basic Replace function
=================
VBSTART
VBEND
Let>String1=21.88,71.38,39,10,79,99,99,99
VBEval>Replace("%String1%",",",";"),String2
Message>%String1%%CRLF%%CRLF%has been changed to %CRLF%%CRLF%%String2%
==================
There is no need to rename the result. It was just done here to display a message. The next line is perfectly acceptable:
VBEval>Replace("%String1%",",",";"),String1
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

JBurger
Junior Coder
Posts: 33
Joined: Wed Nov 12, 2003 7:16 pm
Location: NY

Post by JBurger » Wed Nov 12, 2003 9:29 pm

That would be me. Thought I should reg if I was posting. :wink:

Thanks for the replace, it works fine. The obvious choice sometimes is overlooked. But there does seem to be a bug with Separate.

-Joe

Lumumba

Post by Lumumba » Thu Nov 13, 2003 9:12 am

The obvious choice sometimes is overlooked
(Beside that this solution is definitely smart) what about the obvious Position> command?

Would this be impacted if "," is used?[/quote]

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Nov 13, 2003 9:19 am

Honestly! Just do this:

Let>delim=,
Separate>RetValIs,delim,new_values
MJT Net Support
[email protected]

Lumumba

Post by Lumumba » Thu Nov 13, 2003 7:16 pm

If that's the case, I guess a bunch of folks would expect that both should work!?

Support:
Let>delim=,
Separate>RetValIs,delim,new_values
[Bob] I added Let>DL=, and used %DL% as a variable for the delimiter, same results [it didn't work].
coded it would have looked like this:

Let>DL=,
Separate>RetValIs,%DL%,new_values

I can't see a difference on what support has advised and what Bob offered ... :?:

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 Nov 13, 2003 10:41 pm

I just tried Let>delim=, and it worked. :shock: :?

I retried my Let>DL=, and it failed. :?

I removed the % from around DL in my Separate function and it worked! :D

So now I did Let>VAREXPLICIT=1
And Separate fails with and without the %. :(

:?: Something seems wrong here. :idea: I suspect it has something to do with VAREXPLICIT.

This fails when VAREXPLICIT=1:
Separate>files,DL,file_names

This also fails when VAREXPLICIT=1
Separate>files,%DL%,file_names

This fails when VAREXPLICIT=0
Separate>files,%DL%,file_names

This is the only time it is good, VAREXPLICIT=0
Separate>files,%DL%,file_names

And using , vs. a variable always fails.
Separate>files,,,file_names

Additional comment: Watch List always shows "DL=," no matter what the setting is for VAREXPLICIT.

This looks like a problem for Marcus?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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