<?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 Map files to generic table using reference data in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Map-files-to-generic-table-using-reference-data/m-p/2259290#M40819</link>
    <description>Hi everyone, 
&lt;BR /&gt;I have recently been asked by my company to explore Talend as a way to perform ETL and my job right now is to create a job that imports any type of file, read it with a reference table storing its information (number of fields, separators, etc.) and stores it in a generic table after reading in a reference data table the field in the generic table each field of the original table goes to. If the explanation isn't good enough, you can check the screenshot I posted below (part that requires attention is the one after OnSubjobOk, everything else works). 
&lt;BR /&gt;&amp;nbsp; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/413939/Generic_job.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MD0Z.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/148241i16F7286B94BE04ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MD0Z.jpg" alt="0683p000009MD0Z.jpg" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;I can already successfully import the files, read the information on their separators in REF_FILE_MAPPING, store all the information in a GENERIC_FILE_LOAD table and have the reference data in REF_FIELD_MAPPING with, among other columns, FIELD_NAME (field name of original file) and MAPS_TO (field of the final table GENERIC_FILE that field goes to). 
&lt;BR /&gt;But I'm having troubles in how to do this mapping from a conceptual and also programming level. I tried to do it with tMap but I couldn't figure it out. I also come from MATLAB where I could just access tables with 
&lt;BR /&gt; 
&lt;PRE&gt;tablename[][] and I was expecting to do it with, say row6&lt;I&gt;&amp;lt;J&amp;gt;=something&amp;lt;/J&amp;gt;&lt;/I&gt;&lt;/PRE&gt; 
&lt;BR /&gt;but that doesn't work and I don't know how I can access the tables I import with tOracleInput. 
&lt;BR /&gt;My code on t_JavaFlex_2 is: 
&lt;BR /&gt; 
&lt;PRE&gt;&lt;B&gt;Start code:&lt;/B&gt;&lt;BR /&gt;int NumFields = Integer.parseInt(globalMap.get("NumFields").toString());&lt;BR /&gt;int NumRecords = (Integer) globalMap.get("tFileRowCount_1_COUNT");&lt;BR /&gt;String[] GenHeader=new String;&lt;BR /&gt;&lt;B&gt;Main code:&lt;/B&gt;&lt;BR /&gt;row6.FILE_NAME = (String)globalMap.get("tFileList_1_CURRENT_FILE");&lt;BR /&gt;row6.PROCESSED_DATE_TIME=TalendDate.getCurrentDate();&lt;BR /&gt;//row6.LOAD_TIMESTAMP=Integer.parseInt(globalMap.get("LoadTimestamp").toString());&lt;BR /&gt;&lt;BR /&gt;for (int i=2; i&amp;lt;NumFields;i++){&lt;BR /&gt;GenHeader&lt;I&gt;="COL" + StringHandling.RIGHT("00"+(i-1), 2); //Generic Columns on both GENERIC_FILE_LOAD AND GENERIC_FILE are called COLXX&lt;BR /&gt;};&lt;BR /&gt;for (int i=1; i&amp;lt;NumFields; i++){ //Not wanting the Header&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for (int j=2; j&amp;lt;NumFields; j++){ //First two columns are already stored before&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;boolean test=true;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (int k=1; k&amp;lt;NumFields-1 &amp;amp;&amp;amp; test; k++){ //iterating lines of REF_FIELD_MAPPING&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (row5&amp;lt;K&amp;gt;==GenHeader&amp;lt;J&amp;gt;) //Column 3 of row5 is FIELD_NAME&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {test=false;};&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; row6&lt;I&gt;]=row3&lt;I&gt;&amp;lt;J&amp;gt;; //Column 7 of row5 is MAPS_TO&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;};&amp;lt;/J&amp;gt;&lt;/I&gt;&lt;/I&gt;&amp;lt;/J&amp;gt;&amp;lt;/K&amp;gt;&lt;/I&gt;&lt;/PRE&gt; 
&lt;BR /&gt;If this is too confusing, feel free to ask for further information. 
&lt;BR /&gt;Thank you!</description>
    <pubDate>Wed, 18 Jan 2017 11:11:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-01-18T11:11:38Z</dc:date>
    <item>
      <title>Map files to generic table using reference data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Map-files-to-generic-table-using-reference-data/m-p/2259290#M40819</link>
      <description>Hi everyone, 
