<?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 table and column names to one table and rows? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320958#M91047</link>
    <description>Hi Sabrina and thank you for your reply. 
&lt;BR /&gt;Yes, I think I've looked at every post I could find on the subject. The problem is, I have no idea what the table schema will look like ahead of time..each one is different. ie.&amp;nbsp; How many columns, or column names. Just an understanding of the format of the columns and their names if that makes sense. 
&lt;BR /&gt;I almost need to loop through the schema storing the column names somewhere, then, iterate through that list while iterating through each row of the table itself to collect values and output all of that into a MySQLtable in a normalized sort of format. 
&lt;BR /&gt;The closets method I can find is 
&lt;A href="http://bekwam.blogspot.com/2011/06/dynamic-schemas-in-talend-open-studio.html" target="_blank" rel="nofollow noopener noreferrer"&gt;http://bekwam.blogspot.com/2011/06/dynamic-schemas-in-talend-open-studio.html&lt;/A&gt;&amp;nbsp;&amp;nbsp; but idea if it will actually work. 
&lt;BR /&gt;Does that make sense? 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;Gary</description>
    <pubDate>Tue, 17 May 2016 19:03:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-05-17T19:03:01Z</dc:date>
    <item>
      <title>Dynamic table and column names to one table and rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320956#M91045</link>
      <description>Hi all,&lt;BR /&gt;Newbie to Talend and have spent the last week on this one. I can't seem to figure this out and perhaps it's not even possible. The topics I've found here in the forum all seem to speak to fixed column names and pivoting to normal files. So truly any help is appreciated. &amp;nbsp;All of this is pertains to MYSQL. &lt;BR /&gt;Tables hold the results from measurements. Each measurement table name is formatted like &lt;B&gt;"analysis_"{analysis ID}&lt;/B&gt;. ie . &lt;B&gt;analysis_12345&lt;/B&gt;. I can use a context variable to query the table.&lt;BR /&gt;&lt;BR /&gt;What I can't seem to figure out is columns names within each table are structured according to the following schema&lt;B&gt;:&lt;BR /&gt;analysis X group of question X question &amp;nbsp; &lt;/B&gt;&lt;BR /&gt;...so a column name will look like &lt;B&gt;"analysisXgroupingXquestion"&lt;/B&gt; or &lt;B&gt;12345X45X4&lt;/B&gt;.&amp;nbsp; &lt;B&gt;"X"&lt;/B&gt; is the separator.&lt;BR /&gt;&lt;BR /&gt;Table "analysis_12345" holds these columns and response data-&amp;gt;&lt;BR /&gt;&lt;B&gt;ID|12345X45X3|12345X45X4|12345X65X12SQ1|12345X65X12SQ2&lt;/B&gt;&lt;BR /&gt;1|4|7|2|1|&lt;BR /&gt;2|6|3|4|7|&lt;BR /&gt;Table &lt;B&gt;analysis_35748&lt;/B&gt; for example might be -&amp;gt;&lt;BR /&gt;&lt;B&gt;ID|35748X12X6SQ1|35748X12X6SQ1|35748X3X1SQ1|35748X3X1SQ2|35748X7X7SQ1|35748X7X7SQ2&lt;/B&gt;&lt;BR /&gt;1|1|5|7|3|6|4|&lt;BR /&gt;2|7|4|4|2|1|7|&lt;BR /&gt;Each analysis table can have very different column names.&lt;BR /&gt;I would like to pivot each analysis table into one table. So for &lt;B&gt;analysis_12345:&lt;/B&gt;&lt;BR /&gt;&lt;B&gt;Response|measurement|group|question|score&lt;/B&gt;&lt;BR /&gt;1|12345|45|3|4&lt;BR /&gt;1|12345|45|4|7&lt;BR /&gt;1|12345|65|12SQ1|2|&lt;BR /&gt;1|12345|65|12SQ2|1|&lt;BR /&gt;2|12345|45|3|6|&lt;BR /&gt;2|12345|45|4|3|&lt;BR /&gt;2|12345|65|12SQ1|4|&lt;BR /&gt;2|12345|65|12SQ2|7|&lt;BR /&gt;Or &lt;B&gt;analysis_35748&lt;/B&gt;&lt;BR /&gt;&lt;B&gt;Response|measurement|group|question|score&lt;/B&gt;&lt;BR /&gt;1|35748|12|6SQ1|1|&lt;BR /&gt;1|35748|12|6SQ1|5|&lt;BR /&gt;1|35748|3|1SQ1|7|&lt;BR /&gt;1|35748|3|1SQ2|3|&lt;BR /&gt;1|35748|7|7SQ1|6|&lt;BR /&gt;1|35748|7|7SQ2|4|&lt;BR /&gt;2|35748|12|6SQ1|7|&lt;BR /&gt;2|35748|12|6SQ1|4|&lt;BR /&gt;2|35748|3|1SQ1|4|&lt;BR /&gt;2|35748|3|1SQ2|2|&lt;BR /&gt;2|35748|7|7SQ1|1|&lt;BR /&gt;2|35748|7|7SQ2|7|&lt;BR /&gt;I wrote a few routines to extract the new columns names from the existing... like this for example...&lt;BR /&gt;&lt;PRE&gt; &amp;nbsp; public static Integer get_measurementiID(String columnname){&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (columnname != null) {&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; String[] explode=columnname.split("X");&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return &amp;nbsp;Integer.parseInt(explode);&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return null;&lt;BR /&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;then for group and question.. &amp;nbsp;etc ... &amp;nbsp; &lt;BR /&gt;but my dilemma is actually getting Talend to iterate through the columns and actually output the new table. I'm absolutely lost. If anyone has some ideas or at least help point me in the right direction, I would be grateful! &lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 16 May 2016 08:06:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320956#M91045</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-16T08:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table and column names to one table and rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320957#M91046</link>
      <description>Hi,&lt;BR /&gt;It seems that you are looking for converting columns to rows?&lt;BR /&gt;Have you already checked this KB article about:&lt;A href="https://help.talend.com/search/all?query=Converting+columns+to+rows&amp;amp;content-lang=en" target="_blank" rel="nofollow noopener noreferrer"&gt;TalendHelpCenter:Converting columns to rows&lt;/A&gt;&amp;nbsp;to see if it works?&lt;BR /&gt;Best regards&lt;BR /&gt;Sabrina</description>
      <pubDate>Tue, 17 May 2016 04:18:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320957#M91046</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-17T04:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table and column names to one table and rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320958#M91047</link>
      <description>Hi Sabrina and thank you for your reply. 
&lt;BR /&gt;Yes, I think I've looked at every post I could find on the subject. The problem is, I have no idea what the table schema will look like ahead of time..each one is different. ie.&amp;nbsp; How many columns, or column names. Just an understanding of the format of the columns and their names if that makes sense. 
&lt;BR /&gt;I almost need to loop through the schema storing the column names somewhere, then, iterate through that list while iterating through each row of the table itself to collect values and output all of that into a MySQLtable in a normalized sort of format. 
&lt;BR /&gt;The closets method I can find is 
&lt;A href="http://bekwam.blogspot.com/2011/06/dynamic-schemas-in-talend-open-studio.html" target="_blank" rel="nofollow noopener noreferrer"&gt;http://bekwam.blogspot.com/2011/06/dynamic-schemas-in-talend-open-studio.html&lt;/A&gt;&amp;nbsp;&amp;nbsp; but idea if it will actually work. 
&lt;BR /&gt;Does that make sense? 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;Gary</description>
      <pubDate>Tue, 17 May 2016 19:03:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320958#M91047</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-17T19:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table and column names to one table and rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320959#M91048</link>
      <description>If you're using Talend's Enterprise version, you can use the Dynamic column type to do what you want.&amp;nbsp; 
&lt;BR /&gt;here's some sample code I use to generate table create statements for one of my dynamic table loaders: 
&lt;BR /&gt;in a tJavaFlex: 
&lt;BR /&gt;Begin: 
&lt;BR /&gt; 
&lt;PRE&gt;// start part of your Java code&lt;BR /&gt;int ncount=0;&lt;BR /&gt;String columnName="";&lt;BR /&gt;DynamicMetadata column;&lt;BR /&gt;&lt;BR /&gt;Boolean firstRow = true;&lt;BR /&gt;String create = "CREATE TABLE " + "\"" + context.TABLENAME + "\"" + " ( ";&lt;BR /&gt;&lt;BR /&gt;ncount=dynamic_tFileInputDelimited_2.getColumnCount();&lt;BR /&gt;int counter = 0;&lt;BR /&gt;&lt;/PRE&gt; 
&lt;BR /&gt;Main: 
&lt;BR /&gt; 
&lt;PRE&gt;/* Empty */&lt;/PRE&gt; 
&lt;BR /&gt;End: 
&lt;BR /&gt; 
&lt;PRE&gt;&lt;BR /&gt;for( int columnIndex = 0; columnIndex &amp;lt; ncount; columnIndex++ ) {&lt;BR /&gt;&lt;BR /&gt;	column=dynamic_tFileInputDelimited_3.getColumnMetadata(columnIndex);&lt;BR /&gt;	columnName=column.getName();&lt;BR /&gt;	if( context.ROW_LEVEL_LOGGING ) {&lt;BR /&gt;		System.out.println(columnName + " index: " + columnIndex + "counter: " + counter);&lt;BR /&gt;	}&lt;BR /&gt;	&lt;BR /&gt;	if( (null != columnName) &amp;amp;&amp;amp; (!"".equals(columnName)) ) {&lt;BR /&gt;		if( firstRow ) { &lt;BR /&gt;			create += "\"" +columnName + "\"" + " VARCHAR ";&lt;BR /&gt;			firstRow = false;&lt;BR /&gt;		}&lt;BR /&gt;		else { &lt;BR /&gt;			create += " , " + "\"" + columnName + "\"" + " VARCHAR "; &lt;BR /&gt;		}&lt;BR /&gt;	}&lt;BR /&gt;//	System.out.println("K:" + columnName + " V:" +columnValue);&lt;BR /&gt;		counter++;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;create += " ) ";&lt;BR /&gt;if( context.ROW_LEVEL_LOGGING ) {&lt;BR /&gt;System.out.println("Generated DDL: " + create );&lt;BR /&gt;}&lt;BR /&gt;context.CREATE_TABLE_STATEMENT = create;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 May 2016 22:30:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320959#M91048</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-17T22:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table and column names to one table and rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320960#M91049</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;If you're using Talend's Enterprise version, you can use the Dynamic column type to do what you want.&amp;nbsp;&lt;BR /&gt;here's some sample code I use to generate table create statements for one of my dynamic table loaders:&lt;BR /&gt;in a tJavaFlex:&lt;BR /&gt;Begin:&lt;BR /&gt;&lt;PRE&gt;// start part of your Java code&lt;BR /&gt;int ncount=0;&lt;BR /&gt;String columnName="";&lt;BR /&gt;DynamicMetadata column;&lt;BR /&gt;&lt;BR /&gt;Boolean firstRow = true;&lt;BR /&gt;String create = "CREATE TABLE " + "\"" + context.TABLENAME + "\"" + " ( ";&lt;BR /&gt;&lt;BR /&gt;ncount=dynamic_tFileInputDelimited_2.getColumnCount();&lt;BR /&gt;int counter = 0;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;Main:&lt;BR /&gt;&lt;PRE&gt;/* Empty */&lt;/PRE&gt;&lt;BR /&gt;End:&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;for( int columnIndex = 0; columnIndex &amp;lt; ncount; columnIndex++ ) {&lt;BR /&gt;&lt;BR /&gt;	column=dynamic_tFileInputDelimited_3.getColumnMetadata(columnIndex);&lt;BR /&gt;	columnName=column.getName();&lt;BR /&gt;	if( context.ROW_LEVEL_LOGGING ) {&lt;BR /&gt;		System.out.println(columnName + " index: " + columnIndex + "counter: " + counter);&lt;BR /&gt;	}&lt;BR /&gt;	&lt;BR /&gt;	if( (null != columnName) &amp;amp;&amp;amp; (!"".equals(columnName)) ) {&lt;BR /&gt;		if( firstRow ) { &lt;BR /&gt;			create += "\"" +columnName + "\"" + " VARCHAR ";&lt;BR /&gt;			firstRow = false;&lt;BR /&gt;		}&lt;BR /&gt;		else { &lt;BR /&gt;			create += " , " + "\"" + columnName + "\"" + " VARCHAR "; &lt;BR /&gt;		}&lt;BR /&gt;	}&lt;BR /&gt;//	System.out.println("K:" + columnName + " V:" +columnValue);&lt;BR /&gt;		counter++;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;create += " ) ";&lt;BR /&gt;if( context.ROW_LEVEL_LOGGING ) {&lt;BR /&gt;System.out.println("Generated DDL: " + create );&lt;BR /&gt;}&lt;BR /&gt;context.CREATE_TABLE_STATEMENT = create;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Thanks so much John, 
&lt;BR /&gt;This looks pretty close to what I"m trying to accomplish. I think the wall I keep running into it that Open Studio can't work with dynamic schemas. I've now been playing with tMysqlColumnlist into a tSetGlobalVar trying to work around this limitation. 
&lt;BR /&gt;Have you ever been able to do something like this within the Open Studio product? With 900 connectors and even a tJavaFlex component, I seem to think it must be possible...haha 
&lt;BR /&gt; 
&lt;BR /&gt;thanks again for sharing! 
&lt;BR /&gt;Gar</description>
      <pubDate>Wed, 18 May 2016 18:42:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320960#M91049</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-18T18:42:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table and column names to one table and rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320961#M91050</link>
      <description>Talend has to give you some reason to buy it&amp;nbsp; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;with open studio you could do something similar, but you'd need to parse the file yourself and forego the use of schema's all together -- at that point you'd be writing your own program in a sense, so it may be a better idea to just do that anyway. You can still integrate it into jobs if you set it up as a Talend Routine.&amp;nbsp;</description>
      <pubDate>Wed, 18 May 2016 22:30:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320961#M91050</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-05-18T22:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table and column names to one table and rows?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320962#M91051</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;If you're using Talend's Enterprise version, you can use the Dynamic column type to do what you want.&amp;nbsp;&lt;BR /&gt;here's some sample code I use to generate table create statements for one of my dynamic table loaders:&lt;BR /&gt;in a tJavaFlex:&lt;BR /&gt;Begin:&lt;BR /&gt;&lt;PRE&gt;// start part of your Java code&lt;BR /&gt;int ncount=0;&lt;BR /&gt;String columnName="";&lt;BR /&gt;DynamicMetadata column;&lt;BR /&gt;&lt;BR /&gt;Boolean firstRow = true;&lt;BR /&gt;String create = "CREATE TABLE " + "\"" + context.TABLENAME + "\"" + " ( ";&lt;BR /&gt;&lt;BR /&gt;ncount=dynamic_tFileInputDelimited_2.getColumnCount();&lt;BR /&gt;int counter = 0;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;Main:&lt;BR /&gt;&lt;PRE&gt;/* Empty */&lt;/PRE&gt;&lt;BR /&gt;End:&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;for( int columnIndex = 0; columnIndex &amp;lt; ncount; columnIndex++ ) {&lt;BR /&gt;&lt;BR /&gt;	column=dynamic_tFileInputDelimited_3.getColumnMetadata(columnIndex);&lt;BR /&gt;	columnName=column.getName();&lt;BR /&gt;	if( context.ROW_LEVEL_LOGGING ) {&lt;BR /&gt;		System.out.println(columnName + " index: " + columnIndex + "counter: " + counter);&lt;BR /&gt;	}&lt;BR /&gt;	&lt;BR /&gt;	if( (null != columnName) &amp;amp;&amp;amp; (!"".equals(columnName)) ) {&lt;BR /&gt;		if( firstRow ) { &lt;BR /&gt;			create += "\"" +columnName + "\"" + " VARCHAR ";&lt;BR /&gt;			firstRow = false;&lt;BR /&gt;		}&lt;BR /&gt;		else { &lt;BR /&gt;			create += " , " + "\"" + columnName + "\"" + " VARCHAR "; &lt;BR /&gt;		}&lt;BR /&gt;	}&lt;BR /&gt;//	System.out.println("K:" + columnName + " V:" +columnValue);&lt;BR /&gt;		counter++;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;create += " ) ";&lt;BR /&gt;if( context.ROW_LEVEL_LOGGING ) {&lt;BR /&gt;System.out.println("Generated DDL: " + create );&lt;BR /&gt;}&lt;BR /&gt;context.CREATE_TABLE_STATEMENT = create;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;what is your input data and your workflow look like, John? 
&lt;BR /&gt;I can not imagine how the code can transform your file data. 
&lt;BR /&gt;thank you 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt;</description>
      <pubDate>Tue, 21 Jun 2016 07:42:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Dynamic-table-and-column-names-to-one-table-and-rows/m-p/2320962#M91051</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-06-21T07:42:32Z</dc:date>
    </item>
  </channel>
</rss>

