mmtmalone
19th June 2013, 00:30
I'm trying to get the 1st day of the previous month so I can pull the FX rate from the next to the last record.
Here's the code I have and I keep getting an error on date.f
Am I missing something????????
long year, month, day
num.to.date(date.num(), year, month, day)
date.f = date.to.num(month>1?year:year-1, month>1?month-1:12, 1)
if tiitm001.ccur <> home.curr then
select tcmcs008.rats, tcmcs008.stdt:last.date
from tcmcs008
where tcmcs008.ccur = :tiitm001.ccur
order by tcmcs008.stdt desc
as set with 1 rows
selectdo
if tcmcs008.rats <> 0 then
curr.prnt.price = tiitm001.prip * tcmcs008.rats
curr.rate = tcmcs008.rats
endif
endselect
select tcmcs008.rats
from tcmcs008
where tcmcs008.ccur = :tiitm001.ccur
and (tcmcs008.stdt >= date.f and tcmsc008.stdt < :last.date)
as set with 1 rows
Here's the code I have and I keep getting an error on date.f
Am I missing something????????
long year, month, day
num.to.date(date.num(), year, month, day)
date.f = date.to.num(month>1?year:year-1, month>1?month-1:12, 1)
if tiitm001.ccur <> home.curr then
select tcmcs008.rats, tcmcs008.stdt:last.date
from tcmcs008
where tcmcs008.ccur = :tiitm001.ccur
order by tcmcs008.stdt desc
as set with 1 rows
selectdo
if tcmcs008.rats <> 0 then
curr.prnt.price = tiitm001.prip * tcmcs008.rats
curr.rate = tcmcs008.rats
endif
endselect
select tcmcs008.rats
from tcmcs008
where tcmcs008.ccur = :tiitm001.ccur
and (tcmcs008.stdt >= date.f and tcmsc008.stdt < :last.date)
as set with 1 rows