<< Click to Display Table of Contents >> Creating a Dataset with collections |
Overview
Datasets support collections with up to two levels. The procedure to define collections is explained in this article depending on how you define your dataset structure:
•Manually.
Adding collections from a .csv
If you want to create a dataset with collections in its structure, edit the .csv file to include the columns of your collection following this pattern:
CollectionName__Column
In this pattern, you need to use double underscore to split both the name of the collection and the name of the column. Furthermore, repeat the main register as many times as the number of items in the collection.
In the example above, the dataset has a Numeric type column (CountryCode), a String type column (CountyName) and a Collection type column called City; in this collection column you have two columns (Code and Name). As mentioned before, the collection related to the record Colombia has five items, so this is why the record value 57, Colombia is repeated five times. This is important when you feed your dataset from an environment. For more information refer to Working with Dataset environments.
If you use only one underscore character to split the collection and the column, the underscore is removed and the column is not interpreted as a Collection. For example:
Input value |
Interpreted as collection |
Column name(s) |
|
---|---|---|---|
City_Code |
No |
citycode |
|
CityCode_ |
|||
CityCode__ |
|||
City__Code |
Yes |
city |
code |
City___Code |
Back in the Bizagi Datasets service portal, click Select a .csv to upload your file from its location:
The dataset automatically detects the Data type of each column, including the collections and their inner columns.
It is important that you double-check that each column is set with the appropriate Data type. If there is a problem, you can manually change a column's definition.
A column detected as a collection cannot be changed to another Data type.
In the Bizagi Datasets service portal, click Create a schema manually, enter its Column Name and choose Collection as its Data type:
Click Add column and then click the pencil icon at the right of the collection type row.
In the new window, add the columns of the collection.
You can choose String, Numeric, Boolean, Datetime or Collection as the Data type.
Click Close to finish up and return to the dataset. Now, the column created shows its number of columns in parentheses.
Finally, analyze whether or not you should define a business key in your dataset with collections. Note that if you must have duplicate records such as a collection of countries and cities where the country record is repeated or a sales collection where the item's category is repeated, you should not define a business key so that records can be repeated.