You are here:
Use Case 2: Create a Primary Key Using a Composite Key
This use case creates a composite key and sets a formula field as the primary object.
An order can have several products, and the same product can exist in multiple orders. Order Confirmation Number and Product ID can also have a many-to-many relationship.
| Raw Data | Goal |
|---|---|
| The fields Order Confirmation Number and Product ID. The combination of these two fields uniquely identifies a row. | Create the formula field “Unique ID” that concatenates Order Confirmation Number with Product ID. Set the Unique ID as the Primary Key in Object Details. |
- For Field Label, enter Unique ID.
- For Formula Return Type, select Text.
- In the syntax editor, enter the formula: CONCAT(sourceField[‘Order Confirmation Number’], "_", sourceField[‘Product ID’]).
- In the test input box, validate the formula using these combinations.
- “Order Confirmation Number” with value of “A43JCT” and “Product ID” with value of “soap” returns “A43JCT_soap”.
- “Order Confirmation Number” with value of “A43JCT” and “Product ID” with value of “cookie” returns “A43JCT_cookie”.
- “Order Confirmation Number” with value of “PT56CG” and “Product ID” with value of “soap” returns “PT56CG_soap”.
- Click Save.
- Verify that “Unique ID” is added as a field.
- In the Primary Key dropdown, select Unique ID.

