Doug;

 

As usual, you are dead on.  I will incorporate the LTRIM.  It really does
make better code.  AND yes, it's MS-SQL.

 

Thanks for the follow-up.

 

You da man!

r

 

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of Mueller, Doug
Sent: Thursday, May 30, 2013 3:30 PM
To: [email protected]
Subject: Re: REPLACE() Function for line-feed / carriage-return (RESOLVED)

 

** 

Ray,

 

You  never indicated what your database is, but I am going to say that I
think it is either MS SQL or Sybase.

 

Why? because there is a little issue with those databases with a particular
character sequence that if you

have it in a string, it eats part of your string.

 

If you have the following two characters, a backslash and a line feed, in a
character string, when you save it

in the database, it will remove this pair of characters silently, without
warning and continue with the

operation.  This was EXTRAORDINARILY confusing when we were developing 20
years ago and took us

a while to figure out.

 

Now, the syntax we serialize things in happens to include backslashes and if
your first character of the

string is a linefeed, that can cause issues.

 

SO, for the two databases where we have this issue, we take any case where
there is a leading return in

a string and add a space before it.  it eliminates the problem of eaten
characters and adding a space

before a return is not visible when looking at the data and in general is
silent and causes no issue.

 

However, in a case like this, it turn you into looking for a space followed
by the linefeed rather than just

a linefeed and that generally doesn't exist so you don't match.  Doing the
RIGHT solves the problem.  Using

a temp field solves it as well because the linefeed is no longer in the
syntax so no extra space.

 

Other than a RIGHT, you could have used an LTRIM function to trim off
leading whitespace and that would

have solved the situation a little more flexibly - but RIGHT should work
fine too.

 

If you use LTRIM, it would work regardless of database while RIGHT would
work on Sybase and SQL Server

but break on other environments - so it is more generic.

 

Now, if on Oracle or DB2, the original Replace without the function would
have worked just fine as they

don't have the quirk with the character pattern.

 

I hope this explains what happened to you and to prevent the customer on
Oracle who takes what you

did and gets a "this doesn't work" result because it will not there.  You
have to use RTRIM or just skip the

function.

 

Doug Mueller

 

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of Ray Palla
Sent: Thursday, May 30, 2013 12:47 PM
To: [email protected]
Subject: Re: REPLACE() Function for line-feed / carriage-return (RESOLVED)

 

** 

Thanks All for the input. A combination of all your thoughts provided the
final resolution.

 

Joe, you had a good idea that will probably work, but I first tried Tricia's
method and had good enough results to work it out using no new TMP_Fields.

 

Jittu, I'm on 7.6.04 and originally tried the method you recommended, but it
failed to do the replace.  However, when I combined David's idea with
Tricia's idea, I finally got the result I needed.

 

Here's how the final code solution looks in the expression editor:

 

 

REPLACE($InputString$, RIGHT("x

", 1) "^")

 

 

Tricia, the left is not needed, and the "$" is not the line-feed character,
the little box is.. But your idea is pure genius!  Thanks much.

 

You guys are the bomb!

Thanks again;

r

 

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of David Durling
Sent: Thursday, May 30, 2013 7:46 AM
To: [email protected]
Subject: Re: REPLACE() Function for line-feed / carriage-return

 

** 

What Jittu said has worked for me on ARS 7.5.  Note that you have to open
the expression editor (the expand button on the value) to do that - you
can't enter the line return or even cut & paste

"

"

directly into the value for the field.

 

David Durling

University of Georgia

 

 

From: Action Request System discussion list(ARSList)
[mailto:[email protected]] On Behalf Of Jittu Chacko
Sent: Wednesday, December 30, 2009 4:14 AM
To: [email protected]
Subject: Re: REPLACE() Function for line-feed / carriage-return

 

** 


Hi,
    if you mean to identify new line(\n) and replace that with another
character we can do that using set field and REPLACE() function

in set field -->
REPLACE($Input String$, "
", "^")


eg        input     bmc
                          software
                          pune

       output       bmc^software^pune


you can do this through a button or an active link service action calls
filter with service execution option and do set field.



Regards
Jittu Chacko



Tricia Truong said:
** 

I tried this and it worked great


REPLACE(REPLACE($EMP_LOGIN$, LEFT("$

  _____  

", 1), ""), RIGHT("$

  _____  

", 1), "")

$ is LineFeed character, I copy and paste and it did not show, but in the
developer tool it show as a little BOX


Hope it helps

 

 

 

Joe D'Souza said:

 

** 

I recall this posted by someone about a decade ago and a solution that
worked was saving the carriage return to a temp field, and using that temp
field in the replace function as the argument.

 

See if this solution still holds good.

 

Cheers

 

Joe

 









On 5/30/2013 4:27 AM, Ray Palla wrote: 

** 

Hey Kids;

 

Is there a way to use the REPLACE() function in a filter to remove line
feeds and/or carriage returns from text?  Is there a special character code?
I've tried to paste one into the function with double-quotes around it, but
the function doesn't seem to recognize it.  I just want to replace it with
anything like "^", to further parse the string as a single line.

 

Thanks in advance;

r

 


Ray Palla
Sr. IT/Remedy Consultant 

http://www.linkedin.com/img/signature/bg_bluefade_195x42.jpg





Mobile: 512-917-1739
Time Zone: Central

Email:  <mailto:[email protected]> [email protected]
http://www.linkedin.com/img/signature/icon_in_blue_14x14.gif Professional
Profile <http://www.linkedin.com/pub/1/544/598> 

 <http://www.INSONA.com> INSONA Corporation
1201 Berry Lane
<http://maps.google.com/maps?q=10650+SW+Plaza+CT%2CBox%3A+J68%2CHouston%2CTX
+77074%2CUSA&hl=en> 
Georgetown, TX

78626-3832 USA
Infrastructure Solutions - Network Applications 


 

        

 

_ARSlist: "Where the Answers Are" and have been for 20 years_ 

 

_ARSlist: "Where the Answers Are" and have been for 20 years_ 

_ARSlist: "Where the Answers Are" and have been for 20 years_ 

_ARSlist: "Where the Answers Are" and have been for 20 years_

_ARSlist: "Where the Answers Are" and have been for 20 years_ 


_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
"Where the Answers Are, and have been for 20 years"

<<image001.jpg>>

<<image002.jpg>>

<<image003.gif>>

Reply via email to