v2.7 (latest)
Create a Constant Table from a CSV File ​
Instead of manually creating a Constant table, you can also drag and drop a CSV file on it.
Requirements ​
The following rules apply to CSV files:
- The file should have a header row
- Each row should have values separated by a comma
- If a value represents a number, do not add quotes
- If a value represents a string, add quotes to the value
An example CSV file:
key, value1, value2
"aaa", 2, 5
"bbb", 3, 6
"ccc", 8, 10Procedure ​
- Create a new Constant and set its Constant type to
Table. - Drag and drop your CSV file onto the Constant. ↳ Rulecube imports the CSV data into the constant table.
- Click Save.
Usage in code ​
If the Constant table you've dragged the CSV file on is named MyData, you may access it like this:
javascript
MyData.ccc.value2This returns the value 10 from the example above.
To check if a key exists:
javascript
'bbb' in MyDataor
javascript
MyData.includes('bbb')