How can I delete a TableRow in processing?

Hi,
i’m new to coding, so hope for some help!! My code should save same variables in a table according to an given name. By searching for the name of this Variable-combination, i would like to delet the whole row. But how can i find out which the row-number is? I’ve tried findRow(), but for removeRow() an integer, that i don’t get, is needed.

Table table;
// setting up the table:
void setup(){
table = new Table();
table.addColumn(“Nummer”);
table.addColumn(“Name”);
table.addColumn(“GefäßLösung”);
table.addColumn(“GefäßLösung2”);
table.addColumn(“GefäßLösung3”);
table.addColumn(“GefäßProben”);
table.addColumn(“Pipettiervolumen”);
table.addColumn(“Pipettiervolumen2”);
table.addColumn(“AnfangsvolumenVerdünnung”);
table.addColumn(“Probenanzahl”);
table.addColumn(“Verdünnungsfaktor”);
table.addColumn(“VolumenLösung”);
table.addColumn(“VolumenLösung2”);
table.addColumn(“Volumenlösung3”);
table.addColumn(“SpitzeWechseln”);
table.addColumn(“SpitzeWechseln2”);
table.addColumn(“mischen”);
table.addColumn(“pumpen”);
table.addColumn(“schrittzwei”);
table.addColumn(“e_auf1”);
table.addColumn(“e_auf2”);
table.addColumn(“e_auf3”);
table.addColumn(“e_auf_verdünnung”);
saveTable(table,“speichern.csv”);
void draw(){
if (mousePressed && (mouseButton == LEFT)){
// setting variables:
int GefäßLösung =1;
float Pipettiervolumen = 0.5;
int Probenanzahl = 5;
float VolumenLösung=50;
boolean SpitzeWechseln = true;
float e_auf1 = 3000;
string name= “Hallo”; <
TableRow neu =table.addRow();
speichern(neu);
}
//remove Row with “name”:
if (mousePressed && (mouseButton == RIGHT)){
TableRow b = table.findRow(“name”,0);
table3.removeRow(b);
saveTable(table3,“speichern.csv”);
}
}
//save variables:
void speichern(TableRow z) {
z.setString(1,name);
z.setInt(GefäßLösung,2);
z.setInt(GefäßLösung2,3);
z.setInt(GefäßLösung3,4);
z.setInt(GefäßProben,5);
z.setFloat(6,Pipettiervolumen);
z.setFloat(7,Pipettiervolumen2);
z.setFloat(8,AnfangsvolumenVerdünnung);
z.setInt(Probenanzahl,9);
z.setFloat(10,Verdünnungsfaktor);
z.setFloat(11,VolumenLösung);
z.setFloat(12,VolumenLösung2);
z.setFloat(13,VolumenLösung3);
int spitzewechseln = int(SpitzeWechseln);
z.setInt(spitzewechseln,14);
int spitzewechseln2 = int(SpitzeWechseln2);
z.setInt(spitzewechseln2,15);
int Mischen = int(mischen);
z.setInt(Mischen,16);
int Pumpen = int(pumpen);
z.setInt(Pumpen,17);
int Schrittzwei = int(schrittzwei);
z.setInt(Schrittzwei,18);
z.setFloat(19,e_auf1);
z.setFloat(20,e_auf2);
z.setFloat(21,e_auf3);
z.setFloat(22,e_auf_verdünnung);
saveTable(table3,“speichern.csv”);
} <

1 Like

Table table;

void setup() {

  table = new Table();

  table.addColumn("name");
  table.addColumn("type");

  TableRow newRow = table.addRow();
  newRow.setString("name", "Lion");
  newRow.setString("type", "Mammal");

  newRow = table.addRow();
  newRow.setString("name", "Snake");
  newRow.setString("type", "Reptile");

  newRow = table.addRow();
  newRow.setString("name", "Mosquito");
  newRow.setString("type", "Insect");

  //-------------------------------

  for (TableRow row : table.rows()) {
    println(row.getString("name") + ": " + row.getString("type"));
  }
  println("");

  //-------------------------------

  int resultIndex = table.findRowIndex("Reptile", "type");   //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  table.removeRow(resultIndex);

  println("");
  //
  //-------------------------------

  for (TableRow row : table.rows()) {
    println(row.getString("name") + ": " + row.getString("type"));
  }
  println("");

  //-------------------------------
}
//