Creating a CSV Data Structure
  • 14 Feb 2022
  • 2 Minutes to read
  • Dark
    Light

Creating a CSV Data Structure

  • Dark
    Light

Article Summary

Overview

Data Structures can be created from CSV data by using the default data editor in the Decisions environment. Once the new structure is created from CSV data, Flow steps can deserialize and serialize the data. 

Note on Exporting CSV Data Structures [Database Stored]
CSV Data Structures [Database Stored] are saved to the database while CSV Structures are saved within Decisions as a Data Structure similar to Flow Structures. When exporting a CSV Data Structure [Database Stored], it does not transfer with data: only the structure itself exports. Data must be first exported with Flow logic or by the Import Data From CSV Action.

Configuration

The following settings are available upon creating a CSV Data Structure:

Setting NamesDescription
Read From FileCreates the CSV data structure based on uploaded CSV file
First Row Is Field NamesReads the first row of the uploaded CSV file as Data Structure column names
Ignore Empty RowsToggles upload of empty rows found in the CSV
SeparatorPrompts specification of separator for parsing through data
Create Database Table For TypeStores the CSV type in a database table

Example

  1. In a Designer Project Folder, select the CREATE DATATYPES/INTEGRATIONS button on the top Action Bar. 
  2. Select the XML/JSON/CSV tab when the window appears, then choose Create Types from CSV.
  3. Type a CSV Structure Name, and the Namespace should automatically populate. 
  4. Select the checkbox so that First Row Is Field Names, which is typically enabled since most CSV imports use header field names in the first row. 
  5. Use the Separator drop-down to indicate what kind of separator is used in the CSV, which is Comma by default.
  6. In the CSV Structure field, enter the header field name separated by a comma. 
  7. After the field names are defined, the CSV data can be pasted below them. Once the data is in this field, select CREATE.
  8. The data editor window will appear with the header fields' names pre-populated into the data structure configuration. When a data structure is created, it needs to have data fields defined. This example uses FName, LName, and Age - the same values used as field names in the CSV. All of the data underneath it in the CSV are values of these specific data fields similar to the composition of a Data Structure.
  9. Back in the Designer Project Folder, select the CREATE FLOW button from the top Action Bar. Choose the default template and select CREATE, name the Flow, then select CREATE again.
  10. In the Flow Designer, open the Toolbox and navigate to the User Defined Types > CSV Structures section, where the Deserialize and Serialize steps are available for this structure.
    The deserialize option is to convert the structure from a single serialized string into a more human-readable output with columns and values. Whereas the serialize option will take the CSV data and serialize it into one string.

Was this article helpful?