Internal imports

Internal imports are a pattern for automating the transfer of data from an initial table to a specific destination, ensuring the integrity and coherence of the information. The process follows a logic where a reference data set is selected, and from it, the relevant elements are copied to another location according to predefined rules.

Process Flow

  1. In the Processes menu, there is an option for internal imports.

    • A new import must be created and properly defined.
  2. The user defines the context (source and destination) from which they want to copy information.

  3. The hierarchy of the import must be defined, allowing data to be imported into multiple tables with the same structure (source and destination).

  4. The fields involved in the import are defined.

  5. The import is triggered by a specific action, such as pressing a button or activating an automatic event. (See more information about triggers below).

Definition

  • Identifier: Identifies the import. It should not contain spaces or special characters, except for underscores.

  • Return field: Used to record success or failure of the routine associated with the import button. If no list is defined, the field should be from the source table. If a list is defined, the field should be from the destination table.

  • Source table: The table from which the list fetches the fields. Only this table or directly/indirectly related tables can be selected.

  • Destination table: The table to which data is copied, following the same relationship rules as the source table.

Key Considerations

  • Each identified element is processed individually and moved to the appropriate destination.

  • During this process, data may be transformed, such as restructuring fields or applying specific formatting.

  • Connections between the original data and new records must be maintained to preserve data integrity.

Consistency and Structure

  • The process must ensure that only valid and well-structured data is copied.

  • Avoiding duplication or inconsistent records is essential to maintaining system reliability.

Proper Data Mapping

  • Each transferred element must be correctly positioned in the new location.

  • Clear rules must be established to ensure no essential information is lost.

Smart Automation

Triggers can be used to initiate the transfer automatically.

Mechanisms that may create conflicts or unnecessary repetitions should be avoided.

Example Scenario

Consider a scenario where every time a new reservation (BOOK) is saved, automatic records are created in the requests table (REQUE), one for each reserved room (BO_RO), to apply the occupancy tax.

relational model

For this, an internal import was created:

  • Source table: BO_RO
  • Destination table: REQUE

internal import

List to Import:

  • Source table: BO_RO
  • Destination table: REQUE
  • Hierarchy: 1

Fields to Import:

  1. CODBO_RO

    • Value to import: [BO_RO->CODBO_RO]
    • Destination: [REQUE->CODBO_RO]
  2. CODBOOK

    • Value to import: [BO_RO->CODBOOK]
    • Destination: [REQUE->CODBOOK]
  3. CODFC_HT

    • Value to import: 1 (key for "Occupancy tax" field)
    • Destination: [REQUE->CODFC_HT]

internal import - Fields

Additional Steps:

  1. Add a trigger button to the Reservations form.

Trigger button

  1. Create a trigger on the triggers to apply the import.
    • Ensure the button is referenced in the trigger.
    • The key action for the trigger is internal import.
    • An optional action can be added to reload the page after execution.

Trigger

Trigger action

In the application, when the user clicks on the button, the records in the BO_RO table are also imported into the Requests table.