Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Hide script need help

Hi All, need help..

what i want: i need to take current date, compare with variable, and if its tru, i want to realod, if its fals, i need to show a message, somthing " bla bla bla, you can not load date", and reaload only old date, my script is:

LET vEndDate = date(2014-03-15,YYYY.MM.DD);

LET vTodayDate = today();

IF $(vTodayDate) < $(vEndDate) THEN

Currency:

load

     Currency,

     Symbol,

     Rate

;

sql

select c.Currency,

       c.Symbol,

       rt.Rate,

       rt.StartDate

from( SELECT max (rt.StartDate)  as StartDate

         ,rt.CurrencyID

      FROM tbl_CurrencyRate rt

      group by  rt.CurrencyID) r,

      tbl_Currency c,

      tbl_CurrencyRate rt

where r.StartDate = rt.StartDate and r.CurrencyID = rt.CurrencyID

and r.CurrencyID = c.ID

;

// and i dont know ho to show a mesage...

6 Replies
nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hi,

You have to end the if Statement with "END IF"

Also add Else Part to excecute with old date.

-Nilesh

tresesco
MVP
MVP

Modify variable declaration like:

LET vEndDate = Num(date#(2014-03-15,YYYY-MM-DD));

LET vTodayDate = Num(today());

Not applicable
Author

Hi ,

Try this below code, it will work fine

SET DateFormat='DD/MM/YYYY';

LET vEndDate = date('20/03/2014','$(DateFormat)');

LET vTodayDate = today();

IF Date('$(vTodayDate)') < Date('$(vEndDate)') THEN

///Load script

ELSE

     LOAD

     MsgBox('You can not load data', 'Message ', 'OKCANCEL', 'ICONASTERISK') as msg

AutoGenerate 1;
ENDIF


Not applicable
Author

Thank you very match, works fine, but one issue, after mesage "You can not load data" when i clik ok or cancel, all old date was gone...i have only empty sheets  with no data.

Not applicable
Author

ok, i solved this issue with no data by adding binary load, i hope its correct..but i need one more if statment, i want inform user about ending by days, starting from 10 days, for example, when till EndDate lef 10 days, user get mesage "10 days left", nex day got mesage, "9 days left" ect...

please help

my scritp :

BINARY D:\Public\Sigitas\Projects\Impuls\BPMSImpuls_marketing_work.qvw;

SET DateFormat='DD/MM/YYYY';

LET vEndDate = date('20/02/2014','$(DateFormat)');

LET vTodayDate = today();

IF Date('$(vTodayDate)') < Date('$(vEndDate)') THEN

LOAD script

ELSE

     LOAD

     MsgBox('You cant load data', 'Message ', 'OK', 'ICONASTERISK') as msg

AutoGenerate 1;

ENDIF

Peter_Cammaert
Partner - Champion III
Partner - Champion III

floor(num($(vEndDate))) - floor(num($(vTodayDate))) returns number of days left.

You may need to format the value of those variables a bit more before performing this operation.

Peter