<?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: Dynamic Column Names using Context Variables in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275804#M52072</link>
    <description>Thanks Shong for your prompt response. 
&lt;BR /&gt;I actually need the column values rather the column names. But somehow I am unable to print the column values. It prints the value I have set in the context instead. 
&lt;BR /&gt;For e.g. 
&lt;BR /&gt;First Column is a Numeric Sequence and the other columns are dynamic.
&lt;BR /&gt;Dynamic Columns are set on the context variables
&lt;BR /&gt;context.DynamicHeaderFileOutput=row1.Column1+","+row1.Column2+","+row1.Column25 
&lt;BR /&gt;
&lt;BR /&gt;This is my output:
&lt;BR /&gt;SL NO.|HEADER STATEMENT DATE|STRIKE|EXPIRATION DATE
&lt;BR /&gt;1,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;2,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;3,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;4,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;5,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;Regards,
&lt;BR /&gt;Sameer</description>
    <pubDate>Mon, 24 Sep 2012 12:49:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-09-24T12:49:16Z</dc:date>
    <item>
      <title>Dynamic Column Names using Context Variables</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275802#M52070</link>
      <description>Hi, 
&lt;BR /&gt;I have a very simple and straight forward requirement, I have a file of say 100 columns(maximum) out of which I have a list of columns which I actually need for my downstreams. Per say 20 columns out of 100 and similarly I have 50 odd files to process where the column names and files are different. I know its easy for one job so as to reduce the effort of development I have thought of a Generic Job which can run for all the files which will have a standard 100 column input and output can be decided dynamically on the basis of columns provided for each of the files. 
&lt;BR /&gt;I tried using Context variables for this. For e.g. 
&lt;BR /&gt;context.DynamicHeaderFileOutput=row1.Column1+","+row1.Column2+","+row1.Column25 
&lt;BR /&gt;I have called this context name context.DynamicHeaderFileOutput in the output column expression, But it doesnot print the values as i need? Any pointers or suggestions if I am missing something? 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Sameer</description>
      <pubDate>Mon, 24 Sep 2012 11:06:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275802#M52070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-24T11:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Column Names using Context Variables</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275803#M52071</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;I tried using Context variables for this. For e.g. &lt;BR /&gt;context.DynamicHeaderFileOutput=row1.Column1 "," row1.Column2 "," row1.Column25 &lt;BR /&gt;Regards,&lt;BR /&gt;Sameer&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;You will get the column value, not the column name with this code. Do you really need to get the column name. This topic will show you how to get the column name. 
&lt;BR /&gt; 
&lt;A href="https://community.qlik.com/s/feed/0D53p00007vCp3ICAS" rel="nofollow noopener noreferrer"&gt;https://community.talend.com/t5/Design-and-Development/resolved-how-to-get-the-column-names-in-a-data-flow/td-p/99172&lt;/A&gt; 
&lt;BR /&gt;If you understand your request well, you need to set a dynamic schema for all files which have different schema. However, 'Dynamic schema' is only available in Talend Enterprise Data Integration.</description>
      <pubDate>Mon, 24 Sep 2012 11:52:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275803#M52071</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-24T11:52:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Column Names using Context Variables</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275804#M52072</link>
      <description>Thanks Shong for your prompt response. 
&lt;BR /&gt;I actually need the column values rather the column names. But somehow I am unable to print the column values. It prints the value I have set in the context instead. 
&lt;BR /&gt;For e.g. 
&lt;BR /&gt;First Column is a Numeric Sequence and the other columns are dynamic.
&lt;BR /&gt;Dynamic Columns are set on the context variables
&lt;BR /&gt;context.DynamicHeaderFileOutput=row1.Column1+","+row1.Column2+","+row1.Column25 
&lt;BR /&gt;
&lt;BR /&gt;This is my output:
&lt;BR /&gt;SL NO.|HEADER STATEMENT DATE|STRIKE|EXPIRATION DATE
&lt;BR /&gt;1,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;2,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;3,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;4,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;5,row1.Column1+","+row1.Column2+","+row1.Column25
&lt;BR /&gt;Regards,
&lt;BR /&gt;Sameer</description>
      <pubDate>Mon, 24 Sep 2012 12:49:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275804#M52072</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-24T12:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Column Names using Context Variables</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275805#M52073</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Dynamic Columns are set on the context variables&lt;BR /&gt;context.DynamicHeaderFileOutput=row1.Column1+","+row1.Column2+","+row1.Column25 &lt;BR /&gt;Regards,&lt;BR /&gt;Sameer&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Hi &lt;BR /&gt;This is considered as value to context variable, it is not supported to set dynamic value to context variable in Context viewer.  You can do it on a tJavaRow component, for example:&lt;BR /&gt;tFileInputDelimited--main--tJavaRow--mian--tLogRow&lt;BR /&gt;on tJavaRow:&lt;BR /&gt;&lt;PRE&gt;Context.DynamicHeaderFileOutput=input_row.Column1+","+input_row.Column2+","+input_row.Column3+","+input_row.Column4+....;&lt;BR /&gt;System.out.println(Context.DynamicHeaderFileOutput);&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Sep 2012 03:21:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275805#M52073</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-09-25T03:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Column Names using Context Variables</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275806#M52074</link>
      <description>You can do this with tJavaRow with a series of statements like this: 
&lt;BR /&gt;output_row.line=""; 
&lt;BR /&gt;output_row.line =context.FileOutputColumns.contains("Column1,")?(output_row.line.isEmpty()?"":",") input_row.Column1:""; 
&lt;BR /&gt;output_row.line =context.FileOutputColumns.contains("Column2,")?(output_row.line.isEmpty()?"":",") input_row.Column2:""; 
&lt;BR /&gt;... 
&lt;BR /&gt;If you want a more generic approach you would have to use reflection (see 
&lt;A href="https://community.qlik.com/s/feed/0D53p00007vCn49CAC" rel="nofollow noopener noreferrer"&gt;https://community.talend.com/t5/Design-and-Development/resolved-Automatically-trim-non-String-fields/td-p/86607&lt;/A&gt; for an example).</description>
      <pubDate>Fri, 28 Sep 2012 05:16:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-Column-Names-using-Context-Variables/m-p/2275806#M52074</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2012-09-28T05:16:33Z</dc:date>
    </item>
  </channel>
</rss>

