Advice needed on inputting an excel file into an existing open processing script.
in
Programming Questions
•
2 years ago
hi,
I am writing on this message board to ask if anyone could lend me some advice.
I am new to processing and apologise if the questions I am asking have simple answers or I have just simply been doing silly beginner mistakes. I deeply appreciate any time you spend trying to help me resolve my problems.
I am an part 2 architecture student at the MSA and I have recently been designing an educational facility for one of my assignments. I have purposed that the educational facility is ran on the principals of Santra Mitra, where students organise themselves into groups of four to self teach a subject of their choice. As a follow up from this design project I have undergone the task of designing a visual database that would show links between the students with similar learning desires, allowing them to organise themselves into groups to undertake self learning.
I have tried to achieve this by using an existing openprocessing script which links information from excel to produce such a visual database
The link to the script is below:
I firstly tried to edit the existing excel database that is linked to the script but as it is in greek I encountered problems opening and deciphering it in the English version of excel that I have.
I then made an excel database of my own in .csv format (similar to that in the existing excel file) and changing the
script
so that it would hopefully draw information from this new file. I then encountered errors in the script and received
the error message 'ArrayIndexOutofBoundsException: 4' in the data_read class at the line
data[i][j] = pecies[j]; //save every piece of every line in data array
I then though that the variable
int file_width = 3;
int file_height = 200;
String data[][] = new String [file_height+10][file_width+10]
might need changing to read from the new database that I inserted into the script.
I did a test replacing that part of the code with
int file_width = 3;
int file_height = 8;
String data[][] = new String [file_height+10][file_width+10]
to reflect the data I had in-putted into my trial database.
This did not work as I received the error message 'NullPointerException' in the data_organise class line
if(data[j][3].equals("Υ") == true || data[j][3].equals("Ε") == true)
I tried researching into why I had received these error messages but had no luck coming up with an answer.
After this failure I was a decided to change method of attack. I sourced and downloaded the
XlsReader from within the online processing library and decided to try and input this within the existing script which I hoped would allow me to link my excel file (now saved and linked in the standard .xls format)to the visual data display.
I have been unable to get this to work.
I have tried to adapt a script from one of the examples ( xlsreader_simple2 ) in the XlsReader to read the values which I wish to display from my excel file
import de.bezier.data.*;
XlsReader reader;
void setup ()
{
reader = new XlsReader( this, "inputdata1.xls" ); // assumes file to be in the data folder
reader.firstRow(); // automatically jumps to the first row with content and selects the first cell
reader.nextRow(); // next row and cell with content
while(reader.hasMoreRows() ); //loop through rows
// jump to the first data row and its first cell
{
reader.nextRow();
String NAME = reader.getString(); // Student Name
reader.nextCell(); // move down and read next cell
if (NAME.indexOf(":") !=-1) break; // exit loop once we reach at the end of the database
}
}
I run this and receive the error message 'break cannot be used outside of a loop or a switch'
On failing to see where I have went wrong I went back to the original open processing script to try and slot this part of script within it somehow.
as I am sure you can guess this has also been very unsuccessful.
Can anyone lend any advice on what I have been doing wrong and which route would be easiest proceed with ( be it trying to sort out my errors with the original script and the .csv file, or trying to use the XlsReader library and script)
If I can
eventually
learn how to adapt this open processing script to suit the needs of this project, my aim is to link the excel database to another program to allow people to enter in their own data (personal details and desired learning outcomes) so that the visual database can update itself automatically (although first my aim is to sort my problems within this script and then tackle with task).
Any advice or help you could lend would be very much appreciated as I am currently unsure how to proceed.
kindest regards,
aaron.
1
