Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Compare dates and exit script

Good day,

I need to add a piece in my script that will compare a date
in my txt file (see below) and if today's date is bigger than that date
Qlikview must "exit script"

LOAD Transaction
FROM

Desktop\Sales\Info

(
txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

the result from this load will be 2013\08\10, so if today's date is bigger, the script must exit

Please help

Thanks a lot

1 Solution

Accepted Solutions
tresesco
Not applicable

Re: Compare dates and exit script

try like this:

Load  Max(Transaction) as MaxDate

From ......;

Let vDate= Peek('MaxDate');

If( Date(today())>Date($(vDate)) ) Then

Exit Script;

Else

....;

5 Replies
er_mohit
Not applicable

Re: Compare dates and exit script

LOAD Transaction
FROM

Desktop\Sales\Info

(
txt, codepage is 1252, embedded labels, delimiter is '\t', msq)where Transaction<=Today();

mayilvahanan
Not applicable

Re: Compare dates and exit script

Hi

Try like this

Load

Transaction
FROM
Desktop\Sales\Info
(
txt, codepage is 1252, embedded labels, delimiter is '\t', msq) where Transaction <= Date(Today(),'YYYY\MM\DD');

Not applicable

Re: Compare dates and exit script

Chick this out:

// Make a table just for calcultating the variable:

Check:

NoConcatenate LOAD

Transaction

Resident YourTable

Order By transaction desc;

//Calculate the variable:

LET varCheck = Peek('Transaction',0);

//We don't need the tble anymore:

DROP Table Check;

IF ($(varCheck)>&(Today())) then

    TRACE Exiting...;

    Exit Script;

ENDIF

tresesco
Not applicable

Re: Compare dates and exit script

try like this:

Load  Max(Transaction) as MaxDate

From ......;

Let vDate= Peek('MaxDate');

If( Date(today())>Date($(vDate)) ) Then

Exit Script;

Else

....;

Not applicable

Re: Compare dates and exit script

Thanks a lot, it worked.

Why did this not work though?

Date:

LOAD date(Transaction) as Transaction
FROM
Info (
txt, codepage is 1252, embedded labels, delimiter is '\t', msq);

CheckDate:
LOAD Transaction
Resident Date;

LET CheckDate = Peek('Transaction',0);
LET CheckToday = Today();

DROP Table CheckDate;

IF ($(CheckDate)<=$(CheckToday)) then
Exit Script;

ENDIF