<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using StringHandling to replace forward slash / with backslash \ in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Using-StringHandling-to-replace-forward-slash-with-backslash/m-p/2309538#M80742</link>
    <description>&lt;P&gt;&lt;B&gt;context.parameter_path_relative = context.parameter_path_relative.replace( "/", "\\")&amp;nbsp;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Do this in tjavafex before running the DBOutput component&lt;/B&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 27 Nov 2020 07:33:41 GMT</pubDate>
    <dc:creator>Prakhar1</dc:creator>
    <dc:date>2020-11-27T07:33:41Z</dc:date>
    <item>
      <title>Using StringHandling to replace forward slash / with backslash \</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-StringHandling-to-replace-forward-slash-with-backslash/m-p/2309537#M80741</link>
      <description>&lt;P&gt;Hi. I am trying to design a job which takes input from a data table containing filepaths to documents&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0693p00000AZtgsAAD.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/130452iD9737C0FA5B58111/image-size/large?v=v2&amp;amp;px=999" role="button" title="0693p00000AZtgsAAD.png" alt="0693p00000AZtgsAAD.png" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the job I want to replace the relative path &lt;B&gt;C:\1stdir32\&lt;/B&gt; with nothing.&lt;/P&gt;&lt;P&gt;In SQL, I would simply run this:&lt;/P&gt;&lt;P&gt;&lt;B&gt;UPDATE Documents&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;SET [Path] = REPLACE([Path], 'C:\1stdir32\', '')&lt;/B&gt;&lt;/P&gt;&lt;P&gt;However, I want to achieve this in a job with a context parameter that will prompt the user for a relative path at runtime. I would like this context parameter to be of type "Directory".&lt;/P&gt;&lt;P&gt;The issue with this though is Talend's insistence on using forward slashes instead of the standard Windows backslashes in paths (I know this is due to it being Java based.)&lt;/P&gt;&lt;P&gt;So when I set this up, the directory being passed to the context parameter at runtime is C:/1stdir32/ and not C:\1stdir32\.&lt;/P&gt;&lt;P&gt;This basically means nothing gets updated when the job runs.&lt;/P&gt;&lt;P&gt;So I'm seeing is there is a way I can replace the forward slashes in the context parameter to backslashes using the StringHandling function. But I'm not getting any joy.&lt;/P&gt;&lt;P&gt;I am executing the code via a tDBRow component. Here's my code:&lt;/P&gt;&lt;P&gt;&lt;B&gt;UPDATE Documents&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;SET [Path] = REPLACE(CAST([Path] AS VARCHAR(MAX)), '" + StringHandling.CHANGE(context.parameter_path_relative, "/", "\") + "', '')&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;WHERE CAST([Path] AS VARCHAR(MAX)) LIKE '" +StringHandling.CHANGE(context.parameter_path_relative, "/", "\") + "%'&lt;/B&gt;&lt;/P&gt;&lt;P&gt;This doesn't work, so I tried escaping the backslash by doubling up on it, but still no joy.&lt;/P&gt;&lt;P&gt;&lt;B&gt;UPDATE Documents&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;SET [Path] = REPLACE(CAST([Path] AS VARCHAR(MAX)), '" + StringHandling.CHANGE(context.parameter_path_relative, "/", "\\") + "', '')&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;WHERE CAST([Path] AS VARCHAR(MAX)) LIKE '" +StringHandling.CHANGE(context.parameter_path_relative, "/", "\\") + "%'&lt;/B&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:02:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-StringHandling-to-replace-forward-slash-with-backslash/m-p/2309537#M80741</guid>
      <dc:creator>welshsteve</dc:creator>
      <dc:date>2024-11-16T01:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using StringHandling to replace forward slash / with backslash \</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-StringHandling-to-replace-forward-slash-with-backslash/m-p/2309538#M80742</link>
      <description>&lt;P&gt;&lt;B&gt;context.parameter_path_relative = context.parameter_path_relative.replace( "/", "\\")&amp;nbsp;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Do this in tjavafex before running the DBOutput component&lt;/B&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Nov 2020 07:33:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-StringHandling-to-replace-forward-slash-with-backslash/m-p/2309538#M80742</guid>
      <dc:creator>Prakhar1</dc:creator>
      <dc:date>2020-11-27T07:33:41Z</dc:date>
    </item>
  </channel>
</rss>

