showstuff11
10th March 2015, 04:43
i got no errors but my report script does not show results
here's my script
table ttcmcs051, ttdsls400 | Number Groups
double val1
extern long month |month on form
long year, day , seriescount,date.f,date.t |Temp. variables
domain tcorno combiness
domain tcqdhc average
long totalusage
domain tcqdhc mo
domain tcqdhc mo2
double RemainingMonths
domain tcorno orno
double totaldays
double counttotaldays
long counter
long leapyear
long leap
double monthaverage
long divis
header.1:
before.layout:
select tcmcs051.dsca
from tcmcs051
where tcmcs051._index1 = {:tcmcs050.nrgr}
selectdo
endselect
detail.1:
before.layout:
|getting the month in number format
num.to.date(date.num(),year, month, day)
mo = month
|getting the total usage of the series
totalusage = tcmcs050.ffno - 1
monthaverage = 30
while counter < month
on case counter
case 1:
totaldays = 31
break
case 2:
divis =4
leapyear = year \ 4
if leapyear = 0 then
totaldays = totaldays + 29
else
totaldays = totaldays + 28
endif
break
case 3:
totaldays = totaldays + 31
break
case 4:
totaldays = totaldays + 30
break
case 5:
totaldays = totaldays + 31
break
case 6:
totaldays = totaldays + 30
break
case 7:
totaldays = totaldays + 31
break
case 8:
totaldays = totaldays + 31
break
case 9:
totaldays = totaldays + 30
break
case 10:
totaldays = totaldays + 31
break
case 11:
totaldays = totaldays + 30
break
case 12:
totaldays = totaldays + 31
break
endcase
counter = counter + 1
endwhile
totaldays = totaldays + day
average = (totalusage / totaldays) * monthaverage
|getting the total months used( before the present)
mo2 = 12 - mo + 1
if totalusage = 0 then
RemainingMonths =99999
else
RemainingMonths = ( 99999 - totalusage ) / average
endif
seriescount = len(str$(tcmcs050.ffno))
if seriescount = 1 and totalusage = 0 then
combiness = "Unused"
else
if seriescount = 1 and totalusage <> 0 then
combiness = trim$(tcmcs050.seri) & "0000" & str$(tcmcs050.ffno-1)
endif
endif
if seriescount = 2 then
combiness = trim$(tcmcs050.seri) & "000" & str$(tcmcs050.ffno-1)
endif
if seriescount = 3 then
combiness = trim$(tcmcs050.seri) & "00" & str$(tcmcs050.ffno-1)
endif
if seriescount = 4 then
combiness = trim$(tcmcs050.seri) & "0" & str$(tcmcs050.ffno-1)
endif
if seriescount = 5 then
combiness = trim$(tcmcs050.seri) & str$(tcmcs050.ffno-1)
orno = combiness
endif
||it shows the last date used of the series in SO table
select tdsls400.odat
from tdsls400
where tdsls400.orno = :orno
selectdo
endselect
|| other question: i need to get the first and last date the series is used.. so far i only got the last date but my script does not function right...
and how can i zero out the variable "totaldays" because it keeps incrementing
hopes someone helps me! thanks a bunch!
here's my script
table ttcmcs051, ttdsls400 | Number Groups
double val1
extern long month |month on form
long year, day , seriescount,date.f,date.t |Temp. variables
domain tcorno combiness
domain tcqdhc average
long totalusage
domain tcqdhc mo
domain tcqdhc mo2
double RemainingMonths
domain tcorno orno
double totaldays
double counttotaldays
long counter
long leapyear
long leap
double monthaverage
long divis
header.1:
before.layout:
select tcmcs051.dsca
from tcmcs051
where tcmcs051._index1 = {:tcmcs050.nrgr}
selectdo
endselect
detail.1:
before.layout:
|getting the month in number format
num.to.date(date.num(),year, month, day)
mo = month
|getting the total usage of the series
totalusage = tcmcs050.ffno - 1
monthaverage = 30
while counter < month
on case counter
case 1:
totaldays = 31
break
case 2:
divis =4
leapyear = year \ 4
if leapyear = 0 then
totaldays = totaldays + 29
else
totaldays = totaldays + 28
endif
break
case 3:
totaldays = totaldays + 31
break
case 4:
totaldays = totaldays + 30
break
case 5:
totaldays = totaldays + 31
break
case 6:
totaldays = totaldays + 30
break
case 7:
totaldays = totaldays + 31
break
case 8:
totaldays = totaldays + 31
break
case 9:
totaldays = totaldays + 30
break
case 10:
totaldays = totaldays + 31
break
case 11:
totaldays = totaldays + 30
break
case 12:
totaldays = totaldays + 31
break
endcase
counter = counter + 1
endwhile
totaldays = totaldays + day
average = (totalusage / totaldays) * monthaverage
|getting the total months used( before the present)
mo2 = 12 - mo + 1
if totalusage = 0 then
RemainingMonths =99999
else
RemainingMonths = ( 99999 - totalusage ) / average
endif
seriescount = len(str$(tcmcs050.ffno))
if seriescount = 1 and totalusage = 0 then
combiness = "Unused"
else
if seriescount = 1 and totalusage <> 0 then
combiness = trim$(tcmcs050.seri) & "0000" & str$(tcmcs050.ffno-1)
endif
endif
if seriescount = 2 then
combiness = trim$(tcmcs050.seri) & "000" & str$(tcmcs050.ffno-1)
endif
if seriescount = 3 then
combiness = trim$(tcmcs050.seri) & "00" & str$(tcmcs050.ffno-1)
endif
if seriescount = 4 then
combiness = trim$(tcmcs050.seri) & "0" & str$(tcmcs050.ffno-1)
endif
if seriescount = 5 then
combiness = trim$(tcmcs050.seri) & str$(tcmcs050.ffno-1)
orno = combiness
endif
||it shows the last date used of the series in SO table
select tdsls400.odat
from tdsls400
where tdsls400.orno = :orno
selectdo
endselect
|| other question: i need to get the first and last date the series is used.. so far i only got the last date but my script does not function right...
and how can i zero out the variable "totaldays" because it keeps incrementing
hopes someone helps me! thanks a bunch!