Now as regular contributors know, I'm no coder. A kind member sent me this function and it worked fine up until I loaded the latest version of V9.
It calculates monthly complaint totals from a particular site.
Can anyone help with this as I'm stumped.
Tried going into Design and re saving, still doesn't work.
FUNCTION past_year_sum AS C ( )
' site variable from site_select()
' This function sums the number of complaints for each month spanning the past 12 months including the the current month
' this function is called from the "display last 12 months" button on the F_comp form
' dim the needed variables
dim vtitle as C
vtitle = "Past 12 Month Summary" + crlf() + "====================" + crlf()
dim vfooter as C
vfooter = "====================" + crlf() + "Total = "
dim vSum as C = "" ' accumulating result variable
dim vcMWname as C ' month name
dim vnCount as N = 0 ' montly count
dim vntotal as N = 0 ' monthly count total
dim vfS as C ' filter start date variable
dim vfE as C ' filter end date variable
dim vfilter as C ' filter string
' define the filter's first month start and end point variable values
vfS = dtoc(month_end(date()) - 365)
vfE = dtoc(month_end(ctod(vfS)))
' start with the first month acquiring that month's count, adding it to the accumulaing result variable (blank at start) and
' then incrementing the month for the next cycle
for i = 1 to 12
' name on the first month in the series
vcMWname = cmonth(ctod(vfS))
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' get record counts for the month current in the script
vfilter = between_date("Comp_Date",ctod(Var->vfS),ctod(Var->vfE)) + " .and. site_id = "+quote(vSID)
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
vncount = a5_get_records_in_query("comp",vfilter)
' add the month's count and month's name to the accumulating result variable
vSum = vSum + vncount + space(2) + alltrim(vcMWname) + crlf()
vntotal = vntotal + vnCount
' increment the month to the next month for the next cycle
vfS = dtoc(addmonths(ctod(vfS),1))
vfE = dtoc(month_end(ctod(vfS)))
next i
' compile the tittle, accumulated variable, and footer into a single reporting results variable
vSum = vtitle + alltrim(vSum) + crlf() + vfooter + vntotal
' display the result in the form text box
parentform:text1.text = vsum
END FUNCTION
It calculates monthly complaint totals from a particular site.
Can anyone help with this as I'm stumped.
Tried going into Design and re saving, still doesn't work.
FUNCTION past_year_sum AS C ( )
' site variable from site_select()
' This function sums the number of complaints for each month spanning the past 12 months including the the current month
' this function is called from the "display last 12 months" button on the F_comp form
' dim the needed variables
dim vtitle as C
vtitle = "Past 12 Month Summary" + crlf() + "====================" + crlf()
dim vfooter as C
vfooter = "====================" + crlf() + "Total = "
dim vSum as C = "" ' accumulating result variable
dim vcMWname as C ' month name
dim vnCount as N = 0 ' montly count
dim vntotal as N = 0 ' monthly count total
dim vfS as C ' filter start date variable
dim vfE as C ' filter end date variable
dim vfilter as C ' filter string
' define the filter's first month start and end point variable values
vfS = dtoc(month_end(date()) - 365)
vfE = dtoc(month_end(ctod(vfS)))
' start with the first month acquiring that month's count, adding it to the accumulaing result variable (blank at start) and
' then incrementing the month for the next cycle
for i = 1 to 12
' name on the first month in the series
vcMWname = cmonth(ctod(vfS))
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
' get record counts for the month current in the script
vfilter = between_date("Comp_Date",ctod(Var->vfS),ctod(Var->vfE)) + " .and. site_id = "+quote(vSID)
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
vncount = a5_get_records_in_query("comp",vfilter)
' add the month's count and month's name to the accumulating result variable
vSum = vSum + vncount + space(2) + alltrim(vcMWname) + crlf()
vntotal = vntotal + vnCount
' increment the month to the next month for the next cycle
vfS = dtoc(addmonths(ctod(vfS),1))
vfE = dtoc(month_end(ctod(vfS)))
next i
' compile the tittle, accumulated variable, and footer into a single reporting results variable
vSum = vtitle + alltrim(vSum) + crlf() + vfooter + vntotal
' display the result in the form text box
parentform:text1.text = vsum
END FUNCTION
Comment