Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Data from Excel source has to match that found in SQL source data.

Hi,

In blue below I have an SQL script that ONLY loads Projects that are Horizontal 'ABC'.  I've reduced the script considerably for this example.  In the red I have text that brings in projects from an Excel document.  The problem is that it's bringing in ALL projects! It's cluttering up my QlikView dashboard list with irrelevant projects.  How do I effectively say in the load script "Only bring in data from Excel corresponding to Projects that are found in the SQL database"

Thanks to anyone who has any suggestions

ODBC CONNECT TO ABC_Report;

SQL SELECT *

FROM Project.par.Projects

WHERE Status = 'Live'

AND Horizontal = 'ABC'

Project,

     [Client   (Summary)],

     [Client Feedback],

FROM

(ooxml, embedded labels, table is Scorecard);

---------------------------------------------------------------------------------------------------------------

Morrison Govan UK FATCA

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Just posted a reply but apparently it has to be approved by a moderator!? I'll try again:

Assuming "Project" is an ID field present in both data sets, put this at te end of your Excel load (before the 😉

WHERE EXISTS(Project);

This will ensure the only rows loaded from Excel are those with a "Project" value that has already been loaded earlier in the script.

Hope this helps,

Jason

View solution in original post

4 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

Hi ,

Try the below code.

ODBC CONNECT TO ABC_Report;

SQL SELECT *

FROM Project.par.Projects

WHERE Status = 'Live'

AND Horizontal = 'ABC'

Left join

     [Client   (Summary)],

     [Client Feedback],

FROM

(ooxml, embedded labels, table is Scorecard);

Make sure the field name in the both table which need to be linked has the same name.

Deepak

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Assuming "Project" is your ID field present in both data sets, try this:

ODBC CONNECT TO ABC_Report;

 

SQL SELECT *

FROM Project.par.Projects

WHERE Status = 'Live'

AND Horizontal = 'ABC'

;

 

Project,

     [Client   (Summary)],

     [Client Feedback],

 

FROM

(ooxml, embedded labels, table is Scorecard)

Where Exists(Project);

 

EXISTS will ensure the only records loaded from the Excel file are those whose "Project" value has already been loaded earlier in the script.

Hope this helps,

Jason

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Just posted a reply but apparently it has to be approved by a moderator!? I'll try again:

Assuming "Project" is an ID field present in both data sets, put this at te end of your Excel load (before the 😉

WHERE EXISTS(Project);

This will ensure the only rows loaded from Excel are those with a "Project" value that has already been loaded earlier in the script.

Hope this helps,

Jason

Not applicable
Author

Thanks Jason, worked perfectly