CSV Files
A CSV file is a delimited text file that uses a comma to separate values.
CSV files consist of data arranged in rows and columns. SAMMI has the functionality to load, save, set, edit, and manipulate the values within these rows and columns. These values can be saved as variables to be used in any way you want within the SAMMI environment.
Creates a CSV file. Note that the file isn’t saved until the ‘CSV Save’ command is also used.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
First Column (Name) | String | Name of the first column |
Saves your CSV file to a file path of your choice. The file path has to be the full file path of the file, ending with .csv, and currently works best if drive letters are in lowercase. Alternatively, you can use the /$global.main_directory$/
variable to save your CSV to the default directory.
When a CSV file is saved, an extra row appears at the bottom of the file that is used to save your default values. Modifying this extra row may result in your default values not being read properly by SAMMI, and your CSV being corrupted.
Note that the file path uses a forward slash instead of the Windows default back slash.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV. |
File Path | String | File path to save to. Accepts both relative and absolute path. |
Loads a previously created CSV file.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
File Path | String | File path to load the file from. Accepts both relative and absolute path. |
Unloads a CSV file that was previously loaded. This does NOT delete the CSV file from where it is saved to, it merely unloads the CSV data from the buffer space withn SAMMI.
A CSV file that has been loaded cannot be loaded again unless the CSV has been unloaded from the buffer space.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Checks to see if a CSV file exists, and returns true
or false
.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV. |
Save Variable As | String | Variable to save the result. |
Checks to see if a column in a CSV file exists. SAMMI will return -1 if it doesn’t exists or the column number.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV. |
Column Name/Number | Name of the column in your CSV. | |
Variable Name | String | Variable to save the result. |
Gets the size of either rows or columns in a specified CSV. SAMMI returns the size as a real number.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Save Variable As | String | Variable to save the result as |
Type | Drop Down List | Selection of either Row or Column Size |
Adds a column to a pre-existing CSV file.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
New Column Name | String | Name of new column |
Default Value | String | Value to be filled in the first box in the column |
New Column Name | String | Name of another new column |
Default Value | String | Value to be filled in the first box in the column |
New Column Name | String | Name of another new column |
Default Value | String | Value to be filled in the first box in the column |
Adds a new row to an existing CSV file. New row values (names) must be unique and cannot be duplicated.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
First Box Value (Name) | String | Value to be filled in the first box in the row |
Deletes a column from an existing CSV file.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Column Name/Number | Name or number of the column to be deleted |
Deletes a row from an existing CSV file.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Row Name/Number | Name or number of the row to be deleted. |
Retrives a value from a box in an existing CSV file. When retrieving values using ‘Column/Row Name’, the name in the yellow boxes have to be wrapped in ""
as the names are strings. If you use Column/Row Number instead, the number you input into the yellow boxes does not have to be wrapped in ""
.
When you use column/row numbers, keep in mind the numbers begin with 0,0. The left-most column in a CSV file is column 0. The first row below the row of column names is row 0.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Column Name/Number | Name or number of the column | |
Row Name/Number | Name or number of the row | |
Save Variable As | String | The variable to save the box value as |
Sets a value in a box. Functions the same way as ‘Set Local Variable’.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Column Name/Number | Name/Number of the column the box is in | |
Row Name/Number | Name/Number of the row the box is in | |
Value | String | Value to be saved to the box |
Finds a value in a specified column. The first box underneath the column title will return a position of ‘0’, and the numbers will increase as you go down the column. SAMMI will return a value of -1 if no match is found in the column.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Column Name/Number | Name of the column to search in | |
Find | String | Value that you are searching for |
Save Variable As | String | Variable name to save the position of the value |
Finds a value in a specified row. The left-most box in a row will return a position of 0
, and the numbers will increase as you go right along the row.
SAMMI will return the position of the value in the row if a match is found. A value of -1
if no match is found in the row.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Row Name/Number | Name/Number of the row to search in | |
Find | String | Value that you are searching for |
Save Variable As | String | Variable name to save the position of the value |
Sorts the values in a specified column of your CSV file. Values can be sorted alphabetically or numerically, and in ascending or descending format.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Column Name/Number | Column that requires sorting | |
Ascending | Checkbox | Tick to sort values in an ascending order |
Sort As Numbers | Checkbox | Tick to sort values as numbers |
Swaps the position of one column with another. Please note that the left-most column in any CSV (column 0) cannot be moved.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Column Name/Number | Name/Number of the column you want to move | |
Column Name/Number | Name/Numner of the column you want to swap with |
Swaps the position of one row with another.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV |
Row Name/Number | Name/Number of the row you want to move | |
Row Name/Number | Name/Number of the row you want to swap with |
Execute math on columns/rows in your CSV.
Box Name | Type | Description |
---|---|---|
CSV Name | String | Name of your CSV. |
Orientation | Dropdown | Select if you are doing math on a column or a row. |
Column/Row Name/Number | Name of the column/row to do math on. | |
Operator | Dropdown | Type or operation to do (Sum, Mean, Max or Min). |
Variable Name | String | Variable name to save the result. |
Orientation | Column/Row Name/Number | Operator | Result |
---|---|---|---|
column | 1 | Sum | 4 |
column | 3 | Mean | 4.50 |
row | 0 | Max | 4 |
row | 1 | Min | 2 |