<?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 How to load global variables to context variables using no explicit mentioning of context variable in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-load-global-variables-to-context-variables-using-no/m-p/2251250#M35265</link>
    <description>&lt;P&gt;Hi Team,&lt;BR /&gt;&lt;BR /&gt;I Have a java code which brings env variables from secrets manager (AWS) and places them into global map objects .&lt;BR /&gt;&lt;BR /&gt;I am presently loading this values to context explicitly as below ...&lt;BR /&gt;context.project_name =((com.fasterxml.jackson.databind.JsonNode) globalMap.get("project_name")).asText();&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;but for future we want to avoid loading context variables like above and load them using some automated way .&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I tried using below code but it is not loading context variables ...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;log.info(context.keySet().size())&lt;BR /&gt;for(Object o : keys){&lt;BR /&gt;log.info(o+" -&amp;gt; "+context.get(o));&lt;BR /&gt;}&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Adding more info below guys ,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;FYI... below is the code I am using for reading the data from AWS secrets manager after completing authentication from multiple URL's .&lt;BR /&gt;&lt;BR /&gt;I receive data in an object and using for looping I can read them .... I have only issue in loading same into context variables (I want this step to be automated).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;while(propertySources.hasNext()) {&lt;BR /&gt;JsonNode propertySource = propertySources.next().get("source");&lt;BR /&gt;Iterator&amp;lt;String&amp;gt; properties = propertySource.fieldNames();&lt;BR /&gt;while(properties.hasNext()) {&lt;BR /&gt;String field = properties.next();&lt;BR /&gt;String value = propertySource.get(field).asText();&lt;BR /&gt;log.info(field+" | "+propertySource.get(field));&lt;BR /&gt;if(value.startsWith("arn:aws:secretsmanager")) {&lt;BR /&gt;getSecretValueRequest.setSecretId(value);&lt;BR /&gt;String secret = secretsManager.getSecretValue(getSecretValueRequest).getSecretString();&lt;BR /&gt;context.put(field, secret);&amp;nbsp; --- &amp;gt; this seems to be not working as my context variables declared in the job are not loaded&amp;nbsp; with the desired values .&lt;BR /&gt;globalMap.put(field, secret); ---&amp;gt; this I am able to access values using globalMap.get() but we need to manually assign them using below commented value (I want the below to be automated instead of calling it manually ...)&lt;/P&gt; 
&lt;P&gt;//context.EMCS_URL=((com.fasterxml.jackson.databind.JsonNode)globalMap.get("EMCS_URL")).asText();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}else {&lt;BR /&gt;context.put(field, propertySource.get(field));&lt;BR /&gt;globalMap.put(field, propertySource.get(field));&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt; 
&lt;P&gt;}&lt;/P&gt; 
&lt;P&gt;please let me know if anyone has a solution to the above ...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;the above code just puts the values to log info , using same objects how can I load context variables&amp;nbsp; ...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;please suggest an solution to this to load context variables without explicitly mentioning .....&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 02:26:59 GMT</pubDate>
    <dc:creator>Sudhee_Maximus</dc:creator>
    <dc:date>2024-11-16T02:26:59Z</dc:date>
    <item>
      <title>How to load global variables to context variables using no explicit mentioning of context variable</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-load-global-variables-to-context-variables-using-no/m-p/2251250#M35265</link>
      <description>&lt;P&gt;Hi Team,&lt;BR /&gt;&lt;BR /&gt;I Have a java code which brings env variables from secrets manager (AWS) and places them into global map objects .&lt;BR /&gt;&lt;BR /&gt;I am presently loading this values to context explicitly as below ...&lt;BR /&gt;context.project_name =((com.fasterxml.jackson.databind.JsonNode) globalMap.get("project_name")).asText();&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;but for future we want to avoid loading context variables like above and load them using some automated way .&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I tried using below code but it is not loading context variables ...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;log.info(context.keySet().size())&lt;BR /&gt;for(Object o : keys){&lt;BR /&gt;log.info(o+" -&amp;gt; "+context.get(o));&lt;BR /&gt;}&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Adding more info below guys ,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;FYI... below is the code I am using for reading the data from AWS secrets manager after completing authentication from multiple URL's .&lt;BR /&gt;&lt;BR /&gt;I receive data in an object and using for looping I can read them .... I have only issue in loading same into context variables (I want this step to be automated).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt; 
&lt;P&gt;&lt;BR /&gt;while(propertySources.hasNext()) {&lt;BR /&gt;JsonNode propertySource = propertySources.next().get("source");&lt;BR /&gt;Iterator&amp;lt;String&amp;gt; properties = propertySource.fieldNames();&lt;BR /&gt;while(properties.hasNext()) {&lt;BR /&gt;String field = properties.next();&lt;BR /&gt;String value = propertySource.get(field).asText();&lt;BR /&gt;log.info(field+" | "+propertySource.get(field));&lt;BR /&gt;if(value.startsWith("arn:aws:secretsmanager")) {&lt;BR /&gt;getSecretValueRequest.setSecretId(value);&lt;BR /&gt;String secret = secretsManager.getSecretValue(getSecretValueRequest).getSecretString();&lt;BR /&gt;context.put(field, secret);&amp;nbsp; --- &amp;gt; this seems to be not working as my context variables declared in the job are not loaded&amp;nbsp; with the desired values .&lt;BR /&gt;globalMap.put(field, secret); ---&amp;gt; this I am able to access values using globalMap.get() but we need to manually assign them using below commented value (I want the below to be automated instead of calling it manually ...)&lt;/P&gt; 
&lt;P&gt;//context.EMCS_URL=((com.fasterxml.jackson.databind.JsonNode)globalMap.get("EMCS_URL")).asText();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;}else {&lt;BR /&gt;context.put(field, propertySource.get(field));&lt;BR /&gt;globalMap.put(field, propertySource.get(field));&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt; 
&lt;P&gt;}&lt;/P&gt; 
&lt;P&gt;please let me know if anyone has a solution to the above ...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;the above code just puts the values to log info , using same objects how can I load context variables&amp;nbsp; ...&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;please suggest an solution to this to load context variables without explicitly mentioning .....&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 02:26:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-load-global-variables-to-context-variables-using-no/m-p/2251250#M35265</guid>
      <dc:creator>Sudhee_Maximus</dc:creator>
      <dc:date>2024-11-16T02:26:59Z</dc:date>
    </item>
  </channel>
</rss>

