Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

New to qlikview

Hi everyone,

I'm a newbie in qlikview hoping to learn from y'all. I have this question that I hope someone could help point me to the right direction.

I'm trying to achieve the same result in qlikview by using this sql example:

The TEST looks like this:

My SQL statement will look like this:

Declare @@dtPublished varchar(10)

--Select @@dtPublished = '7/1/2002'

select * from test

where bSold=1

and (@@dtPublished is null OR dtPublished >= @@dtPublished)

If I don't pass a value to @@dtPublished variable, it should return all records with bSold value = 1 (basically, ignoring the and(@@dtPublished...) statement:

If I uncomment the "Select @@..." part, and pass @@dtPublished = '7/1/2002', it should return:

AuthID      BookID     bSold     dtPublished

A01          XX001          1          7/1/2002

A01          XX003          1          4/4/2010

Now, instead of passing the @@dtPublished, I created a variable in "Test.qvs", which I called vardtPublished=Null();.

My load statement looks like this:

$(include=Test.qvs);

TestTable:

LOAD *

From '..\Test.qvd' (qvd)

Where bSold=1

and ( if ( NOT (ISNULL($(vardtPublished))), dtPublished>=$(vardtPublished)))

2 Replies
Anonymous
Not applicable
Author

Sorry, I accidentally click "Submit" before finishing the sentence. I ran into error ISNULL expects 1 parameter.

My question is:

1. Should I use SET instead of LET in LET vardtPublished=Null(); ?

2. Will the code work the same way I tried to achieve in SQL?

Thanks alot

AWQV - Anton

Anonymous
Not applicable
Author

I just realized the TEST table has gone missing from the original post. My apology. It should look like:

AuthID     BookID     bSold     dtPublished

-------------------------------------------------------------

A01          XX001          1          7/1/2002

A01          XX002          1          5/5/1998

A01          XX003          1          4/4/2010

A01          null               0          3/3/2011

A02          XX001          0          12/23/2009