&lt;BR /&gt;I have recently been asked by my company to explore Talend as a way to perform ETL and my job right now is to create a job that imports any type of file, read it with a reference table storing its information (number of fields, separators, etc.) and stores it in a generic table after reading in a reference data table the field in the generic table each field of the original table goes to. If the explanation isn't good enough, you can check the screenshot I posted below (part that requires attention is the one after OnSubjobOk, everything else works). 
&lt;BR /&gt;&amp;nbsp; 
&lt;A href="https://community.talend.com/legacyfs/online/membersTempo/413939/Generic_job.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MD0Z.jpg"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/148241i16F7286B94BE04ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MD0Z.jpg" alt="0683p000009MD0Z.jpg" /&gt;&lt;/span&gt; &lt;/A&gt; 
&lt;BR /&gt;I can already successfully import the files, read the information on their separators in REF_FILE_MAPPING, store all the information in a GENERIC_FILE_LOAD table and have the reference data in REF_FIELD_MAPPING with, among other columns, FIELD_NAME (field name of original file) and MAPS_TO (field of the final table GENERIC_FILE that field goes to). 
&lt;BR /&gt;But I'm having troubles in how to do this mapping from a conceptual and also programming level. I tried to do it with tMap but I couldn't figure it out. I also come from MATLAB where I could just access tables with 
&lt;BR /&gt; 
&lt;PRE&gt;tablename[][] and I was expecting to do it with, say row6&lt;I&gt;&amp;lt;J&amp;gt;=something&amp;lt;/J&amp;gt;&lt;/I&gt;&lt;/PRE&gt; 
&lt;BR /&gt;but that doesn't work and I don't know how I can access the tables I import with tOracleInput. 
&lt;BR /&gt;My code on t_JavaFlex_2 is: 
&lt;BR /&gt; 
&lt;PRE&gt;&lt;B&gt;Start code:&lt;/B&gt;&lt;BR /&gt;int NumFields = Integer.parseInt(globalMap.get("NumFields").toString());&lt;BR /&gt;int NumRecords = (Integer) globalMap.get("tFileRowCount_1_COUNT");&lt;BR /&gt;String[] GenHeader=new String;&lt;BR /&gt;&lt;B&gt;Main code:&lt;/B&gt;&lt;BR /&gt;row6.FILE_NAME = (String)globalMap.get("tFileList_1_CURRENT_FILE");&lt;BR /&gt;row6.PROCESSED_DATE_TIME=TalendDate.getCurrentDate();&lt;BR /&gt;//row6.LOAD_TIMESTAMP=Integer.parseInt(globalMap.get("LoadTimestamp").toString());&lt;BR /&gt;&lt;BR /&gt;for (int i=2; i&amp;lt;NumFields;i++){&lt;BR /&gt;GenHeader&lt;I&gt;="COL" + StringHandling.RIGHT("00"+(i-1), 2); //Generic Columns on both GENERIC_FILE_LOAD AND GENERIC_FILE are called COLXX&lt;BR /&gt;};&lt;BR /&gt;for (int i=1; i&amp;lt;NumFields; i++){ //Not wanting the Header&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; for (int j=2; j&amp;lt;NumFields; j++){ //First two columns are already stored before&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;boolean test=true;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for (int k=1; k&amp;lt;NumFields-1 &amp;amp;&amp;amp; test; k++){ //iterating lines of REF_FIELD_MAPPING&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (row5&amp;lt;K&amp;gt;==GenHeader&amp;lt;J&amp;gt;) //Column 3 of row5 is FIELD_NAME&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {test=false;};&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; row6&lt;I&gt;]=row3&lt;I&gt;&amp;lt;J&amp;gt;; //Column 7 of row5 is MAPS_TO&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;};&amp;lt;/J&amp;gt;&lt;/I&gt;&lt;/I&gt;&amp;lt;/J&amp;gt;&amp;lt;/K&amp;gt;&lt;/I&gt;&lt;/PRE&gt; 
&lt;BR /&gt;If this is too confusing, feel free to ask for further information. 
&lt;BR /&gt;Thank you!</description>
      <pubDate>Wed, 18 Jan 2017 11:11:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Map-files-to-generic-table-using-reference-data/m-p/2259290#M40819</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-01-18T11:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Map files to generic table using reference data</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Map-files-to-generic-table-using-reference-data/m-p/2259291#M40820</link>
      <description>Hi 
&lt;BR /&gt;Take a look d 
&lt;A href="https://help.talend.com/pages/viewpage.action?pageId=190513179&amp;amp;focusedCommentId=269544791&amp;amp;#comment-269544791" target="_blank" rel="nofollow noopener noreferrer"&gt;ynamic schema&lt;/A&gt; feature which is only available in enterprise subscription product, you might be interesting in it. 
&lt;BR /&gt;Regards 
&lt;BR /&gt;Shong</description>
      <pubDate>Mon, 13 Feb 2017 02:15:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Map-files-to-generic-table-using-reference-data/m-p/2259291#M40820</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-13T02:15:21Z</dc:date>
    </item>
  </channel>
</rss>

