In the Selected Fields pane, the Field Type column sits between Default Value and Key Generation, on the Fields tab.

image-20240320-212940.png

This value is fully controllable for all fields - the default value when a field is selected is Standard. But each field can have its own customised Field Type, by selecting an available option from the drop-down box.

image-20240320-213455.png

It is important to choose the correct Field Type for each field.

Field Type

Type Name

Description

Primary Key - Auto

This type is used on a destination DB Definition only.  When a new row is being inserted, the database server will allocate the data for that column (it cannot be mapped to).   If the value that is generated by the server is needed by Statelake at run-time (i.e. the ID allocated to header rows is needed to create the correct links for the child rows), then use Primary Key – Auto in conjunction with the appropriate Key Generation clause.

Primary Key

In a source DB Definition, this is used as part of the configuration for Custom ID behaviour.

Primary / Foreign Key

Should only be used for destination DB Definitions.  It combines the behaviour of the Primary Key and Foreign Key.

Foreign Key

If a destination DB Definition is on a 2nd or lower level dataview (i.e. not the topmost dataview) in a linked relationship, it is used in conjunction with a relationship line drawn from the current dataset to the upper dataview.   The effect of the foreign key setting is that when the dataset is being populated during mapping, the field in the current dataset with the current foreign key setting will have its value set to that of the field in the higher level dataset at the top of the link. It causes the fields in the lower child dataset to be automatically populated with the value that is held in the upper dataview that it is pointing to. It is often used where the field at the top of the link has been set with Primary Key - Auto.

The behaviour is very similar to using the D_ mechanism to reference a field elsewhere in the destination DB Definition.    

The initial Foreign Key can be set up using either drag-and-drop on the design canvas or with the link editor.  If you try to drag-and-drop a 2nd link, it will simply replace the first link.   So subsequent Foreign Keys can only be set up via the link editor, which is found as an icon on the child dataview.

Standard

A regular field that can be mapped with no other special behaviour. 

Standard - No Update

Standard - Post Insert

Auto Increment