rex_csv

IntroductionThis plugin provides 2d hash-tables with initial values imported by csv format. CSV can be edited in excel/google document, or excel/google document can save as a csv format file.

Usage

DelimiterDelimiter is set in property "Delimiter" or set by "Action:Set delimiter". Default is ",".

Load table, get value, set valueSample capx"Action:Load table" could load 2d hash table by csv string. After load table, get value by using "Expression:At(Col, Row)". "Action:Set entry" could change value of cell in this table.

Parameter "Col", "Row" in "Expression:At(Col, Row)" are string by default, or a number index in columns/rows. For example, CSV.At("MONKS", "DEF") is equal to CSV.At(2, 2) at above diagram.

Type of valueSample capxSet "Eval mode" to "No" in properties table will treat all values to be string.Set "Eval mode" to "Yes" could parse value by "eval" function of javascrpt. It could assign number, string value. (eval function could return object/array of course, but the "Expression:At" only could return number or string.) For example,

number: 10

string: 'hi'

javascript function: Math.random() -- it return a number

Sort column or rowSample capxCall "Action:Sort items in col" or "Action:Sort items in row" will sort table by values in a column or row.

Multi-tables(pages)Sample capxA signle csv object instance could have more than one table, the tables are indexed by "page". Each page is a table. "Action:Turn page" could change current page to another page, if the target page is not existed, an new empty table will be created. Then user could load content by "Action:Load table".The 3rd parameter in "Expression:At(Col, Row, Page)" could be used to index the page, if ignored this parameter, it will get value from current page.The default page name is "_".

Traverse tableUser could traverse table with col then row, or row then col.

col then row: "Condition:For each col", "Condition:For each row in col"

row then col: "Condition:For each row" , "Condition:For each col in row"

"Condition:For each page" could be used to traverse between pages."Expression:CurCol", "Expression:CurRow", "Expression:CurValue", "Expression:CurPage" could be used under these conditions when traversing.

Previous/next Column or RowSample capxGet previous or next column name of a column by "Expression:PreviousCol" or "Expression:NextCol". Get previous or next row name of a row by "Expression:PreviousRow" or "Expression:NextRow".

Test if row or column exists"Condition:Entry is valid" will return true if both row and column exist, i.e. CSV.At( col , row ) is valid. Or test the column or row exists by "Condition:Has col", "Condition:Has row".

Save tablesThis plugin support official save/load system. Or use "Expression:TableToString" to return a JSON string to save a table into webstorage, "Expression:AllTalbesToString" to get all tables into JSON string. "Action:Load one table", or "Action:Load all tables" could load table(s).Or use "Expression:TableToCSV" to get csv string back.

Debugger

At debugger, user could

Change the page name by editing the entry "Page"

Change the col name by editing entry "Col"

The rows and the values will be shown if the "Page" and "Col" is valid.