Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
On May 18th at 10AM EDT we will answer your QlikView questions live. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
desiderio89
Contributor
Contributor

Filter by date range

Hello, 
I am new to QlikView. I have wrote a script to connect to a ODBC datasource and loading data from a table which I am storing as a csv file. 

The script is loading all rows from the table. However I need to implement a logic where data from the start of the month till yesterday needs to be stored. How can I achieve this through the script? I'd appreciate any pointers.

Here is how my script looks like.

ODBC CONNECT TO hivesource;
CHECK:
LOAD
table1.date AS LDATE,
table1.name AS LNAME;
SQL SELECT date, name from schema.table1; //both fields are string datatype

OUT:
Load
LDATE AS ODATE,
LNAME AS ONAME
RESIDENT CHECK;
Store OUT into out.csv (TXT);

1 Solution

Accepted Solutions
Or
Master
Master

Just add a "Where" condition:

Load
LDATE AS ODATE,
LNAME AS ONAME
RESIDENT CHECK

WHERE LDATE >= MonthStart(LDATE) and LDATE <= Today()-1;
Store OUT into out.csv (TXT);

Note that if LDATE is not an actual date type, you will need to convert it to one, or use other formulas to get your start and end points depending on the specific date format you use.

View solution in original post

1 Reply
Or
Master
Master

Just add a "Where" condition:

Load
LDATE AS ODATE,
LNAME AS ONAME
RESIDENT CHECK

WHERE LDATE >= MonthStart(LDATE) and LDATE <= Today()-1;
Store OUT into out.csv (TXT);

Note that if LDATE is not an actual date type, you will need to convert it to one, or use other formulas to get your start and end points depending on the specific date format you use.

View solution in original post