This page explains how to introduce new attributes and control them in a collection tree.  Typically, these attributes are simple fields, but there are other possibilities, as detailed in the Attributes page.  Most of the controls below are also available from the ERD view and the Object Browser.


1. Root

2. Add, Insert or Append  

3. Controls

4. Choosing family of attribute, field type, and choice


1. Root

When you create a new collection, you get an empty Tree view with a fixed root:


2. Add, Insert or Append

In simple terms, the difference between the 3 actions are:

- Add: introduce a new attribute as a child to the right of the selected attribute

- Insert: introduce a new attribute before the selected attribute and as a sibling, i.e; at the same level

- Append: introduce a new attribute at the bottom of the level of the selected attribute

2.1 Add Attribute

Not all types of fields are allowed to have attributes.  Root is allowed to have only attributes as children, no siblings.  Documents are also allowed to have attributes a and arrays are will have array items.  

plus equals


2.2 Insert Attribute

Siblings can be inserted before the selected attribute, at the same level.   .


plus equals


2.3 Append Attribute

Siblings can be appended at the bottom of the same level.

plus equals



3. Controls

When an attribute is selected, the color of the box is changed to turquoise.  

3.1 Introduce an attribute

There are 4 ways to introduce a new attribute

3.1.1 Menu

Choose the appropriate option in the Actions menu:

3.1.2 Shortcuts

Press the keyboard shortcut of your choice:

Shortcut

Description

Ctrl+A

Add attribute

Ctrl+I

Insert field

Ctrl+E

Append field

Ctrl+X

Cut

Ctrl+C

Copy

Ctrl+V

Paste

Del

Delete

Ctrl+D

Duplicate

3.1.3 Toolbar

Choose the appropriate icon in the toolbar:

with:


Icon

Description

Add attribute

Insert field

Append field

Move up

Move down

Toggle details in diagram


and also:

with:


Icon

Description

Cut

Copy

Paste

Del

Duplicate

3.1.4 Contextual menu

Right-click on an existing item to display a contextual menu:

Only available options are activated, depending on the item selected when you perform the right-click.  To understand the different types of attributes, you may want to read this page.

3.2 Move an attribute

To change the order of the attributes within a level, use the Move Up or Move Down icons in the toolbar.  You may also move an attribute with your mouse by selecting the attribute, holing your left mouse button and dragging the box up or down in the same level.

3.3 Delete an attribute

There are several ways to delete an attribute.  You must first select it, then:

- choose Delete from the Edit menu

-  press the Delete key on your keyboard

- click the button in the toolbar

- right-click the attribute and choose Delete


3.4 Duplicate an attribute

When you choose to duplicate an attribute, all the properties of the selected item will be copied to a new attribute as a sibling at the same level, including the relationship.  There are several ways to delete an attribute.  You must first select it, then:

- choose Duplicate from the Edit menu

- press the shortcut Ctrl+D

- click the button in the toolbar

- right-click the attribute and choose Duplicate


3.5 Cut, Copy, and Paste

These control have a behavior similar to what is expected in any desktop application.  When performing the operation, all the properties of the selected attribute will be copied to a new attribute as a sibling at the same level, including the relationship.


3.6  Collapse/Expand

When an attribute has at least one attribute, its descendance can be collapse or expanded by pressing the - or the + sign to the right of the box:



3.7 Toggle details

You may also toggle the appearance of details by pressing the button:



4. Choosing family of attribute, field type, and choice

4.1 family of attributes




For an array:


For choices:


4.2 Field type

Field types include standard JSON Schema field types, plus the BSON types not already in JSON Schema.  BSON is a binary serialization format used to store documents and make remote procedure calls in MongoDB. The BSON specification is located here.  BSON supports the following data types as values in documents.


This list varies depending on the database target.



'4.3 Choice

You may add choices for alternate sub-schemas:




4.4 Reference definition

You may add references to re-usable objects as explained here.


4.5 DBRef (MongoDB only)

Hackolade supports this MongoDB convention.  



4.6 Pick from list

If you want to re-use a previously created attribute (without making it a re-usable reference definition), then you can copy its properties with this option:







There are several ways to create a new field.  Depending on which attribute you select, you will want to add the new attribute as an attribute, or as a sibling.


and to Append:


For each of the 3 methods (Add attribute, Insert, and Append), there are 4 ways to do so:

- from the menu, choose Actions >  then Add attribute, Insert field or Append field

- press the shortcut Ctrl+H (Add attribute), Ctrl+E (Insert field), or Ctrl+D (Append field)

- from the toolbar, choose the 'add attribute' button

- inside the central pane, Schema tab, right-click on the box for which you want to create a child attribute, and choose Add Attribute