<?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: get and set value to Context Variable in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277599#M53321</link>
    <description>Hi Shon,
&lt;BR /&gt;Thanks for reply. 
&lt;BR /&gt;Actually, there is no "SubJob". I need the variable's value within the main job.
&lt;BR /&gt;Ref. to the attached screenshot: I'm fetching one parameter from "dim_searchengine" via SQL and have to use in "dim_searchstrings" for lookup. That's it!
&lt;BR /&gt;This is what I'm doing:
&lt;BR /&gt;1. Set a variable in Context tab as, "se_param"
&lt;BR /&gt;2. Added tJavaRow to the tMap of "dim_searchengine"
&lt;BR /&gt;3. Inside the tJavaRow code, I set: context.se_param=row7.columnName; (row7 is refering to dim_searchengine )
&lt;BR /&gt;any idea how to get se_param's value in "dim_searchstrings", e.g; context.get(context.se_param)</description>
    <pubDate>Wed, 25 Jul 2012 12:20:51 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-07-25T12:20:51Z</dc:date>
    <item>
      <title>get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277593#M53315</link>
      <description>can we make the variable value dynamic?&lt;BR /&gt;for example: myContextVar = row1.mysql_table_column</description>
      <pubDate>Tue, 24 Jul 2012 14:43:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277593#M53315</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-24T14:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277594#M53316</link>
      <description>yes</description>
      <pubDate>Wed, 25 Jul 2012 02:10:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277594#M53316</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-07-25T02:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277595#M53317</link>
      <description>how?</description>
      <pubDate>Wed, 25 Jul 2012 08:02:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277595#M53317</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T08:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277596#M53318</link>
      <description>Hi
&lt;BR /&gt;You can add a context variable in your job firstly. Let's say it is called new1.
&lt;BR /&gt;So the code in tJavaRow is as seen below.
&lt;BR /&gt;context.new1 = input_row.mysql_table_column
&lt;BR /&gt;Regards,
&lt;BR /&gt;Pedro</description>
      <pubDate>Wed, 25 Jul 2012 08:04:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277596#M53318</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T08:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277597#M53319</link>
      <description>Hi,&lt;BR /&gt;I'm setting the value as shown in the screenshots, but it is returning me as NULL.&lt;BR /&gt;Please check the screenshots for details!</description>
      <pubDate>Wed, 25 Jul 2012 10:41:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277597#M53319</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T10:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277598#M53320</link>
      <description>Hi
&lt;BR /&gt;On tJavaRow, you can set value to context variable like:
&lt;BR /&gt;context.name=input_row.columnName; //not context.name=row7.columnName;
&lt;BR /&gt;And then, you are able to get the value of context variable in next subjob.
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Wed, 25 Jul 2012 11:01:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277598#M53320</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T11:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277599#M53321</link>
      <description>Hi Shon,
&lt;BR /&gt;Thanks for reply. 
&lt;BR /&gt;Actually, there is no "SubJob". I need the variable's value within the main job.
&lt;BR /&gt;Ref. to the attached screenshot: I'm fetching one parameter from "dim_searchengine" via SQL and have to use in "dim_searchstrings" for lookup. That's it!
&lt;BR /&gt;This is what I'm doing:
&lt;BR /&gt;1. Set a variable in Context tab as, "se_param"
&lt;BR /&gt;2. Added tJavaRow to the tMap of "dim_searchengine"
&lt;BR /&gt;3. Inside the tJavaRow code, I set: context.se_param=row7.columnName; (row7 is refering to dim_searchengine )
&lt;BR /&gt;any idea how to get se_param's value in "dim_searchstrings", e.g; context.get(context.se_param)</description>
      <pubDate>Wed, 25 Jul 2012 12:20:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277599#M53321</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T12:20:51Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277600#M53322</link>
      <description>Hi,
&lt;BR /&gt;As far as I can see both rows are not connected in any way, which means they are two separate subjobs. You're able to connect the first input table to the second with an onSubjobOk trigger.
&lt;BR /&gt;If not, you might want to show us some more of the job so things become more clear.
&lt;BR /&gt;Regards,
&lt;BR /&gt;Arno</description>
      <pubDate>Wed, 25 Jul 2012 14:07:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277600#M53322</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T14:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277601#M53323</link>
      <description>well i think one should be able to set a Global Variable or Context Variable whose value can be used on another TMAP Component... that's a simple thing i guess, but i'm not really getting how to Get/Set that Global/Context variable correctly</description>
      <pubDate>Wed, 25 Jul 2012 14:19:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277601#M53323</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T14:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277602#M53324</link>
      <description>Hi 
&lt;BR /&gt;Notice the Java code on tJavaRow, it should be: 
&lt;BR /&gt;context.se_param=input_row.columnName 
&lt;BR /&gt;Can you show us a full screenshot of the job? I need to overview the whole job and see if it is a design problem. 
&lt;BR /&gt;Best regards 
&lt;BR /&gt;Shong</description>
      <pubDate>Wed, 25 Jul 2012 14:24:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277602#M53324</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T14:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277603#M53325</link>
      <description>Hi,
&lt;BR /&gt;I'm using the same thing, whereas in my case, input_row = row7 and columnName = searchengineparams
&lt;BR /&gt;full screenshot is attached, where I've even tried using: context.se_param = "hello"; 
&lt;BR /&gt;but on tLogRow, I'm getting NULL... really annoying!</description>
      <pubDate>Wed, 25 Jul 2012 15:10:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277603#M53325</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-25T15:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277604#M53326</link>
      <description>Hi 
&lt;BR /&gt;You can't get the value of context variable in the same subjob, in you case, set / get value in the same subjob, because latter component always initializes first than the previous components. Please read this 
&lt;A href="http://talendforge.org/wiki/doku.php?id=component_creation" target="_blank" rel="nofollow noopener noreferrer"&gt;page&lt;/A&gt; to know the order of Java code generation. Let's take some example jobs to explain this:
&lt;BR /&gt;job1:
&lt;BR /&gt;tFileInputDelimited--main--tJavaRow_1---main--tJavaRow_2
&lt;BR /&gt;on tJavaRow_1:
&lt;BR /&gt;context.name=input_row.name;
&lt;BR /&gt;on tJavaRow_2:
&lt;BR /&gt;System.out.println(context.name);
&lt;BR /&gt;In this job, the result is null.
&lt;BR /&gt;job2:
&lt;BR /&gt;tFileInputDelimited--main--tJavaRow_1
&lt;BR /&gt; |
&lt;BR /&gt;onsubjobok
&lt;BR /&gt; |
&lt;BR /&gt;tJava_1
&lt;BR /&gt;on tJavaRow_1:
&lt;BR /&gt;context.name=input_row.name;
&lt;BR /&gt;on tJava_1:
&lt;BR /&gt;System.out.println(context.name);
&lt;BR /&gt;in this job, there are two subjobs, we can get the value of context variable on another subjob tJava_1.
&lt;BR /&gt;To achieve it, you need to redesign the job, for example, to use tFlowToIterate or split the job into multiple subjobs.
&lt;BR /&gt;Best regards
&lt;BR /&gt;Shong</description>
      <pubDate>Thu, 26 Jul 2012 03:02:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277604#M53326</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-26T03:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: get and set value to Context Variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277605#M53327</link>
      <description>Thank you for explaining the procedure. I got it fixed via SubJob.</description>
      <pubDate>Thu, 26 Jul 2012 14:34:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/get-and-set-value-to-Context-Variable/m-p/2277605#M53327</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-07-26T14:34:14Z</dc:date>
    </item>
  </channel>
</rss>

