Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

saurabh5
Contributor II

creating variable for a condition in SQL querry to load data


hi all,

i want to load some data in Qlikview and create a qvd for the same.

i have the following query

SQL Select   *

from  xyz.FACT, xyz.DIR

WHERE FACT.STARTING_DATE <= DIR.DATE_REC

       AND FACT.ENDING_DATE > DIR.DATE_REC

       AND FACT.FLG='N'  AND

FACT.TESTER ='PERF';

But i want to create variable for the condition (FACT.STARTING_DATE <= DIR.DATE_REC

  AND FACT.ENDING_DATE > DIR.DATE_REC)    so  that i pick only the max value from the database

thanks in advance!!

3 Replies

Re: creating variable for a condition in SQL querry to load data

You want a SQL Query or a QlikView LOAD statement?

saurabh5
Contributor II

Re: creating variable for a condition in SQL querry to load data

hi Peter,

i want a way to create a variable like vmaxofdate= for the condition FACT.STARTING_DATE <= DIR.DATE_REC  AND FACT.ENDING_DATE > DIR.DATE_REC so that i pick only those rows from database in qv

thanks

Re: creating variable SQL querry for multiple condition to load data

Hi,

How you store the Max value of DIR.DATE_REC if it is from any table then store this information with help of the Peek function and then load SQL load statement and then in Qlikview do Where condition.

//Sql Load

Table1:

SQL Select   *

from  xyz.FACT, xyz.DIR;


Noconcatenate

Load *

Resident Table1

WHERE FACT.STARTING_DATE <= $(vMaxDateRec)

       AND FACT.ENDING_DATE > $(vMaxDateRec)

       AND FACT.FLG='N'  AND

         FACT.TESTER ='PERF';

Drop Table Table1;

Let me know about the Max value.

Regards

Anand




Community Browser