User Tools

Site Tools


01_user_documentation:05_object:06_references:03_datasets

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
01_user_documentation:05_object:06_references:03_datasets [2025/08/15 16:47] – [Cleaning] Tim01_user_documentation:05_object:06_references:03_datasets [2025/08/15 18:20] (current) – [Add several values to one cell] Tim
Line 19: Line 19:
 ===== Adding data ===== ===== Adding data =====
  
 +Adding data to the referenced dataset can be done in two different ways, either by using java functions or with overloaded operators.
  
 +With java a row is added with addRow and then the data for the cells is defined with set(<columnNr>, value): 
 +
 +<code java>
 +dataset("DS_name").addRow().set(0,11.4).set(1,23.5);
 +dataset("DS_name").addRow().set(0,18.2).set(1,2.73);
 +</code>
 +
 +Additionally with getRow(<rowNumber>) an already added row can be found to add or update cells.
 +
 +
 +The other way to do this would be to use the << operator to push data in to the dataset:
 +
 +<code java>
 +dataset("DS_name") << 11.4 << 23.5;
 +dataset("DS_name") << 18.2 << 2.73;
 +</code>
 +
 +In this way the first pushed value is added to the first column and so on.
 +
 +==== Add several values to one cell ====
 +
 +To add more values(up to three) to one cell the set function can be used with more values: ''set(<cloumnNr>,<xValue>,<yValue>)'' or ''set(<cloumnNr>,<xValue>,<yValue>,<zValue>)''.
 +
 +Or using the operator:
 +
 +<code java>
 +dataset("DS_name") << new doulbe[]{11.4,23.5};
 +</code>
 +
 +===== Exporting =====
 +
 +Using rgg datasets can only be exported to csv like formats using the export function:
 +
 +<code java>
 +dataset("DS_name").export(new FileWriter(fileName));
 +</code>
 +
 +By default this creates a file with white spaces as separators, if another separator are needed it can be defined as a second parameter ''dataset("DS_name").export(new FileWriter(fileName), ",");''.
 +
 +An additional version of the two function exists with a StringBuffer as a first parameter.
 +
 + 
  
01_user_documentation/05_object/06_references/03_datasets.1755269263.txt.gz · Last modified: 2025/08/15 16:47 by Tim