Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
bertrand01
Contributor III
Contributor III

QlikSense : Load with where condition in a variable doesn't work ?

I usually do this in QlikView :

LET vLoadQvdCondition=' WHERE monthname(acu.Mois) < monthname(addMonths(now(), -1))';

Load *

from Qvd  (qvd)

$(vLoadQvdCondition)

and it works fine.

 

But when I do this in QlikSense (april 2019), $(vLoadQvdCondition) appears in red and does nothing ???

 

 

5 Replies
Tim_Wensink
Partner
Partner

Hello Bertrand,

 

If I try this in Qlik Sense the variable containing the where clause shows up in red, but it is working. The first thing you have to do, however, is create a connection to the folder containing the qvd file. So that your from statement looks like this:

FROM [lib://QVDfolder/File.qvd]
(qvd)
$(vLoadQvdCondition);

The vLoadQvdCondition still shows up red, but in my case it works on loading. Could that be the solution?

 

Regards,


Tim Wensink

 

bertrand01
Contributor III
Contributor III
Author

Yes I have the connection and it works fine when write the where condition.

Also what surprise me is that I can write any variable like $(toto) that doesn't exits and the load doesn't detect any error.

Tim_Wensink
Partner
Partner

Hello Bertrand,

I agree that it's strange that you can use non-existing variables. If I use a variable that does exist, it does work in my case.

If you look at this example:

let vVar = 'where 1=0';

LOAD
*
FROM [lib://QVD/Test.qvd]
(qvd)
$(vVar);

if I run this, zero lines are read. If I use a non-existing variable, all lines are read. is your variable filled correctly?

Greetings, 

Tim Wensink

bertrand01
Contributor III
Contributor III
Author

Thanks Tim for your help,

Yes I've tried  'where 1=0'; and it works.

In fact my problem comes from escape characters :

let vVar =[ where Réseau='ABCD'];

doesn't work, all the data's Qvd are loaded, there's no selection as when I apply directly this condition on the Load Qvd.

bertrand01
Contributor III
Contributor III
Author

Finally  I have found where the problem come :

let vVar ='where Réseau=''ABCD''';

 

The final '''; also appears in red, it took me time to realise that this is correct..