My web application collects data using:
id (key value)
Time stamp
value
He then creates the HTML table as follows:
<table> <tr bgcolor="#FFA9A9"> <td> ID1 </td> <td> 20150619T09.43.03</td> <td>VALUE1</td> </tr> <tr> <td> ID2 </td> <td> 20150619T09.43.02</td> <td>VALUE1</td> </tr> <tr bgcolor="#FFA9A9"> <td> ID3 </td> <td> 20150619T09.43.00</td> <td>VALUE2</td> </tr> <tr> <td> ID4 </td> <td> 20150619T09.42.59 </td> <td> VALUE1</td> </tr> <tr bgcolor="#FFA9A9"> <td> ID5 </td> <td> 20150619T09.42.59 </td> <td> VALUE2</td> </tr> <tr> <td> ID6 </td> <td> 20150619T09.42.58</td> <td>VALUE2</td> </tr> <tr> <td> ID7 </td> <td> 20150619T09.42.55 </td> <td> VALUE2 </td> </tr> <tr bgcolor="#FFA9A9"> <td> ID8 </td> <td> 20150619T09.42.40 </td> <td> VALUE2 </td> </tr> <tr> <td> ID9 </td> <td> 20150619T09.42.39 </td> <td> VALUE2 </td> </tr> </table>
Explanation: It sorts the timestamp value in DESC order.
If, for example, t1 is a time stamp for ID1, and "t2" is a time stamp for ID2 and ...
t1 + 2 seconds >= t2
line ID2 turns red.
In my example:
ID1 red (# FFA9A9) reason ID2 (same value and time stamp within 2 seconds)
ID3 is the red cause of ID5, which is the red cause of ID6.
ID8 is the red reason for ID9
in this case, ID1 is a copy, and ID2 is the original; ID3 and ID5 are copies, and ID6 is the original; ID8 is a copy, and ID9 is the original.
I need to count the red copy and put the counter in another cell of the row, which is the original.
The result of my example should be:
<table> <tr> <td> ID2 </td> <td> 20150619T09.43.02</td> <td>VALUE1</td> <td>1</td> --> one record not shown (ID1) </tr> <tr> <td> ID4 </td> <td> 20150619T09.42.59 </td> <td> VALUE1</td> <td> 0 </td> </tr> <tr> <td> ID6 </td> <td> 20150619T09.42.58</td> <td>VALUE2</td> <td>2</td> --> two records not shown (ID3 and ID5) </tr> <tr> <td> ID7 </td> <td> 20150619T09.42.55 </td> <td> VALUE2 </td> <td> 0 </td> </tr> <tr> <td> ID9 </td> <td> 20150619T09.42.55 </td> <td> VALUE2 </td> <td> 1 </td> --> one record not shown (ID8) </tr> </table>
I need this because I have 3 data collectors and I need to understand which event is repeating ... If the value is the same and the timestamp is between 2 seconds, this is the same event and I need to take only the old one in table, but I need to also show that there is another captured copy ...
Any help? I can change the class, name, or something else, but I need to do this when the html page is loaded and on the client side (therefore javascript or jQuery) ...
I need:
1) scan the table in rows from the first to the last
2) understand if this is a red line
3) if it is a red line, I need to start counting red lines with the same value before the line is not red with the same value. then I put the counter in a new cell of the same non-red line ...
Many thanks!!! (and sorry for my bad english!)