This topic is locked
[SOLVED]

  Running Percentage Total on List Page

1/19/2011 12:35:39 PM
ASPRunnerPro General questions
author

Does anyone have any ideas on how to implement a running total of percentages on the list page. I could do this in SQL but the running total is based on whatever search criteria the user inputs so that won't work. Thanks for any ideas!

Sergey Kornilov admin 1/19/2011

Elizabeth,
I would ask you to show an example of what you trying to build so we can suggest a workaround.

4414 1/19/2011

Sometimes it seems more trouble to explain a problem as opposed to solving it. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=55856&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />
I added a blank field and in the "View as" Custom Settings I performed the subtotal. The sort and 'where' clause are key, particularly the <= statement based on the sorted column. I'm not quite finished and still have to calculate the "percentage of" but this is how I have handled it so far:


strSQL = "select top 1 sum(RtMinCount) rtMin from vwFractileAgencyFinal

where IncYear=" & data("IncYear") & " and IncMonth =" & data("IncMonth") &

" and DispatchAgency= '" & data("DispatchAgency") & "' and CallTypeGroup = '" &

data("CallTypeGroup") & "'" & " and RtMin<=" & data("RTMin") & ""

set rsTemp = CreateObject("ADODB.Recordset")

rsTemp.Open strSQL, dbConnection

do while not rsTemp.eof

strValue = rsTemp("rtMin")

rsTemp.MoveNext

loop

rsTemp.Close


I'll post my final solution when complete.

4414 1/20/2011

It may not be ideal but it works great. I added code to the "View as" Custom settings of my empty field. My particular implementation is based on specific required criteria (in the where clause) and if that criteria is absent the sum column will not be correct. I am pretty sure there is a way to make it more flexible.



strSQL = "select top 1 sum(Pt) Pt from vwFractileAgencyFinal

where IncYear=" & data("IncYear") & " and IncMonth =" & data("IncMonth") & " and DispatchAgency= '" & data("DispatchAgency") & "' and CallTypeGroup = '" & data("CallTypeGroup") & "'" & " and RtMin<=" & data("RTMin") & ""

set rsTemp = CreateObject("ADODB.Recordset")

rsTemp.Open strSQL, dbConnection

do while not rsTemp.eof

strValue = FormatPercent(Cdbl(rsTemp("Pt")) )

rsTemp.MoveNext

loop

rsTemp.Close
Sergey Kornilov admin 1/20/2011

Elizabeth,
thank you for the update.