<?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: Check for alternate records in a file in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332760#M101606</link>
    <description>Shong, 
&lt;BR /&gt;Thanks for the update. 
&lt;BR /&gt;But the problem is that, the number of lines of the input file may vary time to time. It is not a constant. 
&lt;BR /&gt;Can u please upload the images. 
&lt;BR /&gt;Thanks and Regards, 
&lt;BR /&gt;Amirths</description>
    <pubDate>Wed, 01 Apr 2009 09:24:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2009-04-01T09:24:09Z</dc:date>
    <item>
      <title>Check for alternate records in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332758#M101604</link>
      <description>Hai, 
&lt;BR /&gt;I have a positional file as follows 
&lt;BR /&gt;Header 
&lt;BR /&gt;G221ABCDEFGH100 
&lt;BR /&gt;G222XYZJHDJHK200 
&lt;BR /&gt;G221JHJHDSUEE300 
&lt;BR /&gt;G222HFGTYKJDK400 
&lt;BR /&gt;Trailer4 
&lt;BR /&gt;1. Here I need to check whether the total number of records (excluding Header and Trailer) is equal to that given in the Trailer 
&lt;BR /&gt;2. Check if the alternate records are G221 and G222 (G221 must be followed by a G222) 
&lt;BR /&gt;Here 
&lt;BR /&gt;1. First line is the header record 
&lt;BR /&gt;2. Second is a G221 record, name (ABCDEFGH) and balance amt (100) 
&lt;BR /&gt;3. Third is a G222 record, name (XYZJHDJHK) and balance amt (200) 
&lt;BR /&gt;4. Final line is the Trailer record which has the total number of G221 and G222 records in the file 
&lt;BR /&gt;Please help me, how I can achieve this. 
&lt;BR /&gt;Thanks and regards, 
&lt;BR /&gt;Amirths</description>
      <pubDate>Sat, 16 Nov 2024 14:00:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332758#M101604</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T14:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Check for alternate records in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332759#M101605</link>
      <description>Hello Amirths 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;1. Here I need to check whether the total number of records (excluding Header and Trailer) is equal to that given in the Trailer&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;1) Use tFileRowCount to count the total lines, eg: there are 6 lines in file, so we can get the total number of records are 4=6-2. 
&lt;BR /&gt;2) tFileInputFullRow----&amp;gt;tSampleRow--&amp;gt;tJavaRow 
&lt;BR /&gt;tFileInputFullRow: to read the whole line at a time 
&lt;BR /&gt;tSampleRow: set the range as "6" to read only the last line(trailer) 
&lt;BR /&gt;tJavaRow: parse this line and get the total number, eg: String totalNumber=row1.line.substring(7), then int line=Integer.parseInt(totalNumber), so now we can compare line with total number from step 1. 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;2. Check if the alternate records are G221 and G222 (G221 must be followed by a G222)&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;tFileInputFullRow(read the whole line at a time)----&amp;gt;tSampleRow (set range as "2..total number-1") to read only the detaild record excluding header and trailer, then check the lines on 1,3,5...if start with G221, check the lines on 2,4,6...if start with G222. 
&lt;BR /&gt;Best regards 
&lt;BR /&gt; 
&lt;BR /&gt; shong</description>
      <pubDate>Wed, 01 Apr 2009 08:06:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332759#M101605</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-01T08:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Check for alternate records in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332760#M101606</link>
      <description>Shong, 
&lt;BR /&gt;Thanks for the update. 
&lt;BR /&gt;But the problem is that, the number of lines of the input file may vary time to time. It is not a constant. 
&lt;BR /&gt;Can u please upload the images. 
&lt;BR /&gt;Thanks and Regards, 
&lt;BR /&gt;Amirths</description>
      <pubDate>Wed, 01 Apr 2009 09:24:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332760#M101606</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-01T09:24:09Z</dc:date>
    </item>
    <item>
      <title>Re: Check for alternate records in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332761#M101607</link>
      <description>Hello 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;But the problem is that, the number of lines of the input file may vary time to time. It is not a constant.&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Yes, I know, so use the tFileRowCount to count the number of lines first. 
&lt;BR /&gt;Best regards 
&lt;BR /&gt; 
&lt;BR /&gt; shong</description>
      <pubDate>Wed, 01 Apr 2009 11:20:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332761#M101607</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-01T11:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Check for alternate records in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332762#M101608</link>
      <description>Hi Shong, 
&lt;BR /&gt;How can I specify the values "1,3,5....." in tSampleRow 
&lt;BR /&gt;(Read only the Odd line no's till end of file) 
&lt;BR /&gt;Is there any way to describe that. 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Amirths</description>
      <pubDate>Tue, 07 Apr 2009 07:56:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332762#M101608</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-07T07:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Check for alternate records in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332763#M101609</link>
      <description>Hello Amirths 
&lt;BR /&gt;I create a job to show you: 
&lt;BR /&gt;Check if the alternate records are G221 and G222 (G221 must be followed by a G222), if it satisfy this condition, the file is validate, otherwise it is not. 
&lt;BR /&gt;Input file: 
&lt;BR /&gt; 
&lt;B&gt;&lt;BR /&gt;Header&lt;BR /&gt;G221ABCDEFGH100&lt;BR /&gt;G222XYZJHDJHK200&lt;BR /&gt;G221JHJHDSUEE300&lt;BR /&gt;G222HFGTYKJDK400&lt;BR /&gt;G221JHJHDSUEE500&lt;BR /&gt;G222HFGTYKJDK600&lt;BR /&gt;Trailer6&lt;BR /&gt;&lt;/B&gt; 
&lt;BR /&gt;Result: 
&lt;BR /&gt; 
&lt;PRE&gt;Starting job forum6057 at 16:31 07/04/2009.&lt;BR /&gt;The total lines is: 8&lt;BR /&gt;The range expression in tSampleRow is: 2..7&lt;BR /&gt;.--+----------------.&lt;BR /&gt;|     tLogRow_1     |&lt;BR /&gt;|=-+---------------=|&lt;BR /&gt;|id|line            |&lt;BR /&gt;|=-+---------------=|&lt;BR /&gt;|1 |G221ABCDEFGH100 |&lt;BR /&gt;|2 |G222XYZJHDJHK200|&lt;BR /&gt;|3 |G221JHJHDSUEE300|&lt;BR /&gt;|4 |G222HFGTYKJDK400|&lt;BR /&gt;|5 |G221JHJHDSUEE500|&lt;BR /&gt;|6 |G222HFGTYKJDK600|&lt;BR /&gt;'--+----------------'&lt;BR /&gt;The file is validate?true&lt;BR /&gt;Job forum6057 ended at 16:31 07/04/2009. &lt;/PRE&gt; 
&lt;BR /&gt;Best regards 
&lt;BR /&gt; 
&lt;BR /&gt; shong</description>
      <pubDate>Tue, 07 Apr 2009 09:40:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332763#M101609</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-07T09:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Check for alternate records in a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332764#M101610</link>
      <description>Thanks a lot SHONG........That is working fine....... 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Amirths</description>
      <pubDate>Tue, 07 Apr 2009 10:52:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Check-for-alternate-records-in-a-file/m-p/2332764#M101610</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-04-07T10:52:40Z</dc:date>
    </item>
  </channel>
</rss>

