veyant
29th May 2003, 12:25
hi,

Can anybody help me. i have to fetch matching record from table tfgld005 and have to store startdate in one variable. on same time i have to store next date in net variable also. i am not able to do that becuase i can't fetch two records at a time.
my code is

function compute.month()
{
select tfgld005.* from tfgld005
where tfgld005.year = :year
selectdo
fromdate = tfgld005.stdt
| enddate = ?????
endselect
}
actually i have to fetch enddate value as next record (date) to the current record matched.


it is very urgent as i am stuck here from last two dates and everything is stuck due to not available enddate value.


Sandeep Makan



Can some body help me

isimeon
29th May 2003, 13:59
This is a modification of the standart baan script to get start and end date of period:


function get.start.and.end.date.of.the.period(
domain tcncmp gcmp,
domain tfgld.year year,
domain tfgld.ptyp ptyp,
domain tfgld.prod prod,
domain tfgld.prod real.periods
ref domain tfgld.date start.date,
ref domain tfgld.date end.date)
{

tfgld005.ptyp = ptyp
tfgld005.year = year
tfgld005.prno = prod
if not db.eq(ttfgld005) then
start.date = tfgld005.stdt
else
start.date = 0
endif
on case ptyp
case tfgld.ptyp.financial:
if prod < real.periods then
tfgld005.ptyp = ptyp
tfgld005.year = year
tfgld005.prno = prod + 1
if not db.eq(ttfgld005) then
end.date = tfgld005.stdt - 1
else
end.date = 0
endif
else
tfgld006.year = year
if not db.eq(ttfgld006) then
end.date = tfgld006.fpdt
if prod > real.periods then
start.date = tfgld006.fpdt
endif
endif
endif
break
case tfgld.ptyp.reporting:
if prod < real.periods then
tfgld005.ptyp = ptyp
tfgld005.year = year
tfgld005.prno = prod + 1
if not db.eq(ttfgld005) then
end.date = tfgld005.stdt - 1
else
end.date = 0
endif
else
tfgld006.year = year
if not db.eq(ttfgld006) then
end.date = tfgld006.rpdt
else
end.date = 0
endif
endif
break
case tfgld.ptyp.vat:
if prod < real.periods then
tfgld005.ptyp = ptyp
tfgld005.year = year
tfgld005.prno = prod + 1
if not db.eq(ttfgld005) then
end.date = tfgld005.stdt - 1
else
end.date = 0
endif
else
tfgld006.year = year
if not db.eq(ttfgld006) then
end.date = tfgld006.vpdt
endif
endif
break
endcase
}