<?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 Context and globalMap from component in a custom Routine in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Using-Context-and-globalMap-from-component-in-a-custom-Routine/m-p/2232134#M22209</link>
    <description>&lt;P&gt;So after many try here is my answer :&lt;/P&gt;
&lt;P&gt;My routine :&lt;/P&gt;
&lt;PRE&gt;public static ArrayList&amp;lt;String&amp;gt; arrayListGlobalMap(ArrayList&amp;lt;String&amp;gt; myArray) { 
		ArrayList&amp;lt;String&amp;gt; MyArray = myArray; 
		return MyArray;
	}&lt;/PRE&gt;
&lt;P&gt;The call in my tJava :&lt;/P&gt;
&lt;PRE&gt;ArrayList&amp;lt;String&amp;gt; MyArray = new ArrayList&amp;lt;&amp;gt;();
MyArray = Java_Insert_Routine.arrayListGlobalMap((ArrayList)globalMap.get("myGlobalArray"));&lt;/PRE&gt;</description>
    <pubDate>Tue, 10 Sep 2019 15:51:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-09-10T15:51:54Z</dc:date>
    <item>
      <title>Using Context and globalMap from component in a custom Routine</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-Context-and-globalMap-from-component-in-a-custom-Routine/m-p/2232133#M22208</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;I want to reduce all my code from my tJava so I'm trying to use Routine in a Job ToS for ESB 7.1.1.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;For example :&lt;/P&gt; 
&lt;P&gt;I'm doing a request from a table :&lt;/P&gt; 
&lt;PRE&gt;"SELECT COLUMN_NAME
FROM TABLE 
WHERE TABLE_NAME = '"+context.Table+"'
AND DATA_TYPE = 'DATE'"&lt;/PRE&gt; 
&lt;P&gt;and I save the result in an Arraylist in a tJavaFlex:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tJavaFlex.PNG" style="width: 591px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M6w2.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/150890i718CC9AF82F91101/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M6w2.png" alt="0683p000009M6w2.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;But when I have to use it in a different tJava I have to do this :&lt;/P&gt; 
&lt;PRE&gt;int NbColumnDate = (Integer)globalMap.get("NbColumnDate");
for (int i = 0; i &amp;lt; NbColumnDate; i++)
{
        ColumnDate.add(((ArrayList)globalMap.get("ColumnNameDate")).get(i).toString());
}&lt;/PRE&gt; 
&lt;P&gt;So I want to put this in a Routine and just call it when I need to use this code.&lt;/P&gt; 
&lt;P&gt;I would like to know if it's possible to use context and globalMap var in custom Routine. If yes, can someone show me the way ?&lt;/P&gt; 
&lt;P&gt;When I try to use globalMap.get("myVar") or context.myVar an error is raised : &lt;FONT color="#FF0000"&gt;context cannot be resolved to a variable and globalMap cannot be resolved to a variable&lt;/FONT&gt;.&lt;/P&gt; 
&lt;P&gt;Thank you for any help,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:44:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-Context-and-globalMap-from-component-in-a-custom-Routine/m-p/2232133#M22208</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T04:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using Context and globalMap from component in a custom Routine</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Using-Context-and-globalMap-from-component-in-a-custom-Routine/m-p/2232134#M22209</link>
      <description>&lt;P&gt;So after many try here is my answer :&lt;/P&gt;
&lt;P&gt;My routine :&lt;/P&gt;
&lt;PRE&gt;public static ArrayList&amp;lt;String&amp;gt; arrayListGlobalMap(ArrayList&amp;lt;String&amp;gt; myArray) { 
		ArrayList&amp;lt;String&amp;gt; MyArray = myArray; 
		return MyArray;
	}&lt;/PRE&gt;
&lt;P&gt;The call in my tJava :&lt;/P&gt;
&lt;PRE&gt;ArrayList&amp;lt;String&amp;gt; MyArray = new ArrayList&amp;lt;&amp;gt;();
MyArray = Java_Insert_Routine.arrayListGlobalMap((ArrayList)globalMap.get("myGlobalArray"));&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Sep 2019 15:51:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Using-Context-and-globalMap-from-component-in-a-custom-Routine/m-p/2232134#M22209</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-10T15:51:54Z</dc:date>
    </item>
  </channel>
</rss>

