rex_csv
Introduction
This 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.
This 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
Delimiter
Delimiter is set in property "Delimiter" or set by "Action:Set delimiter". Default is ",".
Delimiter is set in property "Delimiter" or set by "Action:Set delimiter". Default is ",".
Load table, get value, set value
Sample 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.
Sample 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 value
Sample capx
Set "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,
Sample capx
Set "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 row
Sample capx
Call "Action:Sort items in col" or "Action:Sort items in row" will sort table by values in a column or row.
Sample capx
Call "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 capx
A 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 "_".
Sample capx
A 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 table
User could traverse table with col then row, or row then col.
"Expression:CurCol", "Expression:CurRow", "Expression:CurValue", "Expression:CurPage" could be used under these conditions when traversing.
User 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"
"Expression:CurCol", "Expression:CurRow", "Expression:CurValue", "Expression:CurPage" could be used under these conditions when traversing.
Previous/next Column or Row
Sample capx
Get 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".
Sample capx
Get 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".
"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 tables
This 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.
This 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.
- Change the value by editing the entry of "row-xxx"