Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
mfarsln
Creator II
Creator II

Sql 'Apply' in Qlik

Hi!

I have an app in which i'm executing a sql query and then storing its data in a qvd file. For the sake of simplicity, it something like that;

xte.PNG

In this query i'm checking if a string in table2 contains any substring in cte table's words_ column. I have more than one cte blocks like that and more than one apply operator which do the same thing like in this picture.

So what do i want to do is that seperating those cte blocks and store every one of them in seperate qvd files. Then apply the same logic but with taking the data from the seperate qvd files. Basically, i want to use the logic behind the apply here and then use 'like' operator to specify the condition.

Labels (3)
2 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

You can use the exists statemnt (equaly as in SQL) to check if the table1 values are in table2 like so:

QUALIFY *;

filter_cte:
Load * Inline
[
ID,words
1,aaaa
2,bbbb
3,cccc
];

UNQUALIFY *;

table2:
Load * Inline
[
ID,words
4,dddd
5,eeee
3,cccc
];

NoConcatenate
table2_select:
LOAD
ID,
words
Resident
table2
where
exists(filter_cte.words,words);

drop table table2;

This will only load the ID 3, words cccc to the result.
Hope it helps,

Felipe.
mfarsln
Creator II
Creator II
Author

Thanks for your reply.

But it doesn't check whether a string from table2 includes a substring from table1. It gives result if only two fields are exactly same.