This topic is locked

calculate change of totals on list page

2/22/2024 3:38:42 PM
ASPRunner.NET General questions
T
Tim author

Hello,

I have a list page with the following fields:

AccountName, PreviousYear, LastYear, AnnualIncrease.

Annual Increase is calculated in my SQL query using the "previous year" and "last year" amounts, per account. On the designer page, I have totals set for previous year and last year, so my page looks like this:

img alt

I need to take the Total from the bottom of the "Last Year" column and the Total from the "Previous Year" column and calculate percent change of these 2 numbers and display this at the bottom of the Annual Increase column. I assume I'll use Javascript onload event and get the totals from those 2 controls (which, on the designer page, I've given an item ID of totals_prev_year and totals_last_year), and then calculate the percent change, but then how do I display that result at the bottom of the Annual Increase column? Or maybe there's another way to do this..?

Thanks,
Tim

T
Tim author 2/28/2024

Anyone have an idea on this one? I really thought this would have come up before, but I couldn't find any posts. Does my question make sense?

Thanks,
Tim

D
DRCR Dev 2/29/2024

I'd use a code snippet that repeats the calculations and echos the percent. I can't think of a built in way of extracting the values from the item, but if there is an easier way, I'd love to know.

fhumanes 2/29/2024

Hi Tim,

I published an item to replace the totalization function of the PHPRUNNER GRID/LIST and although the example is for Phprunner I think it would also work for your programming language.

https://fhumanes.com/blog/guias-desarrollo/guia-16-phprunner-totales-en-grupo-en-paginas-list/

It is just another idea.

Greetings,
fernando