Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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
MVP
MVP

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
MVP
MVP

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.