SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#1 15-02-2019 15:10:00

KevinM
Moderator
Registered: 21-11-2018
Posts: 13

Unable to substitute values containing \ (backslash) in a custom query

When using a custom query to Collect data from a Data Base table you will find any \ (backslash) in a value used in a variable in the query is simply ignored. For instance - Assume you have a entry in memory called 'name' which has the value 'fred\sally', and your custom query is 'select * from myTable where myColumn = ~#~name~#~'.
X-ServiceBroker will send the following to the SQL driver 'select * from myTable where myColumn = fredsally' and SQL will not find your "fred\sally' record.

To get around this you need to double up on the \ (backslash). One way to do this is to run the following Substitute rule on the field you would like to use in the custom query.

  <sxi:Substitute>
              <sxi:Find>\\</sxi:Find>
              <sxi:Replace>\\</sxi:Replace>
   </sxi:Substitute>

NO THE \\ IN BOTH THE FIND AND THE REPLACE IS NOT A TYPO.

Offline

#2 21-02-2019 02:43:01

RuanO
Member
Registered: 17-01-2019
Posts: 2

Re: Unable to substitute values containing \ (backslash) in a custom query

Found this very helpful, thanks Kev!

Offline

Board footer

Powered by FluxBB