Issue with String replace

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Danton
Newbie
Posts: 11
Joined: Thu Aug 26, 2010 12:04 am

Issue with String replace

Post by Danton » Fri Aug 16, 2019 12:32 am

The code below is meant to get ten numbers from Excel. There is a String replace line that is used to remove CRLF characters.

Looking at the watch list the number is extracted from EXCEL.

This is watch I see in the watchlist
INBOUNDNUMBER1=8001234567

The result of the String replace line is as follows

INBOUNDNUMBER%K%=8001234567

This is not what I would expect.


/* Get Inbound Numbers from Excel */
Let>k=0
Repeat>k
Let>k=k+1
DDERequest>Excel,filename,R%xlRow%C2,InboundNumber%k%,4
StringReplace>InboundNumber%k%,CRLF,,InboundNumber%k%
If>InboundNumber%k%=,MainLoopExit
Length>InboundNumber%k%,nLength
If>nLength<>10,MainLoopExit
Let>xlRow=xlRow+1
Until>k=10

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Issue with String replace

Post by Dorian (MJT support) » Fri Aug 16, 2019 1:47 pm

You have to split that StringReplace into pieces. Like this.

Code: Select all

Let>Input=InboundNumber%k%
StringReplace>%Input%,CRLF,,Output
Let>InboundNumber%k%=Output
Yes, we have a Custom Scripting Service. Message me or go here

Danton
Newbie
Posts: 11
Joined: Thu Aug 26, 2010 12:04 am

Re: Issue with String replace

Post by Danton » Fri Aug 16, 2019 11:32 pm

Perfect. Thanks Dorian.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Issue with String replace

Post by Dorian (MJT support) » Sat Aug 17, 2019 10:20 am

Always happy to help. :)
Yes, we have a Custom Scripting Service. Message me or go here

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