HD structures are created in several ways, such as:
- Automatically—The system create an HD structure when a user creates a new record in the Header Detail application. You can then enter values into the fields and save the changes.
- Manually—Use the Create HD Structure action in the Logic Builder. You can use insert actions to add values to the HD Structure. Learn more in the Create HD Structure action topic.
When a Header record is deleted from a Header Detail application, both the Header record and associated Detail records are deleted. This only occurs if the Header and Detail are part of an HD Structure.
The HD structure type you select depends on how you're using the HD structure. HD structures can be:
| Type | Use to... | Configuration Notes |
|---|---|---|
| New | Insert a new record to a Header Detail table. Logic blocks treat the structure as a record to be inserted into the database. | To prevent unwanted updates from occurring, use a NATE container. If you don't use a NATE container, updates and validations from Header to Details and Details to Header with modified by another user errors may occur. The same updates in a Temporary HD Structure do not trigger and perform validations. |
| Existing | Update an existing Header Detail record. | |
| Temporary | Create a structure that isn't saved automatically. For example, passing a Header Detail record into a called logic block. | If you use temporary HD Structure but want to commit them, you must use the Save HD action before you reinsert any new HD structures. Validations that exist for New and Existing HD Structures are bypassed which means you do not need to use a NATE container. You cannot commit a temporary structure, so its usage is more limited. |
When a logic block is built over a Header Detail table, the logic block has access to the Header records. Use a Fetch Details action to access and work with the Detail records. When a logic block is not built over a Header Detail table, create an HD structure in the logic block.
For example in the WriteProcurementOrderToSupplierview logic block, the actions in the logic block create a new HD structure, insert a record into a header table, fetch detail records, insert a detail record in the data found loop, and then save a header detail record. The table below is an example of these logic block actions:
| Action | Action type | Action Summary |
|---|---|---|
| 0 | Create HD Structure | Create new HDStructure |
| 1 | Insert Records | Insert a record in ProcurementOrdersSupplierViewHeader |
| 2 | Fetch Detail Records | Fetch all ProcurementOrderDetail records |
| 3 | Insert Records | Insert a record in ProcurementOrdersSupplierViewDetail |
| 4 | Save HD | Save ProcurementOrdersSupplierView |
Insert records in to a Header Detail table
Logic blocks can use HD structures to insert records into Header Detail tables. Usually these records come from one or more tables that are not Header Detail tables, such as Main tables.
For example, the WriteGLTransaction logic block is the action block used to insert records into the GeneralLedgerTransactions table, which is a Header Detail table. When the WriteGLTransaction logic block is called, an HD structure is passed in. The WriteGLTransaction logic block validates the record, and then inserts the Header Detail record into the GeneralLedgerTransactions table.
Integrations
Logic blocks can use HD structure to create records during integrations, and organize data before inserting them into a Header Detail table.
For example, the CreatePayableTransactions logic block is used to insert records into the PayableTransactions table during integrations. The PayableTransactions table is a Header Detail table.
- The
CreatePayableTransactionslogic block is called by theIntegratePayableTransactionslogic block. TheIntegratePayableTransactionslogic block is built over thePayablesIntegrationtable, which is a Main table. - The
IntegratePayableTransactionslogic block passes in records for a specific run number to theCreatePayableTransactionslogic block. - The records are grouped and held in an HD Structure using the Create HD Structure action, and then inserted into the
PayableTransactionstable.
The IntegratePayableTransactions table is a Main table and the PayableTransactions table is a Header Detail table, and using the HD Structure allows you to organize the records before inserting them.
Pass data to a called logic block
Logic blocks can use HD Structure to pass data to another logic block. Usually this is done using the Call a Logic Block action.
For example, the CreateCreditCardIssuerInvoice logic block passes values in to the WritePayableTransaction logic block, which then inserts records into the PayableTransactions table. The PayableTransactions table is a Header Detail table.
When a supplier invoice is paid using a credit card payment method, an invoice is automatically created to reflect the balance now owed to the credit card company. This steps below describe the logic performed to complete this process.
- The
CreateCreditCardIssuerInvoicelogic block creates a temporary HD Structure to hold and organize values, inserts values into the structure, and then calls theWritePayableTransactionlogic block. - When the
WritePayableTransactionlogic block is called, the HD structure created in theCreateCreditCardIssuerInvoicelogic block is passed in. - The
WritePayableTransactionsaves records to thePayableTransactionstable. - The values are validated, and then committed to the
PayablesHeaderandPayablesDetailtables.