Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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...
Hi,
You have to end the if Statement with "END IF"
Also add Else Part to excecute with old date.
-Nilesh
Modify variable declaration like:
LET vEndDate = Num(date#(2014-03-15,YYYY-MM-DD));
LET vTodayDate = Num(today());
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
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.
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
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