Accessing nested values in a table

? i might not understand the issue, but just reading and display
that data from CSV is not the problem,
after you converted the data syntax to valid CSV file ( as spreadsheet would read )

after that you would need to use the data in a more MATRIX thinking, but table might also do that without restoring it to array, like a SQL VIEW?

// accessing nested values in a table
// https://discourse.processing.org/t/accessing-nested-values-in-a-table/9761
/*
/data/data.csv
_______________________
major, minor,A,B,C,D,E
0,0,40.65, 20.30, 120.92, 86.12, 99.33
0,1,10.35, 90.10, 10.52, 1.12, 59.3
0,2,10.65, 62.10, 12.12, 96.23, 19.3
1,0,96.37, 67.13, 312.62, 87.11, 87.18
1,1,90.94, 41.04, 63.01, 9.10, 30.3
1,2,11.98, 99.01, 41.30, 16.04, 10.4
2,0,11.88, 12.98, 182.22, 13.84, 81.09
2,1,50.35, 10.10, 10.52, 8.12, 91.3
2,2,88.51, 21.66, 81.13, 36.13, 97.3
________________________
*/

Table data;
String data_fn = "data/data.csv";
int dc = 60, dx = 10, dr =20, posx, posy;

void setup() {
  size(500, 500);
  data      = loadTable(data_fn, "header");
}

void draw() {
  background(80, 80, 0);
  for (int c =0; c < data.getColumnCount(); c++)     text(data.getColumnTitle(c), dx+c*dc, dr);     // data Column Header
  for (int r = 0; r < data.getRowCount(); r++)   for (int c =0; c < data.getColumnCount(); c++) {   // data
    posx = dx+c*dc;      
    posy = (r+1)*dr;
    text(data.getString(r, c), posx, dr + posy);                                                    // data cell content
  }
}

2019-03-30_00-20-45_snap

in editgrid looks like: ( sorry does a resort )
SNAG-0033

1 Like