> ## 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.

# ExportCSVField< TYPE > Class Template Reference

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

Exports SoS field data to a CSV text 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. |
| | [ExportCSVField](#aaab2c56f0af0a15486ca2e077cc61348) ([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), 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)=",") Default constructor 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. |
| [DataObjectContainer](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_container.md) | [field\_data](#af22724fd9c1e0dd42ec296e4784b9df8) The scalar object data to be exported. |
|  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. |
| std::vector\< [DataObjectKey](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_data_object_key.md) > | [output\_order](#a7e4aabf64a404fcb5b6f86f0c44f76fb) A data object key vector used to define a output order different from the filter ones. |
|  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) |
|  bool | [write\_indices](#a090c2ac1b8f5be786e0a09268ed48d0a) Writes the indices before each data set (default: true) |

### Control coordinates

| Type | Name |
| - | - |
|  bool | **write\_x\_coors** |
|  bool | [write\_y\_coors](#abeb22b2536fcd22ce7fd03c3204bb36c) If this is true, than the y-coordinate will be written. |
|  bool | [write\_z\_coors](#ad5df74233417485277f76e62d5bda57e) If this is true, than the z-coordinate will be written. |
|  bool | [write\_header](#a7669f4acf97a6982ff3134585c6276eb) if this is true (default), then two header lines are written |

## Detailed Description

#### template\<dataobject\_types TYPE>  class ExportCSVField\< TYPE >

Exports SoS field data to a CSV text file.

When determining the number of designs and quantities to be exported, the method only considers those type objects which are part of

**See also**

[ExportCSVField::field\_data](#af22724fd9c1e0dd42ec296e4784b9df8). Hence one can select the quantities to be exported. Currently, the exported CSV format contains 2 header lines and [a](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__tmath#ga7e205066f67b9e3fd4c8cbd5859e8da3) [Data](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data) block (for this example [a](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__tmath#ga7e205066f67b9e3fd4c8cbd5859e8da3) comma has been chosen as [delimiter](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_c_s_v.md#a0b2e98e6d6483b285675f9e0128ad223)):

1. the quantity name in the first line

   ```lua theme={null}
   [Indices,][Coordinates,]Quanties ...
   ```
2. the ID's followed by the design idents in the second line

   ```lua theme={null}
   [part-ID,][type-master-ID,][type-ID,]design-IDs ...
   ```

   The part-ID will be exported only in case of several part definitions whereas a *type-master-ID* will be written as needed, i.e. for integration point data export 3.-\* the data in all subsequent lines till EOF(!)

   ```lua theme={null}
   [integers, ... ]number, number, ...
   ```

## Constructor & Destructor Documentation

### ExportCSVField()

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

Default constructor initializing all member variables to valid defaults.

**Parameters**

| Name | Description |
| - | - |
| database | The database needed to determine some defaults, i.e. , the mesh type to suggest defaults for needed coordindates - if any |
| output\_file | The name of the output file. See *output\_file* for detailed information. |
| filter | The data type object filter with preselected objects to be written to the output\_file given |
| delimiter | The delimiter string, e.g. ";", which delimits the data entries within the data sets. See csv::CSVParser::m\_delimiter for more details. |

**Exceptions**

| Name | Description |
| - | - |
| std::exception | in case of conversion errors std::exception in case of program logical errors. Debug mode only |

## 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

### output\_order

```cpp theme={null}
std::vector< DataObjectKey > output_order
```

A data object key vector used to define a output order different from the filter ones.

Defines the data output order written after other optional data like indices and coordinates The size of the output\_order container may be different from the size of the data type dependent filter given. Even the IDs in the output\_order container given may be missing in one or all data type filters. If the size of the output\_order container is:

* smaller than the size of all unique ID's of the data type filter given, than the filter ID's matching the ID's in the output\_order will be reorderd as defined by the output\_order container. ID's that exist in the filter only are silently appended.
* bigger than the size of all unique ID's of the data type filter given, than the filter ID's matching the ID's in the output\_order will be reorderd as defined by the output\_order container. ID's that exist in the output\_order container only are ignored.
* zero, if the output\_order container is empty, than the data output order is defined by the return values of the filter iterators If the output\_order vector contains number entries than only the first match will be written.
