<?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: Data quality check in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Data-quality-check/m-p/1933848#M76920</link>
    <description>&lt;P&gt;Hi, you first have to ensure that both tables has the same number of records and sorted in the same way, then you can use this cript to compare both tables:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// Variable with all field names
SET vFields ="'emp_ID','first_name','Middle initial','last_name'"; // add the needed fields

// Initialize script and result table
LET vScript ='';
ResultTable: LOAD * Inline [dumbField];

// Irerate all rows
FOR vRow=0 to NoOfRows('REF')
	// Add the comparison for each field
	FOR Each vField in $(vFields)
		LET vScript = '$(vScript)' &amp;amp; ',
  			If(Peek('&amp;amp;chr(39)&amp;amp;'REF.$(vField)'&amp;amp;chr(39)&amp;amp;',$(vRow),'&amp;amp;chr(39)&amp;amp;'REF'&amp;amp;chr(39)&amp;amp;')=Peek('&amp;amp;chr(39)&amp;amp;'TABLE1.$(vField)'&amp;amp;chr(39)&amp;amp;',$(vRow),'&amp;amp;chr(39)&amp;amp;'TABLE1'&amp;amp;chr(39)&amp;amp;'),0,1) as [chk$(vField)]';
	NEXT
	// Add results of the row to the table
	Concatenate (ResultTable)
	LOAD
		Peek('REF.emp_ID',$(vRow),'REF') as emp_ID
		$(vScript)
	AutoGenerate 1; 
	// Initialize script for next row
	LET vScript ='';
NEXT
// Drop unnecesary fields
DROP field dumbField;
// Add script to check if there was any difference in the row
LET vScript ='RangeMax(';
FOR Each vField in $(vFields)
	LET vScript = '$(vScript)' &amp;amp; '[chk$(vField)],';
NEXT
LET vScript =Left('$(vScript)',Len('$(vScript)')-1) &amp;amp; ') as hasDifferences';

// Add Result of the row to the table
Left Join (ResultTable)
LOAD emp_ID, $(vScript)
Resident ResultTable;&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 21 May 2022 07:36:59 GMT</pubDate>
    <dc:creator>rubenmarin</dc:creator>
    <dc:date>2022-05-21T07:36:59Z</dc:date>
    <item>
      <title>Data quality check</title>
      <link>https://community.qlik.com/t5/App-Development/Data-quality-check/m-p/1933842#M76919</link>
      <description>&lt;P&gt;Good Morning!&lt;/P&gt;
&lt;P&gt;I kindly need some insight about Qlik Sense Thank you&lt;/P&gt;
&lt;P&gt;I have these two tables from the company database.&lt;BR /&gt;The reference table contains the correct information desired. &lt;BR /&gt;TABLE 1 contains the same information with missing value in some fields&lt;BR /&gt;and misspellings.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="nicouek_1-1653114780489.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/79989i9DD1ACA09F779A50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="nicouek_1-1653114780489.png" alt="nicouek_1-1653114780489.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;QUESTION: Is there a way I can use Qlik Sense to automate a comparison between the 2 table's fields &lt;BR /&gt;and return rows that have mistakes in TABLE1?&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2022 06:35:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Data-quality-check/m-p/1933842#M76919</guid>
      <dc:creator>nicouek</dc:creator>
      <dc:date>2022-05-21T06:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Data quality check</title>
      <link>https://community.qlik.com/t5/App-Development/Data-quality-check/m-p/1933848#M76920</link>
      <description>&lt;P&gt;Hi, you first have to ensure that both tables has the same number of records and sorted in the same way, then you can use this cript to compare both tables:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;// Variable with all field names
SET vFields ="'emp_ID','first_name','Middle initial','last_name'"; // add the needed fields

// Initialize script and result table
LET vScript ='';
ResultTable: LOAD * Inline [dumbField];

// Irerate all rows
FOR vRow=0 to NoOfRows('REF')
	// Add the comparison for each field
	FOR Each vField in $(vFields)
		LET vScript = '$(vScript)' &amp;amp; ',
  			If(Peek('&amp;amp;chr(39)&amp;amp;'REF.$(vField)'&amp;amp;chr(39)&amp;amp;',$(vRow),'&amp;amp;chr(39)&amp;amp;'REF'&amp;amp;chr(39)&amp;amp;')=Peek('&amp;amp;chr(39)&amp;amp;'TABLE1.$(vField)'&amp;amp;chr(39)&amp;amp;',$(vRow),'&amp;amp;chr(39)&amp;amp;'TABLE1'&amp;amp;chr(39)&amp;amp;'),0,1) as [chk$(vField)]';
	NEXT
	// Add results of the row to the table
	Concatenate (ResultTable)
	LOAD
		Peek('REF.emp_ID',$(vRow),'REF') as emp_ID
		$(vScript)
	AutoGenerate 1; 
	// Initialize script for next row
	LET vScript ='';
NEXT
// Drop unnecesary fields
DROP field dumbField;
// Add script to check if there was any difference in the row
LET vScript ='RangeMax(';
FOR Each vField in $(vFields)
	LET vScript = '$(vScript)' &amp;amp; '[chk$(vField)],';
NEXT
LET vScript =Left('$(vScript)',Len('$(vScript)')-1) &amp;amp; ') as hasDifferences';

// Add Result of the row to the table
Left Join (ResultTable)
LOAD emp_ID, $(vScript)
Resident ResultTable;&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 21 May 2022 07:36:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Data-quality-check/m-p/1933848#M76920</guid>
      <dc:creator>rubenmarin</dc:creator>
      <dc:date>2022-05-21T07:36:59Z</dc:date>
    </item>
  </channel>
</rss>

