Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

qliklearnervir
New Contributor III

how to define where clause for date

Hi,

I want to filter my LOad process with date.

where createddate = 45678.7685   like that/...

vToday=Date(Today(),'YYYYMMDD');

Load Statment :

LOAD Booking,

           Booking Number

FROM $(vQvdlaction)Booking.qvd(qvd)

where Date(createddate,'YYYYMMDD')= $(vToday());

but i am getting 0 outcome...

but in data there are 50 rows with createddate =today()...

PLEASE SUGGEST THE WAY TO CONVERT TIME IN WHERE CONDITION TO LOAD DESIRED OUTCOME.

5 Replies
prma7799
Honored Contributor III

Re: how to define where clause for date

Your script looks like good

Please try like below

where Date(createddate,'YYYYMMDD')  =  date(Today(),'YYYYMMDD');

Or post some sample data.

balabhaskarqlik
Honored Contributor

Re: how to define where clause for date

may be:

vToday=Date(floor(Today()),'YYYYMMDD');

or

vToday=Date(floor(Today()),'YYYY-MM-DD');

Statement:

LOAD Booking,

           Booking Number

FROM $(vQvdlaction)Booking.qvd(qvd)

where Date(floor(createddate),'YYYYMMDD')= $(vToday());

//where Date(floor(createddate),'YYYY-MM-DD')= $(vToday());

Re: how to define where clause for date

You may mis understand the logic over here

Date(45678.7685) Returns 01/21/2025

Date(Today()) Returns Today's date of your machine.

Is that your machine showing same date like 01/21/2025 for you? If so, This condition true nor false

kamal_sanguri
Valued Contributor

Re: how to define where clause for date

the same way you define for other values. You just have to make sure the format of values in field at the left side matches with the format at right side.

For Ex:

Due Date = 1-Jan-2017

Where

DueDate < '2-Jan-2017'

If they are in different format you can convert them using Date or Date# function.

kamal_sanguri
Valued Contributor

Re: how to define where clause for date

Try this way:

Just use today() instead of variable in Where clause.

Refer attached QV document.

Data:

LOAD createddate

Where newdate = Today();

LOAD createddate,

Date(round(createddate),'YYYYMMDD') as newdate;

LOAD *

Inline

[

createddate

42921.7825

45678.7685

45678.7686

];