Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
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

Tags (3)
1 Solution

Accepted Solutions
Partner
Partner

Selecting data from a qvd file using wildcards

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);


3 Replies
Partner
Partner

Selecting data from a qvd file using wildcards

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

Selecting data from a qvd file using wildcards

The following code should help...

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


Not applicable

Selecting data from a qvd file using wildcards

Thanks That worked perfectly

Tony