ASP add column data

0

I have a table where a column shows me the different percentages obtained from the monthly assistance, but I want to obtain my annual attendance in percentage, that is to add all the percentages that I have been carrying so far

<div class="row-fluid">
<div class="span12"style="overflow-y:auto;">
    <h1 class="text-center" style="margin-bottom:1em;"><strong>Porcentaje Personal Capacitado</strong></h1>
    <table id="lista" class="table table-hover table-bordered bootstrap-datatable datatable dataTable">
        <caption></caption>
        <thead>
            <tr>
                <th>Mes</th>
                <th>Año</th>
                <th>Personal</th>
                <th>% mensual de capacitacion</th>

            </tr>
        </thead>
        <tbody>

<%      for i = lbound(datos ,2) to ubound(datos ,2)%>

            <tr>

                <td><%=i+1%></td>
                <td><%=datos(1,i)%></td>
                <td><%=datos(2,i)%></td>
                <td><%=round((datos(2,i)*100)/datos(3,i),2)%>%</td>
                <!--F Registro-->


            </tr>
  <%        next %>
        </tbody>
    </table>
   </div>
</div>

I want to show at the end of the table in a row in result but I do not know how to add all the data, there is some way to do it in ASP. Thanks

    
asked by Daniela 19.12.2018 в 18:40
source

1 answer

0

You could do it by accumulating in a variable the sum of everything that you are showing in the last column, and later, when you finish executing the loop, show a new row with the result:

<%      
dim resultadoFinal

end result = 0

for i = lbound (data, 2) to ubound (data, 2)     end result = end result + (round ((data (2, i) * 100) / data (3, i), 2))

%>

        <tr>

            <td><%=i+1%></td>
            <td><%=datos(1,i)%></td>
            <td><%=datos(2,i)%></td>
            <td><%=round((datos(2,i)*100)/datos(3,i),2)%>%</td>
            <!--F Registro-->


        </tr>


  <%        next %>


<tr>
<td>TOTAL</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><%=round(resultadoFinal, 2)%>%</td>

</tr>

I hope it serves you.

    
answered by 20.12.2018 в 09:50