---
title: "Source object splitter"
canonical: "https://docs.vaultspeed.com/space/VPD/3163914550/Source%20object%20splitter"
format: markdown
---
This page will explain the splitter functionality on the Source editor.

The object splitter allows to 'copy’ a source table and let it be another entity.  You can select which columns should be taken along and which relationships.  And you can add conditions to actually split your data across multiple objects.

This allows you to get your objects to the correct granularity for integration in your data vault model.  The split objects can have different object types, attributes, and even data filters set on them.  After the split is done the split objects will behave like any other object throughout the tool.

> Macro (toc)

### Create Object Split

To split an object, drag and drop the object on the canvas and right-click on the title bar of the object that should be split, a new pop-up window will appear.  Select the ‘Create Object Split’ option.

![image](media://d05b0fe5-439e-4c60-9b3e-a3e5e4a55768)

This opens the 'Create a new Object Split' window.  The Split table name will be the new table name and the short and abbreviated name will be automatically created based on the split name.

![image](media://eafb8a10-5f05-4c97-a94f-7d2976786505)

### Split options

The following options can also be set:

- Auto-sync attributes
  - All existing attributes from the original object will be taken over to the split object.
  - All new attributes that will be added to the original source object in subsequent releases, will automatically be added to the split object.
- Auto-sync constraints
  - All existing relationships starting from the source object will be taken over to the split object.
  - All new relationships starting from the source object, that will be added in subsequent releases, will automatically be added to the split object.
  - All deletions of relationships from the main object will also be deleted on the split object.
- Auto-sync referencing constraints
  - All existing relationships ‘arriving at the source object’ will be taken over to the split object.
  - All new relationships ‘arriving at the source object’, that will be added in subsequent releases, will automatically be added to the split object.
  - All deletions of relationships ‘arriving at the source object’ will also be deleted on the split object.
- Deduplicate data on load
  - During code generation, it will add a ‘distinct’ in the query extracting the data from the INI/CDC table after applying the split-filter expression (see further).


After clicking the save button, the new split will be visible in the selection pane and canvas. 

In our example, we will split the customers object into a natural_persons and organizations table.

The result of this is that we see 3 objects on our source editor.

![image](media://36ec0538-3aa5-4f50-9d18-51101d1f21c1)

The main table will have the number of splits in the brackets next to their name to know that this is the main table.  Split objects will have their main table name in the brackets to identify that the object is a split.  The main table automatically gets the object type of ‘Source object’.

Notice that with the different settings, the natural_persons object has all fields copied over, and the organizations object is empty (and will have an error indicating that).

### Additional actions

All objects involved in a split-action (the main object and the split objects) now have additional actions you can do when you right click on the header of the object.

For the main object, the menu will have an option to 'Show only unused attributes'

![image](media://b54fd2cd-43c2-425e-b0b0-b117fbb6668f)

For split objects, the menu will have six options: the four options which were also in the add split destination pop-up, a ‘Create/Update filter expression’, and a ‘Delete Object Split(s)' option.

![image](media://85cf6a75-36b6-4e0d-815b-a3309129cc6f)

Clicking ‘Create Update filter expression’ in the objects split menu, will open a simple expression editor.  

### Filter expressions

In the Query builder pane, you can set simple SQL expressions to filter the records that should be available in this split.  You can create filters based on the columns of your original object.  These should be written in the SQL dialect of your target database system.

![image](media://20514cdd-9537-4aaf-9ac8-5436e13abef8)

The **Validate filter expression** button will validate the SQL code and put double quotes around the identified column names. This is to double-check no typing mistakes were made in the column name. If a column isn’t recognized, it will not get double-quoted. This filter will be ‘copied’ into the final SQL code (with correct markings) in a where clause.

The **Cancel validation preview** button will remove all validations active at that moment.

The** Save** button will update the expression for the selected split object.

### Moving attributes

When the ‘Auto-sync attributes’ option is not selected, you can manually add attributes from the main object to a split object.  Just right-click on the main objects attribute, select the destination split object and click Add. (multiple attributes can be selected at once)

![image](media://84d90968-00c6-4dd5-9dc6-0fdabe635823)

### Edit a split

Once the split is created and you have set all of your attributes and optionally your filters, you can make the following changes to the split objects.

#### Object properties

Some properties are still on the main object, so these will be **automatically set** on split objects:

- CDC-type

Other object properties **can be changed on each individual split** object:

- short name
- abbreviated name
- Object type (hub and satellite, many 2 many links, …)
- comments
- multi-active flag

#### Attribute properties

Attribute properties that will be **automatically set** on all splits (as they are properties of the main object) are:

- datatype
- data length
- data precision
- src_exist
- format mask
- numeric decimal

Attribute properties that **can be changed on each individual split** are:

- short name
- abbreviated name
- comments
- attribute types (business key, primary key, subsequence attribute, …)

### Relationships

When the auto-sync (referencing) constraints options are set, all relationships that you add/delete to the main object are also added/deleted from those split objects.

Relationships that you define on an individual split object, will only be applied to that object.

### Extra checks

VaultSpeed does some optional checks (next to the default ones we do on every object) to the split objects.  The extra checks that are implemented are:

- No relationships between the main object and a split object
- All active attributes (build_flag = Y) of the main object are at least in one of the split objects
- A split needs to have at least one attribute

### Code generation example

In the generated code we will create separate EXT, STG and Raw Data Vault objects for each split object, based on the definitions set in the tool.

Example code of a split object looks like this:

![image](media://042e8575-313a-4a1a-84b0-c4775200f60a)

Notice these elements

- filter expressions set during the split are added to the end of the code in the WHERE block
- a distinct is added because of the ‘Deduplicate data on load’ option