Solution 1 :

I did it concatenating the id, month and year:

function get_conts() {
  var rows = document.getElementById('one').rows,
      len = rows.length,
      i,
      cell_id = 1,
      cell_month = 2,
      cell_year = 3,
      count = 0,
      cell;

  for (i = 1; i < len; i++) {
    cellvalue_id = rows[i].cells[cell_id];
    cellvalue_month = rows[i].cells[cell_month];
    cellvalue_year = rows[i].cells[cell_year];
    get_workers(cellvalue_id.innerHTML + "_" + cellvalue_month.innerHTML + "_" + cellvalue_year.innerHTML);
  }
}

function get_workers(id_ent) {
  var rows = document.getElementById('two').rows,
      len = rows.length,
      i,
      cell_id = 1,
      cell_month = 2,
      cell_year = 3,
      count = 0,
      cell;

  for (i = 1; i < len; i++) {
    cellvalue_id = rows[i].cells[cell_id];
    cellvalue_month = rows[i].cells[cell_month];
    cellvalue_year = rows[i].cells[cell_year];
    concatenated_text = cellvalue_id.innerHTML + "_" + cellvalue_month.innerHTML + "_" + cellvalue_year.innerHTML);

    if (concatenated_text === id_ent.toString()) {
      count++;
    }
  }
  

  var total_workers = document.getElementById('total_' + id_ent).innerHTML;

  document.getElementById('total_' + id_ent).innerHTML = (total_workers - count).toString();
  console.log(total_workers + "-" + count);
}

get_conts();

Problem :

I need to print a table with some total and then a second table with detailed events. Then I need to change the total of each total of the first table considering the number of rows of the second table.

I did it considering just one criteria of the second table. I need to consider 3 criteria (ID, MONTH and YEAR).

function get_conts() {
  var rows = document.getElementById('one').rows,
      len = rows.length,
      i,
      cellNum = 1,
      count = 0,
      cell;

  for (i = 1; i < len; i++) {
    cell = rows[i].cells[cellNum];
    get_workers(cell.innerHTML);
    console.log(cell.innerHTML);
  }
}

function get_workers(id_ent) {
  var rows = document.getElementById('two').rows,
      len = rows.length,
      i,
      cellNum = 1,
      count = 0,
      cell;

  for (i = 1; i < len; i++) {
    cell = rows[i].cells[cellNum];

    if (cell.innerHTML === id_ent.toString()) {
      count++;
    }
  }
  

  var total_workers = document.getElementById('total_' + id_ent).innerHTML;

  document.getElementById('total_' + id_ent).innerHTML = (total_workers - count).toString();
  console.log(total_workers + "-" + count);
}

get_conts();

https://jsfiddle.net/ke0u2nc9/

EDIT 1: I think concatenating ID, MONTH and YEAR it will work.

Comments

Comment posted by the tag’s info

This question does not appear to be about an issue using jsFiddle. From

Comment posted by Rodrick

@HereticMonkey OK, won’t.

By