Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello! I have a load script that works but I use a hard-coded date (highlighted in red below). But I want to use an arbitrary date value, vStartDate, instead of the hard-coded date. How can I use the value of vStartDate?
LET vStartDate = makedate(Year(Today()),01,01);
YTDtotals:
LOAD
item,
ytd_units,
ytd_cost,
ytd_price;
SQL SELECT t3.item,
sum(t1.units) as ytd_units,
sum(t1.total_cost) as ytd_cost,
sum(t1.total_price) as ytd_price
FROM transitem t1, trans t2, product t3
where t1.trn_uid = t2.trn_uid
and t1.product_uid = t3.product_uid
and t2.trn_date > '2011-01-01'
group by t3.item;
HI
Use like this
and t2.trn_date > '$(vStartDate )'
Edit:
LET vStartDate = makedate(Year(Today()),01,01); gives 01/01/2012
so use
LET vStartDate = makedate(Year(Today())-1,01,01); gives 1/1/2011
For format,
Date(makedate(Year(Today())-1,01,01),'YYYY-MM-DD')
Hope that helps
HI
Use like this
and t2.trn_date > '$(vStartDate )'
Edit:
LET vStartDate = makedate(Year(Today()),01,01); gives 01/01/2012
so use
LET vStartDate = makedate(Year(Today())-1,01,01); gives 1/1/2011
For format,
Date(makedate(Year(Today())-1,01,01),'YYYY-MM-DD')
Hope that helps
Thank you!