Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
AyCe1082
Creator
Creator

Using a looped variable in SQL load where clause?

Hi, is it possible when doing an SQL load to add a where clause that has values in an Oracle DB Column not equal to $(variable) ?

 

The variable will loop through a list of IDs so the resultant table now has rows of data for any new IDs only.

Labels (1)
  • SQL

12 Replies
AyCe1082
Creator
Creator
Author

I don't think the string method will work, the string is just too long, even with distinct IDs.

The scroll bar in the image shows just how long the ID list is (and the list will just keep growing anyway).

string.PNG

 

AyCe1082
Creator
Creator
Author

I have tried a different method and am close to the end but I have to get this last step right.

 

I have now two qvds,

The first qvd named ReportsTracker(which is created from the text file) has the unique IDs, a key I made, and a status column that is 0 or 1. It's a 1 if a filename exists in the server (so there is a PDF).

The second qvd named ReportsMain has all the data I pulled from the DB including IDs plus the key and status column manually added in after. The status column is always 0 here.

The goal is to change the values in the status column of ReportsMain from 0 to 1, if it happens to be a 1 in the ReportsTracker qvd. I know I am currently doing it wrong in the code below, as the final table is just what was in the ReportsTracker qvd. I'm wondering how to finish this and have it working? If applymap is the way to go or some type of join?

 

Main:
LOAD *
FROM
[D:\QlikView\DEV\DBQVD\Soccer\ReportsTracker.qvd]
(qvd);

Concatenate(Main)
LOAD *
FROM
[D:\QlikView\DEV\DBQVD\Soccer\ReportsMain.qvd]
(qvd)

where not exists(Reportkey);

 

 

AyCe1082
Creator
Creator
Author

Got it working with mapping load. All is good now. I don't know how to lock or delete a topic.