cancel
Showing results for 
Search instead for 
Did you mean: 

Escape Sequence in Expression editor

Former Member
0 Kudos

Hi,

I am trying to use 'stringreplace' function in the expression editor to replace '\' by ',' as follows:

stringreplace("\abcd\xyz\dfjdf\asdf","\",",")

But I am facing problem replacing it,I guess it may be something because of escape character "\".

Please suggest some solution to achieve this.

Thanks

Anuj

Accepted Solutions (0)

Answers (1)

Answers (1)

agentry_src
Active Contributor
0 Kudos

Try

 \\ 

for each \.

Regards,

Mike

Edited by: Michael Appleby on Jul 19, 2011 1:20 PM

Former Member
0 Kudos

Yes, it should be

 stringreplace("\\abcd\\xyz\\dfjdf\\asdf","\\",",") 

Best regards,

Kedar

Edited by: Kedar Shewalkar on Jul 19, 2011 1:49 PM

Edited by: Kedar Shewalkar on Jul 19, 2011 1:50 PM

Former Member
0 Kudos

Hi,

I cannot edit string value,it is coming directly from OSIPI.

Thanks,

Anuj

Former Member
0 Kudos

Dear Anuj

You don't have to replace string Value inside Variable.

Just Use


stringreplace(Transaction.string,"\\",",")

Thanks

Anshul

Former Member
0 Kudos

Hi Anshul,

I tried using what you suggested,but it is not working

it is giving me an error: "Invalid escaped character found"

Thanks,

Anuj

Edited by: Anuj Suryawanshi on Jul 19, 2011 2:16 PM

Edited by: Anuj Suryawanshi on Jul 19, 2011 2:20 PM

agentry_src
Active Contributor
0 Kudos

Hi Anuj,

You may be better off creating calculated tags in OSI PI to address the problem. It will also perform better than trying to do the editing in MII.

Regards,

Mike

Former Member
0 Kudos

Try using a Local parameter for your search value, that way your can have you search value set to just the backslash without having the escape character issue.

stringreplace(Transaction.string,Local.searchString,",")

Former Member
0 Kudos

Hi Mike,

Off creating calculated tags in OSI PI wont serve my purpose.

Actually I am getting the path of each tag by firing a query in the format '\xyz\abc\pqr\' ,'\aaa\bbb\ccc\ddd\eee\fff\' etc. directly from the OLE DB.

And Chris,

I tried creating a local variable with its value as '\',but it is also not working.Giving me the same error "Invalid escape character found"

Thanks

Anuj

Former Member
0 Kudos

Hi All,

I was able to get the solution for the problem.Actually the problem was with the string value in which replacement was to be done.

What I finally did is created a Trx variable for stringValue and implemented the code as below:

stringreplace(Transaction.str,"\\",",")

e.g. str = \aaa\bbb\ccc\ddd\

output will be : ,aaa,bbb,ccc,ddd,

Thanks

Anuj

Edited by: Anuj Suryawanshi on Jul 20, 2011 11:39 AM