Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Selecting data from a qvd file using wildcards

Hi,

I have a need to select data from a QVD file based on the contents of an excel spreadsheet, the added complication is that I need to match only on part of the string, I can build the string from the spreadsheet ok.

Example:

// String build from Spreadsheet

LET String="a like 'fre%' or a like 'ber%'"

In SQL speak I could do

select a, b, c
from table
where ($(String));

Is there a way of doing it from a QVD file ?

Thanks

Tony

1 Solution

Accepted Solutions
disqr_rm
Partner - Specialist III
Partner - Specialist III

Hi Tony,

Yes, that would work in SQL but in QV you would need to use MATCH() or WILDMATCH() functions. So something like below should work fine:


let mask1 = chr(39) & 'fre*' & chr(39);
let mask2 = chr(39) & 'ber*' & chr(39);
LET String = 'WILDMATCH(a, ' & mask1 & ') > 0 OR WILDMATCH(a, ' & mask2 & ') > 0' ;
LOAD a FROM a.qvd (qvd)
WHERE $(String);


View solution in original post

3 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

Hi Tony,

Yes, that would work in SQL but in QV you would need to use MATCH() or WILDMATCH() functions. So something like below should work fine:


let mask1 = chr(39) & 'fre*' & chr(39);
let mask2 = chr(39) & 'ber*' & chr(39);
LET String = 'WILDMATCH(a, ' & mask1 & ') > 0 OR WILDMATCH(a, ' & mask2 & ') > 0' ;
LOAD a FROM a.qvd (qvd)
WHERE $(String);


Not applicable
Author

The following code should help...

LOAD * FROM FileName.QVD (qvd) WHERE WILDMATCH(FieldName, '*ZZ*');


Not applicable
Author

Thanks That worked perfectly

Tony