<?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: Transforming Complex Flat File in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281186#M55799</link>
    <description>&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/0053p000007LKj7AAG"&gt;@TRF&lt;/A&gt;&amp;nbsp; That's great thank you very much &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;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 06 Oct 2019 13:27:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-10-06T13:27:24Z</dc:date>
    <item>
      <title>Transforming Complex Flat File</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281182#M55795</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have a flat file which has format something like below,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;Location{Year{Working_Days_Month1{Working_Days_Month2...{Working_Days_Month12
CHE{2019{111110011111001111100111110011{111110011111001111100111110....{111110011111001111100111110011&lt;/PRE&gt; 
&lt;DIV class="post-text"&gt; 
 &lt;P&gt;I need to transform the above data to a table or json as below with following columns,&lt;/P&gt; 
 &lt;P&gt;Column 1 - Location&lt;/P&gt; 
 &lt;P&gt;Column 2 - Year&lt;/P&gt; 
 &lt;P&gt;Column 3 - Month{1-12)&lt;/P&gt; 
 &lt;P&gt;Column 4 - Days (1-31)&lt;/P&gt; 
 &lt;P&gt;Column 5 - Working Days of Particular Month ( 1 or 0 based on number of days present in flat file)&lt;/P&gt; 
&lt;/DIV&gt; 
&lt;DIV class="post-taglist grid gs4 gsy fd-column"&gt;
  &amp;nbsp; 
&lt;/DIV&gt; 
&lt;DIV class="post-taglist grid gs4 gsy fd-column"&gt;
  Could you please guide me a best approach for designing and developing this kind of transformation using talend. 
&lt;/DIV&gt; 
&lt;DIV class="post-taglist grid gs4 gsy fd-column"&gt;
  &amp;nbsp; 
&lt;/DIV&gt; 
&lt;DIV class="post-taglist grid gs4 gsy fd-column"&gt;
  Thank you in advance. 
&lt;/DIV&gt; 
&lt;DIV class="post-taglist grid gs4 gsy fd-column"&gt;
  &amp;nbsp; 
&lt;/DIV&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:27:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281182#M55795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T04:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Transforming Complex Flat File</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281183#M55796</link>
      <description>&lt;P&gt;Get file records using tFileInputDelimited with "{" for the field separator and the following schema (to be continued with months 5 to 12):&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="schema.png" style="width: 525px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M86s.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/136971iDD4F9F5E78E1ACCD/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M86s.png" alt="0683p000009M86s.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Connect&amp;nbsp;tFileInputDelimited to tSplitRow component.&lt;/P&gt; 
&lt;P&gt;Define the output schema for this component like this:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tSplitRow.png" style="width: 977px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M86x.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/153600iC80B389286623FD4/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M86x.png" alt="0683p000009M86x.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Define tSplitRow setting like thisDefine the output schema for this component like this&amp;nbsp;(to be continued with months 5 to 12):&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tSplitRow.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M7aD.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/145801i45BFB5F03CCC003F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M7aD.png" alt="0683p000009M7aD.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;As you can see, days value for february depends on year value for leap years.&lt;/P&gt; 
&lt;P&gt;In case of records are termined by "}}}}}}}}}}}}}", just change the expression for workingDays field on line 12 with the following:&lt;/P&gt; 
&lt;PRE&gt;row30.workingDaysMonth12.replaceAll("}", "")&lt;/PRE&gt; 
&lt;P&gt;Here is the result:&lt;/P&gt; 
&lt;PRE&gt;.--------+----+-----+----+------------------------------.
|                      tLogRow_11                       |
|=-------+----+-----+----+-----------------------------=|
|location|year|month|days|workingDays                   |
|=-------+----+-----+----+-----------------------------=|
|CHE     |2020|1    |31  |111110011111001111100111110011|
|CHE     |2020|2    |29  |111110011111001111100111110   |
|CHE     |2020|3    |31  |111110011111001111100111110011|
|CHE     |2020|4    |30  |...                           |
'--------+----+-----+----+------------------------------'&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 05 Oct 2019 11:37:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281183#M55796</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2019-10-05T11:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Transforming Complex Flat File</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281184#M55797</link>
      <description>&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/0053p000007LKj7AAG"&gt;@TRF&lt;/A&gt;&amp;nbsp; Thank you Very Much for your solution approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It partially covered my scenario, but i would like know is there any way to iterate values in working days cell to insert it as column. My out table will be something like shown in the picture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please let me know how we can iterate values within working days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LwxB"&gt;ComplexFlatFileTransformation.JPG&lt;/A&gt;</description>
      <pubDate>Sun, 06 Oct 2019 07:10:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281184#M55797</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-06T07:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Transforming Complex Flat File</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281185#M55798</link>
      <description>&lt;P&gt;Here it is:&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="job.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M7wO.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/129797i2923878F1BF1B431/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M7wO.png" alt="0683p000009M7wO.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;Starting from the previous job design, add the following component after tSplitRow:&lt;/P&gt; 
&lt;UL&gt; 
 &lt;LI&gt;&lt;STRONG&gt;tFlowToIterate to start iteration for each input row&lt;/STRONG&gt;&lt;BR /&gt;It will generate a global variable for each input field.&lt;BR /&gt;Don't change anything from the default settings, the variable names will be based on the row name + the field name (for example in my case "row31.year").&lt;/LI&gt; 
 &lt;LI&gt;&lt;STRONG&gt;tLoop start a "for" loop from 1 to the number of days in the current month&lt;/STRONG&gt;&lt;BR /&gt;Just change the "To" parameter from the default settings and it with the following expression (change "row31" by your tSplitRow output name):&lt;BR /&gt;&lt;PRE&gt;((Integer)globalMap.get("row31.days"))&lt;/PRE&gt;&lt;/LI&gt; 
 &lt;LI&gt;&lt;STRONG&gt;tIterateToFlow to generate outflow from current values&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tIterate.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M7kv.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/141264i3615916E56C0B048/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M7kv.png" alt="0683p000009M7kv.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/LI&gt; 
 &lt;LI&gt;tLogRow to display the result&lt;BR /&gt;&lt;PRE&gt;.--------+----+-----+---+----------.
|            tLogRow_11            |
|=-------+----+-----+---+---------=|
|location|year|month|day|workingDay|
|=-------+----+-----+---+---------=|
|CHE     |2019|1    |1  |1         |
|CHE     |2019|1    |2  |1         |
|CHE     |2019|1    |3  |1         |
|CHE     |2019|1    |4  |1         |
|CHE     |2019|1    |5  |1         |
|CHE     |2019|1    |6  |0         |
|CHE     |2019|1    |7  |0         |
|CHE     |2019|1    |8  |1         |
...
|CHE     |2019|1    |30 |1         |
|CHE     |2019|1    |31 |1         |
|CHE     |2019|2    |1  |1         |
|CHE     |2019|2    |2  |1         |
|CHE     |2019|2    |3  |1         |
...
|CHE     |2019|2    |27 |0         |
|CHE     |2019|2    |28 |0         |
|CHE     |2019|3    |1  |1         |
|CHE     |2019|3    |2  |1         |
|CHE     |2019|3    |3  |1         |
...
'--------+----+-----+---+----------'&lt;/PRE&gt;&lt;/LI&gt; 
&lt;/UL&gt; 
&lt;P&gt;That's all.&lt;/P&gt; 
&lt;P&gt;Just take care of the input file values for "workingDaysMonth" fields which must be valid regarding on the number of "010" (could be checked after tSplitRow as at this stage you know the number of days per month including for leap years).&lt;/P&gt;</description>
      <pubDate>Sun, 06 Oct 2019 11:06:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281185#M55798</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2019-10-06T11:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Transforming Complex Flat File</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281186#M55799</link>
      <description>&lt;P&gt;&lt;A href="https://community.qlik.com/s/profile/0053p000007LKj7AAG"&gt;@TRF&lt;/A&gt;&amp;nbsp; That's great thank you very much &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;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 Oct 2019 13:27:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Transforming-Complex-Flat-File/m-p/2281186#M55799</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-06T13:27:24Z</dc:date>
    </item>
  </channel>
</rss>

