<?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 tmap and usage of context variable in ereplace in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tmap-and-usage-of-context-variable-in-ereplace/m-p/2246837#M32228</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to do simple task using tfileinput, tmap and tfileoutput.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I read a file and wanted to replace specific string with another string. The another string comes from context variable and it doesn't allow me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;following works&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;StringHandling.EREPLACE(row1.filescript,&lt;SPAN class="s1"&gt;"source"&lt;/SPAN&gt;,&lt;SPAN class="s1"&gt;"myname"&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P class="p1"&gt;but when I try doing following way it&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;context.var1 = "myname"&lt;/P&gt;
&lt;P class="p1"&gt;StringHandling.EREPLACE(row1.filescript,&lt;SPAN class="s1"&gt;"source"&lt;/SPAN&gt;,context.var1) it doesn't allow me. If I click Test is shows me following&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;The static field TalendJavaSourceViewer8.ContextProperties.var1 should be accessed in static way&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Any help how I can use context variable value to replace in my text file.&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 04:39:57 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-11-16T04:39:57Z</dc:date>
    <item>
      <title>tmap and usage of context variable in ereplace</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tmap-and-usage-of-context-variable-in-ereplace/m-p/2246837#M32228</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to do simple task using tfileinput, tmap and tfileoutput.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I read a file and wanted to replace specific string with another string. The another string comes from context variable and it doesn't allow me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;following works&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;StringHandling.EREPLACE(row1.filescript,&lt;SPAN class="s1"&gt;"source"&lt;/SPAN&gt;,&lt;SPAN class="s1"&gt;"myname"&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P class="p1"&gt;but when I try doing following way it&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;context.var1 = "myname"&lt;/P&gt;
&lt;P class="p1"&gt;StringHandling.EREPLACE(row1.filescript,&lt;SPAN class="s1"&gt;"source"&lt;/SPAN&gt;,context.var1) it doesn't allow me. If I click Test is shows me following&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;The static field TalendJavaSourceViewer8.ContextProperties.var1 should be accessed in static way&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;Any help how I can use context variable value to replace in my text file.&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:39:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tmap-and-usage-of-context-variable-in-ereplace/m-p/2246837#M32228</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T04:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: tmap and usage of context variable in ereplace</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tmap-and-usage-of-context-variable-in-ereplace/m-p/2246838#M32229</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Where is the value your are retrieving and assigning it to your context variable? Could you please show us your tMap editor screenshot?&lt;/P&gt;
&lt;P&gt;Please&amp;nbsp;check your "Code" tab in your job to see if here will be your compile error highlighted in red line?&lt;/P&gt;
&lt;P&gt;Best regards&lt;/P&gt;
&lt;P&gt;Sabrina&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2019 07:46:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tmap-and-usage-of-context-variable-in-ereplace/m-p/2246838#M32229</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-19T07:46:30Z</dc:date>
    </item>
  </channel>
</rss>

