In the source landing table, the CUSTOMER_ID field is the primary key. We want to hash
this value and write both keys to the H_CUSTOMER hub table along with the date the records
are inserted. To do this, we use the Data Vault – Hub task template.
The following image shows the mapping this template is based on:
When the task runs, it hashes
the incoming primary key and uses the hash attribute as the primary key in the hub
table.
On the
Templates
page, click the
Data Vault –
Hub
tile and then click
Create a mapping
task
.
On the
General
tab, select the runtime environment to run
the task and then click
Next
.
On the
Sources
tab, select the landing table connection
and object for the Src_Landing_Table source.
Select the connection and hub table for the Src_Hub_Table source.
The template is preconfigured to check if records are already present in
the target hub table.
Click
Next
.
On the
Target
tab, select the target connection and the
target hub table.
Select the
Insert
operation.
On the
Input parameters
page, resolve the following
parameters:
Hub Key from Landing Table. Defines the primary key in the landing
table. You define the CUSTOMER_ID field as the primary key using the
following expression:
TO_CHAR(TRUNC(CUSTOMER_ID))
Filter Existing Records. Filters out records that already exist in the
hub table so only new records get inserted. You enter the following
expression:
IIF(ISNULL(BK_CUSTOMER_ID),TRUE, FALSE)
Join Condition. Joins the landing table and the hub table by the
CUSTOMER_ID field. You specify the join condition using the following
condition:
Landing_Hub_Key = BK_CUSTOMER_ID
Hub Field Mapping. The following table shows the field mapping
configuration to write data to the target:
Target fields
Incoming fields
CUSTOMER_HUB_KEY
Landing_Hash_Key
EX_CUSTOMER_ID
Landing_Hub_Key
DATE_INSERTED
DATE_INSERTED
Click
Save
.
When the task runs, it loads the new
business keys into the hub table along with the hash key and the date when the record is
loaded as shown in the following image: