> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ExportCSVScalar Class Reference

Part of [Export](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__export)

Exports scalar data to a CSV file.

## Public Member Functions

| Type | Name |
| - | - |
| virtual | [check](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a43937566342ee4168150e9fa232ddfc1) () Checks some settings/preperations. |
| | [ExportCSVScalar](#ac0cb9bc2ffb48224a5857667515c08be) (string [output\_file](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a8643191a264f6d55fead82a6d23a88b6), [DataObjectContainer](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md) filter, string [delimiter](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a0b2e98e6d6483b285675f9e0128ad223)=",") Initializing all member variables to valid defaults. |
| | [save](#a6a338dc4344270fcbccadf5667ef12f9) ([Structure](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_structure) [database](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data#gaebcac3a2836ec9fdf2e47bd812994b6b)) Exports all data to the given csv output file. |

## Public Attributes

| Type | Name |
| - | - |
|  string | [delimiter](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a0b2e98e6d6483b285675f9e0128ad223) The delimiter string, e.g. ",", which delimits the data entries within one line. |
|  bool | [optiSLang\_compatibility](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a5681ad659e91643df77ee5bae59979c6) If this is true, then the idents of scalar-quantities will be modified to match allowed characters in optiSLang (default: false) |
| string | [output\_file](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a8643191a264f6d55fead82a6d23a88b6) The name of the output file. Must be non-empty. |
|  bool | [replace\_files](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a2f8b3cba47ad64fb6bda4b6428a032d3) If this is true, an existings output file will be overwritten. Otherwise an exception will arise (default: false) |
| [DataObjectContainer](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md) | [scalars](#ad51161079b951165329d79cb6be52ed1) The scalar object data to be exported. |
|  bool | [write\_design\_numbers](#a736df6af20bfd263c9b2f906bb16d0f6) Writes the design ID before each data set (default: true) |

## Detailed Description

Exports scalar data to a CSV file.

Exports only data assigned to the member variables scalars, node\_data, element\_data and intpt\_data. If, and only if, ALL these memeber are empty, then the Settings class tries to write down all the database data automatically. If several data types shall be exported at once, than the output file given will be reused as some kind of template string extended by data type IDs. See the description at *output\_file* for detailed information.

//!Exports SoS scalars to a CSV text file \
&#x20;When determining the number of designs and quantities to be exported, the method only considers those scalar objects which are part of

**See also**

ExportCSVSettings::scalars. Hence one can deactivate those quantities which should not be exported..

**Parameters**

| Name | Description |
| - | - |
| settings | A setting class containing all the information to control data export to a CSV file |

**Exceptions**

| Name | Description |
| - | - |
| std::exception | if more than one quantity is requested to export std::exception in case of conversion errors std::exception in case of program logical errors. Debug mode only |

## Constructor & Destructor Documentation

### ExportCSVScalar()

```cpp theme={null}
ExportCSVScalar(
    string output_file,
    DataObjectContainer filter,
    string delimiter = ","
)
```

Initializing all member variables to valid defaults.

**Parameters**

| Name | Description |
| - | - |
| output\_file | The name of the output file. |
| filter | |
| delimiter | The delimiter string, e.g. ";", which delimits the data entries within the data sets. See csv::CSVParser::m\_delimiter for more details. |

## Member Function Documentation

### check()

```cpp theme={null}
virtual check()
```

`virtual` `inherited`

Checks some settings/preperations.

**Exceptions**

| Name | Description |
| - | - |
| std::exception | If the settings are not correct |

### save()

```cpp theme={null}
save(Structure database)
```

`virtual`

Exports all data to the given csv output file.

If all member variables are empty all objects in the database will be exported. Otherwise the member variables acts as filter and only listed data will be extracted out of the database given and exported to the CSV file [output\_file](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a8643191a264f6d55fead82a6d23a88b6) given

**Parameters**

| Name | Description |
| - | - |
| database | The database containing all objects. |

**Exceptions**

| Name | Description |
| - | - |
| std::exception | If the output path is not a directory std::exception If no the output\_file is not writeable |

Implements [ExportCSV](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a61c3eed0322cb79606e39957a8afe9d9).

## Member Data Documentation

### output\_file

```cpp theme={null}
string output_file
```

`inherited`

The name of the output file. Must be non-empty.

Several modes in several situations are supported:

* The string points to a non-existing FS item:

  * The Settings class tries to split up the path given in its components: parent\_path, filename (boost::filesystem::stem) and file extension (boost::filesystem::extension) as described in the underlying FS library [http://www.boost.org/doc/libs/1\_53\_0/libs/filesystem/doc/reference.html#Path-decomposition-table](http://www.boost.org/doc/libs/1_53_0/libs/filesystem/doc/reference.html#Path-decomposition-table)
  * Non given components will be replaced by default ones and created if neccessary
