<?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: How to store part of file name in MySQL table using Talend in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-store-part-of-file-name-in-MySQL-table-using-Talend/m-p/2287718#M61278</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Connect a tJava after the tFileList you us eto iterate over the file list.&lt;BR /&gt;Add a field called accountName (for example) to your output schema in this component.&lt;BR /&gt;Use the following code:&lt;/P&gt;
&lt;PRE&gt;int start = (String)globalMap.get("&lt;SPAN&gt;tFileList_1_CURRENT_FILE&lt;/SPAN&gt;").indexOf("_")+1;
start = (String)globalMap.get("&lt;SPAN&gt;tFileList_1_CURRENT_FILE&lt;/SPAN&gt;").indexOf("_", start)+1; &lt;BR /&gt;int end = input_row.filename.indexOf("_", start); &lt;BR /&gt;globalMap.put("client", (String)globalMap.get("&lt;SPAN&gt;tFileList_1_CURRENT_FILE&lt;/SPAN&gt;").substring(start, end));&lt;/PRE&gt;
&lt;P&gt;Now you are able to reuse this global variable to populate the client column of your table.&lt;/P&gt;
&lt;P&gt;You just have to a new field to the schema after the tFileInputDelimited using a tJavaRow or a traditional tMap.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this help.&lt;/P&gt;</description>
    <pubDate>Sat, 24 Feb 2018 16:50:04 GMT</pubDate>
    <dc:creator>TRF</dc:creator>
    <dc:date>2018-02-24T16:50:04Z</dc:date>
    <item>
      <title>How to store part of file name in MySQL table using Talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-store-part-of-file-name-in-MySQL-table-using-Talend/m-p/2287716#M61276</link>
      <description>&lt;P&gt;Hello Folks,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have a files something like below,&lt;/P&gt; 
&lt;P&gt;unicsv_unibill_BrandEnergy_3667_20180201_IIQ473894_2182018112138PM_1.txt&lt;/P&gt; 
&lt;P&gt;unicsv_unibill_Envestnet_927133_20180131_IIQ473100_214201823011PM_1.txt&lt;/P&gt; 
&lt;P&gt;etc.,&lt;/P&gt; 
&lt;P&gt;And I want to store particular string value in the above case it is BrandEnergy and Envestnet - in MySQL database table for each file.&lt;/P&gt; 
&lt;P&gt;For example first file will have 10 records and in the my table I have column called 'Client' and 'BrandEnergy' value should be stored in all 10 records.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Can any one help with this please?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards,&lt;/P&gt; 
&lt;P&gt;Deepak&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 08:38:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-store-part-of-file-name-in-MySQL-table-using-Talend/m-p/2287716#M61276</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T08:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to store part of file name in MySQL table using Talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-store-part-of-file-name-in-MySQL-table-using-Talend/m-p/2287717#M61277</link>
      <description>&lt;P&gt;Hi Deepak1&lt;/P&gt; 
&lt;P&gt;Using a tfileList to iterate each file, there is a global variable stores the file name, extract the client value from the file name and store it to a context variable for used later, the job design looks like:&lt;/P&gt; 
&lt;P&gt;tFileList--iterate--tJava--tFileInputDelimited--main--tMap---tMysqlOutput&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;on tJava, extract the client value from the file name and store it to a context variable, eg:&lt;/P&gt; 
&lt;P&gt;String file_name=((String)globalMap.get("tFileList_1_CURRENT_FILE"));&lt;/P&gt; 
&lt;P&gt;String temp_string=foo.replace("unicsv_unibill_", "");&lt;BR /&gt;context.client_name=&lt;SPAN&gt;temp_string&lt;/SPAN&gt;.substring(0, &lt;SPAN&gt;temp_string&lt;/SPAN&gt;.indexOf('_'));&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;tFileInputDelimited: read the records from the file.&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN&gt;tMap: add a new column on the output table, and set its expression as: context.client_name&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards&lt;/P&gt; 
&lt;P&gt;Shong&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2018 09:04:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-store-part-of-file-name-in-MySQL-table-using-Talend/m-p/2287717#M61277</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-24T09:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to store part of file name in MySQL table using Talend</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-store-part-of-file-name-in-MySQL-table-using-Talend/m-p/2287718#M61278</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Connect a tJava after the tFileList you us eto iterate over the file list.&lt;BR /&gt;Add a field called accountName (for example) to your output schema in this component.&lt;BR /&gt;Use the following code:&lt;/P&gt;
&lt;PRE&gt;int start = (String)globalMap.get("&lt;SPAN&gt;tFileList_1_CURRENT_FILE&lt;/SPAN&gt;").indexOf("_")+1;
start = (String)globalMap.get("&lt;SPAN&gt;tFileList_1_CURRENT_FILE&lt;/SPAN&gt;").indexOf("_", start)+1; &lt;BR /&gt;int end = input_row.filename.indexOf("_", start); &lt;BR /&gt;globalMap.put("client", (String)globalMap.get("&lt;SPAN&gt;tFileList_1_CURRENT_FILE&lt;/SPAN&gt;").substring(start, end));&lt;/PRE&gt;
&lt;P&gt;Now you are able to reuse this global variable to populate the client column of your table.&lt;/P&gt;
&lt;P&gt;You just have to a new field to the schema after the tFileInputDelimited using a tJavaRow or a traditional tMap.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this help.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2018 16:50:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-store-part-of-file-name-in-MySQL-table-using-Talend/m-p/2287718#M61278</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2018-02-24T16:50:04Z</dc:date>
    </item>
  </channel>
</rss>

