function trim_table(user_attr_array) {
  var user_attributes = [];
  for (attr_group of user_attr_array) {
    if (attr_group != null) {
      user_attributes = user_attributes.concat(attr_group_obj[attr_group]);
    }
  }
  user_attributes = user_attributes.concat(attr_group_obj['other']); // add the attributes grouped in other anyway
  var temp_table = [[], []];
  for (var i = 0; i < data_rows.length; i++) {
    temp_table[1].push([[], data_rows[i][1]]);
  }
  for (var col_id = 0; col_id < attr_header.length; col_id++) {
    if (user_attributes.includes(attr_header[col_id])) {
      temp_table[0].push(attr_header[col_id]);
      for (var row_id = 0; row_id < data_rows.length; row_id++) {
        temp_table[1][row_id][0].push(data_rows[row_id][0][col_id]);
      }
    }
  }

  //Now point the global header and rows var to the trimed ones
  attr_header = temp_table[0];
  data_rows = temp_table[1];
  console.log(attr_header, data_rows);
}
//Remove attributes & values according to user's anwser

Remove attributes & values according to user's anwser
Remove attributes & values according to user ' s anwser
function trim_table(user_attr_array) {
  var user_attributes = [];
  for (attr_group of user_attr_array) {
    if (attr_group != null) {
      user_attributes = user_attributes.concat(attr_group_obj[attr_group]);
    }
  }
  user_attributes = user_attributes.concat(attr_group_obj['other']); 
  var temp_table = [[], []];
  for (var i = 0; i < data_rows.length; i++) {
    temp_table[1].push([[], data_rows[i][1]]);
  }
  for (var col_id = 0; col_id < attr_header.length; col_id++) {
    if (user_attributes.includes(attr_header[col_id])) {
      temp_table[0].push(attr_header[col_id]);
      for (var row_id = 0; row_id < data_rows.length; row_id++) {
        temp_table[1][row_id][0].push(data_rows[row_id][0][col_id]);
      }
    }
  }
  attr_header = temp_table[0];
  data_rows = temp_table[1];
  console.log(attr_header, data_rows);
}
function trim_table ( user_attr_array ) { var user_attributes = [ ] ; for ( attr_group of user_attr_array ) { if ( attr_group != null ) { user_attributes = user_attributes . concat ( attr_group_obj [ attr_group ] ) ; } } user_attributes = user_attributes . concat ( attr_group_obj [ 'other' ] ) ; var temp_table = [ [ ] , [ ] ] ; for ( var i = 0 ; i < data_rows . length ; i ++ ) { temp_table [ 1 ] . push ( [ [ ] , data_rows [ i ] [ 1 ] ] ) ; } for ( var col_id = 0 ; col_id < attr_header . length ; col_id ++ ) { if ( user_attributes . includes ( attr_header [ col_id ] ) ) { temp_table [ 0 ] . push ( attr_header [ col_id ] ) ; for ( var row_id = 0 ; row_id < data_rows . length ; row_id ++ ) { temp_table [ 1 ] [ row_id ] [ 0 ] . push ( data_rows [ row_id ] [ 0 ] [ col_id ] ) ; } } } attr_header = temp_table [ 0 ] ; data_rows = temp_table [ 1 ] ; console . log ( attr_header , data_rows ) ; }
Remove attributes & values according to user's anwser
Remove attributes & values according to user ' s anwser
// add the attributes grouped in other anyway
 //Now point the global header and rows var to the trimed ones
