<?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 Compare columns from DB and File in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Compare-columns-from-DB-and-File/m-p/2216872#M12696</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have a scenario where I need to compare the data from file with data in DB. In file there are 13 columns and in data from DB there are 9 columns. I need to check if the value for 6 columns are same in DB and in file.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;So, below are steps I have performed:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;1) Get data from DB&lt;/P&gt; 
&lt;P&gt;2) Get data from file using file delimited component&lt;/P&gt; 
&lt;P&gt;3) Perform Unique match and Inner join on the 6 columns between DB and file in TMAP component (i.e. from input tmap).&lt;/P&gt; 
&lt;P&gt;4) Also created 6 variables (variables section in tmap) which performs a check to see if columns are same, for example :&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;row3.id&amp;nbsp;== row4.ID? true : false&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;row3.cust == row4.CUST ? true : false&lt;/P&gt; 
&lt;P&gt;5) There are 2 outputs: Accepts and Rejects&lt;/P&gt; 
&lt;P&gt;6) In expression filters for Accepts : Added all 6 variables created with "&amp;amp;&amp;amp;" i.e. AND condition between the variables so that Accepts should have all the variables which have succeeded.&lt;/P&gt; 
&lt;P&gt;7) In output section of tmap for Rejects, have set both "Catch Output Reject" and "Catch Inner join Reject" to true.&lt;/P&gt; 
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; Store the above outputs i.e. Accepts and Rejects to thashoutput.&lt;/P&gt; 
&lt;P&gt;9) Also in Rejects, I have created a new variable "failure_reason" which contains the reason for failure. Example, please see below:&lt;/P&gt; 
&lt;P&gt;(Var.var1 ? "" : "id value does not match between db and ftp. FTP value : " +row4.ID+" and DB value : " + row3.id +" ; ") +&lt;BR /&gt;(Var.var2 ? "" : "cust value does not match between db and ftp. FTP value : " +row4.CUST+" and DB value : " + row3.cust +" ; ")&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The problem is that I do not see the above steps performing comparison of data between file and DB correctly. I see that the outputs are not as expected (or in short the comparison is not as expected because I know what DB and file data contain).&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Can anyone please let me know how to check if data from file and DB are same ?&lt;/P&gt;</description>
    <pubDate>Thu, 01 Nov 2018 10:28:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-11-01T10:28:10Z</dc:date>
    <item>
      <title>Compare columns from DB and File</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-columns-from-DB-and-File/m-p/2216872#M12696</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I have a scenario where I need to compare the data from file with data in DB. In file there are 13 columns and in data from DB there are 9 columns. I need to check if the value for 6 columns are same in DB and in file.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;So, below are steps I have performed:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;1) Get data from DB&lt;/P&gt; 
&lt;P&gt;2) Get data from file using file delimited component&lt;/P&gt; 
&lt;P&gt;3) Perform Unique match and Inner join on the 6 columns between DB and file in TMAP component (i.e. from input tmap).&lt;/P&gt; 
&lt;P&gt;4) Also created 6 variables (variables section in tmap) which performs a check to see if columns are same, for example :&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;row3.id&amp;nbsp;== row4.ID? true : false&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;row3.cust == row4.CUST ? true : false&lt;/P&gt; 
&lt;P&gt;5) There are 2 outputs: Accepts and Rejects&lt;/P&gt; 
&lt;P&gt;6) In expression filters for Accepts : Added all 6 variables created with "&amp;amp;&amp;amp;" i.e. AND condition between the variables so that Accepts should have all the variables which have succeeded.&lt;/P&gt; 
&lt;P&gt;7) In output section of tmap for Rejects, have set both "Catch Output Reject" and "Catch Inner join Reject" to true.&lt;/P&gt; 
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; Store the above outputs i.e. Accepts and Rejects to thashoutput.&lt;/P&gt; 
&lt;P&gt;9) Also in Rejects, I have created a new variable "failure_reason" which contains the reason for failure. Example, please see below:&lt;/P&gt; 
&lt;P&gt;(Var.var1 ? "" : "id value does not match between db and ftp. FTP value : " +row4.ID+" and DB value : " + row3.id +" ; ") +&lt;BR /&gt;(Var.var2 ? "" : "cust value does not match between db and ftp. FTP value : " +row4.CUST+" and DB value : " + row3.cust +" ; ")&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The problem is that I do not see the above steps performing comparison of data between file and DB correctly. I see that the outputs are not as expected (or in short the comparison is not as expected because I know what DB and file data contain).&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Can anyone please let me know how to check if data from file and DB are same ?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 10:28:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-columns-from-DB-and-File/m-p/2216872#M12696</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-01T10:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: Compare columns from DB and File</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Compare-columns-from-DB-and-File/m-p/2216873#M12697</link>
      <description>Depending on the datatype for each field, you have to use the appropriate method for comparison such as String.equals for strings and so on.
&lt;BR /&gt;You may also share your tMap and sample data with expected result.</description>
      <pubDate>Thu, 01 Nov 2018 13:58:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Compare-columns-from-DB-and-File/m-p/2216873#M12697</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2018-11-01T13:58:24Z</dc:date>
    </item>
  </channel>
</rss>

