Hi all,
I am starting on a project that involves using data from a large csv. For now I am just playing with the processing Table/row documentation and have created a mammals.csv file containing
amount, species, name
0, Capra circus, Goat
1, Panthera Pardus, Leopard
2, Equus Zebra, zebra
What I am trying to achieve is
- Randomly select one row
- First print the amount of that row
- Clear screen
- Then print name of that same row
- Clear screen
- Start process again
With the the below code both amount and name are appearing at the same time
Table table;
void setup() {
table = loadTable("mammals.csv", "header");
size(500,500);
background(0);
}
void draw() {
background(0);
TableRow row = table.getRow((int)random(0,3)); //print a random row
String name = row.getString("name"); // prints name for row
textSize(32); //text size
fill(255,0,0);
text(name, 100,100); // what to print and where
delay(1000); //delay for 5 seconds
//background(0); //background used to clear
String amount = row.getString("amount"); //a string with amount
textSize(32); //text size
text(amount, 100,100);
delay(1000);
}
I have tried to insert a background() between the String name and String amount but that is just returning amount.
Any suggestions much appreciated!