class _rrTable

Parent Previous Next



_rrTable is a class to store a table and export it.



Cells

Each table cell can store data in 3 different types:



Row/Column finder helper

There are some helper functions to place data if you only know the column or row title, but not the index of the row/column.

If the date or name does not exist, it is added.


For these functions, the rrTable will use 

"Names" for the title of columns 

"Date" for the title of rows  (can be sorted after date in the end)


Example Table:


NameA

NameB

01.May.2017



15.Okt.2017



01.June.2017




Instead of specifying for example "column 1", you tell rrTable to place it into column "NameA".

Or you specify to place it into cell [ NameB, 01.June.2017].





Class _rrTable functions

Can be mixed with "Helper" functions


Return type

Name

Description


setHeader(int column, string text)

Sets the column title.


setHeaderDatetime(int column,  datetime);

Sets the column title.

bool

outOfBounds(int column, int row)

Returns "true" if the coordinates are outside the current table size.

int

rowCount()


int

columnCount() 



setDatetime(int col, int row, datetime)



setString(int col, int row, string text)



setInt(int col, int row, int number)



setFloat(int col, int row, float number)



addInt(int col, int row, int number)



addFloat(int col, int row, float number)

Please see setDecimalSeperator()  as well

string

cellAsString(int col, int row)


int

cellAsInt(int col, int row)


float

cellAsFloat(int col, int row) 


int

cellType(int col, int row) 


bool

saveAsCsv (string filename, bool switchColRow)

saveAsCsvComma (...)

saveAsCsvSemicolon (....)

Saves the table as .csv file. Returns "true" if it was successful.


saveAsCsv() uses the comma as default, on Windows it reads the system environment to decide which column divider should be used.

If you want to specify it explicitly, please use saveAsCsvComma() or saveAsCsvSemicolon()

string

fileError()

Contains the error message if saveAsCsv returned "false".


setDecimalSeperator( character )

By default, rrTable uses a point as decimal separator. On windows, it reads your system settings.

You can override this behavior with this function,




Class _rrTable functions "Helper"

Can be mixed with default functions


Return type

Name

Description


sortRowsByNumber()

Sort rows by first column


sortRowsByString()

Sort rows by first column


setDatetimebyName  (string name,int row, datetime)



setStringbyName  (string name,int row, string text)



setFloatByName  (string name,int row, float number)



setIntByName  (string name,int row, int number)



addFloatByName  (string name,int row, float number)



addIntByName  (string name,int row, int number)



setFloatByNameNDate  (string name, date day, float number)



setIntByNameNDate  (string name, date day, int number)



setStringbyNameNDate  (string name, date day, string text)


int

rowIndex  (string name, bool addRow)

If addrow is set, the row is added if "name" does not exist in one of the rows

int

rowIndexDate  (date day, bool addRow)

If addrow is set, the row is added if "day" does not exist in one of the rows

int

colIndex  (string name, bool addColumn)

If addColumn is set, the row is added if "name" does not exist in one of the columns