i have a table with 3 columns and i need to get the sum of the values in the second coloumn I am keeping an ID which is used to identify cells of addition. I need to do it in J query ?I would like to know how I can able to acess each rows and colums of a table using for loop.
<table>
<tr>
<td>ID</td>
<td>Mark</td>
<tr>
<td>1</td>
<td>40</td>
</tr>
<tr>
<td>2</td>
<td>35</td>
</tr>
<tr>
<td>1</td>
<td>52</td>
</tr>
</table>
Can I able to access each rows using some indexes like #tbl[row][col] etc .Thnaks In Advance
I NEED TO ADD THE VALUES WHERE ID WILL BE ONE THAT IS EXPECTED OUTPUT IS 92[40+52]
Something like this would work:
For example:
You can test it out here., what this does is get the first columns of cells, does a
.filter()down to those that match the ID (don’t use:contains()here, it’s a substring match) then for the matches, get the neighboring cell using.next(). For those cells we’re just usingpraseInt()to get the number and add it to thetotal.