<?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: Comparing one SQL field to two Excel fields to find a match in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116329#M463253</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alec,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Say your excel file has fields, Product, CodeA and CodeB then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XLProd:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Product,&lt;/P&gt;&lt;P&gt;CodeA as Code from ExcelFile;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Load&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Product,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;CodeB as Code from ExcelFile;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;If you load from SQL with the key field Code it will associate with the field Prod in XLProd.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Cheers&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jul 2016 15:07:46 GMT</pubDate>
    <dc:creator>effinty2112</dc:creator>
    <dc:date>2016-07-21T15:07:46Z</dc:date>
    <item>
      <title>Comparing one SQL field to two Excel fields to find a match</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116326#M463250</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am building a dashboard to report the available inventory quantity for parts. In the dashboard, I take a SQL file with the quantity of parts on hand (SQL Quantity) and divide it by an Excel spreadsheet with quantities (Excel quantities) established for the locations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the problem I am having:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the Part Number in SQL does not match the Part Number in Excel, I need the Part Number in SQL to then compare itself to the Alternate Part Number in Excel. Essentially, the SQL Part Number must first compare itself to A, and if it does not find a match, I need it to compare itself to B to find a match.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody please direct me on how to accomplish this? Currently, I have the Part Number in SQL and the Part Number in Excel named the same, so Qlikview links them together as a Key. How can I create this error validation, so if SQL &amp;lt;&amp;gt; Excel A, then SQL = Excel B?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 12:52:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116326#M463250</guid>
      <dc:creator />
      <dc:date>2016-07-21T12:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one SQL field to two Excel fields to find a match</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116327#M463251</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can implement something:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;excela:&lt;/P&gt;&lt;P&gt;load a as keya,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&lt;/P&gt;&lt;P&gt;from souce;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sql:&lt;/P&gt;&lt;P&gt;load a,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&lt;/P&gt;&lt;P&gt;from sql where exist(&lt;SPAN style="font-size: 13.3333px;"&gt;keya,a);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;excelb:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;load a as keyb,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b as b1&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;from souce;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;sql:&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;load a,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;from sql where exist(&lt;SPAN style="font-size: 13.3333px;"&gt;keyb&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;,a) and not exist (&lt;SPAN style="font-size: 13.3333px;"&gt;a&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 13:29:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116327#M463251</guid>
      <dc:creator />
      <dc:date>2016-07-21T13:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one SQL field to two Excel fields to find a match</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116328#M463252</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sorry, I am confused by this. I have one column in SQL, (PartNumber) that I need to match to one column in Excel (PartNumber) and if it doesn't find a match I need it to look for a match in a separate column in Excel (AlternatePartNumber). These columns are both on the same Excel spreadsheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting confused on the 'keya', 'keyb', 'b1',etc keywords, as I think it should just be limited to the three fields above, PartNumber and AlternatePartNumber. Can you please elaborate on the proper fields? I would greatly appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alec&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 13:47:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116328#M463252</guid>
      <dc:creator />
      <dc:date>2016-07-21T13:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one SQL field to two Excel fields to find a match</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116329#M463253</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alec,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Say your excel file has fields, Product, CodeA and CodeB then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XLProd:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;Product,&lt;/P&gt;&lt;P&gt;CodeA as Code from ExcelFile;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Load&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Product,&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;CodeB as Code from ExcelFile;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;If you load from SQL with the key field Code it will associate with the field Prod in XLProd.&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Cheers&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 15:07:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116329#M463253</guid>
      <dc:creator>effinty2112</dc:creator>
      <dc:date>2016-07-21T15:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing one SQL field to two Excel fields to find a match</title>
      <link>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116330#M463254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to still be able to retain the relationship between your excel's Primary and Alternate part numbers, you might try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// First load the SQL table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SQL:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD PartNumber,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Purchased&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Parts.xlsx&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is SQL);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// Next load only the excel records that match the the SQL in the Primary (Part)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Excel:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD Part as PartNumber,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Part,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; AltPart,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Color&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Parts.xlsx&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is Excel)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WHERE exists(PartNumber,Part);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// Next load only the excel records that match the SQL in the Alternate (AltPart)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// NOTE this table will auto-concatenate because all the fields match the previous table&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Excel:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;LOAD AltPart as PartNumber,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; Part,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; AltPart,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Color&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FROM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Parts.xlsx&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(ooxml, embedded labels, table is Excel)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;WHERE exists(PartNumber, AltPart);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the test below I got the results I wanted and still was able to see the relationship between the original Primary and Alternate parts in the Excel.&lt;/P&gt;&lt;P&gt;I would lose records in the excel where neither Primary or Alternate have a match. However, I can do a third load at this point with the concatenate command to bring those missing records in from the excel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jul 2016 15:10:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Comparing-one-SQL-field-to-two-Excel-fields-to-find-a-match/m-p/1116330#M463254</guid>
      <dc:creator>deec</dc:creator>
      <dc:date>2016-07-21T15:10:26Z</dc:date>
    </item>
  </channel>
</rss>

