Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Is there a way to set a condition in a FROM statement to determine the load source?

I have a need to load from one of two source based upon a condition being true or not (specifically, when a back end process fails I need to load from a set of QVD...when it succeeds I need it to load from the database).

IOW: IF(backend fails, LOAD FROM QVD, LOAD FROM DATABASE)

Is this possible in Qlikview?

Also, any suggestions as to how to construct the condition?  I was thinking a variable...

1 Solution

Accepted Solutions
adamdavi3s
Master
Master

where does your backend process failure get recorded?

This is an example and assume errorflag is 1 if it hasn't run, obviously can be tweaked to suit

errorcheck:

LOAD *;

SQL SELECT errorflag

FROM tblfailures where process='xyz' ;

let v_errorcheck=peek('errorflag',0,'errorcheck');

IF $(v_errorcheck) = 1 THEN

Data:

LOAD 'QVD' as source

AutoGenerate(1);

ELSE

Data:

LOAD 'SQL' as source

AutoGenerate(1);

END IF

View solution in original post

3 Replies
adamdavi3s
Master
Master

where does your backend process failure get recorded?

This is an example and assume errorflag is 1 if it hasn't run, obviously can be tweaked to suit

errorcheck:

LOAD *;

SQL SELECT errorflag

FROM tblfailures where process='xyz' ;

let v_errorcheck=peek('errorflag',0,'errorcheck');

IF $(v_errorcheck) = 1 THEN

Data:

LOAD 'QVD' as source

AutoGenerate(1);

ELSE

Data:

LOAD 'SQL' as source

AutoGenerate(1);

END IF

Not applicable
Author

Thanks Adam. I think this will work. And in actuality, I don't think you

can have the FROM statement just point to one source or another since you

need a preceding load for the DB load v the QVD load. Thanks!

On Fri, Mar 10, 2017 at 9:40 AM, Adam Davies <qcwebmaster@qlikview.com>

adamdavi3s
Master
Master

cool, I did just tweak my answer to correct the syntax but glad it will work for you or at least give you the idea to work from