Grid command

Writes the table and matrix views a model defines out as CSV, so a table you read in the editor can also be read by whatever consumes CSV. The views themselves stay in the model, which is what keeps the export reproducible. Export grid views to CSV walks through an export step by step.

Export command

Export grid views defined in the SysML v2 model as CSV files. A hierarchical table exports its whole tree with a leading Level column that records each row’s depth, as described in Export to CSV.

Changed in version 1.0.0: The -i / --include and -e / --exclude options are removed. Set include and exclude in syside.toml instead. Without paths, the command loads the working directory.

Basic usage

Pass one or more model files or directories to export all defined grid views into the output/ directory:

syside grid export [paths...]
  • <paths...> - one or more .sysml / .kerml files, directories (searched recursively) or glob patterns. Defaults to the working directory. The model loads the way syside check loads it, with the workspace’s syside.toml and Sysand environment

Each view is written to its own file, named after the view’s qualified name with a table- or matrix- prefix: P::'My Table View' is written to table-P__My_Table_View.csv. Every character other than a letter, a digit, _ or - becomes _, and letters outside English, such as Ü, are kept.

Two views can still reduce to one file name, for example A::B and a view named A__B, or two names that differ only in case. One of them keeps the plain name, and each other view gets -2, -3 and so on before .csv. The command prints a note naming each view and the file it takes.

Note

This command exports grid views (table and matrix views) only. Other view definitions are handled by syside viz view. Passing a non-grid view to --qualified-name results in an error.

Available options

Option

Description

-h, --help

Display the help message with all available flags and short descriptions

-c, --config <CONFIG>

Path to a syside.toml configuration file. If not specified, the config is discovered by walking upward from the current directory, stopping at a directory that contains .git or sysand-lock.toml. Its include and exclude apply to the model files

-n, --qualified-name <QUALIFIED_NAME>

Qualified name of a view to export. Repeat the option for each view, as in -n A -n B. Defaults to all table and matrix views in the model

-o, --output-dir <OUTPUT_DIR>

Save the CSV files to the given directory. Defaults to ./output

--allow-errors

Export even when the model has errors, which can leave the CSV incomplete or wrong where they are. Critical errors, such as a syntax error, stop the export even with this flag. Warnings never stop an export, so they need no flag

--bom

Prepend a Byte Order Mark (BOM) to the CSV file to ensure Microsoft Excel correctly detects the UTF-8 encoding and displays special characters properly.

--max-file-name-length <CHARACTERS>

Longest file name to write, in characters, from 16 to 255. Only the view’s own name is shortened to fit. The table-/matrix- prefix, the number that keeps two clashing names apart and .csv are always kept. Defaults to 100

Note

In SysML v2, element names can contain spaces and special characters (e.g. 'Flight Controller v2' or 'Motor "Type A"'). When passing qualified names that contain such names, make sure to quote or escape them appropriately for your shell. For example, names with spaces should be wrapped in double quotes:

syside grid export -n "MyPackage::'My Table View'" models/

Alternatively, use simple names without spaces or special characters.

Exit codes

syside grid export exits with the following codes:

Code

Meaning

0

Success

1

Failure due to errors in the model without --allow-errors, a critical error in the model, a view that fails to export, an output directory that cannot be created, a --qualified-name that names no table or matrix view, a --max-file-name-length outside 16 to 255, or an internal error. A run that fails partway stops there, and the CSV files written before the failure stay on disk

2

Command-line usage error, such as an unknown option, a missing argument, no model files found, or no usable license

3

Configuration error: a syside.toml cannot be read or is malformed, the --config file does not exist, or its std names a missing directory

4

Nothing to export. The model has no table or matrix views, or at least one of them has no rows or columns, so no file was written for it. This applies to a view named with --qualified-name as well

When several apply, the run exits with the most serious: 1 over 4 over 0.