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.
In the Processes menu, there is an option for internal imports.
The user defines the context (source and destination) from which they want to copy information.
The hierarchy of the import must be defined, allowing data to be imported into multiple tables with the same structure (source and destination).
The fields involved in the import are defined.
The import is triggered by a specific action, such as pressing a button or activating an automatic event. (See more information about triggers below).
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.
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.
The process must ensure that only valid and well-structured data is copied.
Avoiding duplication or inconsistent records is essential to maintaining system reliability.
Each transferred element must be correctly positioned in the new location.
Clear rules must be established to ensure no essential information is lost.
Triggers can be used to initiate the transfer automatically.
Mechanisms that may create conflicts or unnecessary repetitions should be avoided.
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.
For this, an internal import was created:
BO_RO
REQUE
List to Import:
BO_RO
REQUE
1
Fields to Import:
CODBO_RO
[BO_RO->CODBO_RO]
[REQUE->CODBO_RO]
CODBOOK
[BO_RO->CODBOOK]
[REQUE->CODBOOK]
CODFC_HT
[REQUE->CODFC_HT]
In the application, when the user clicks on the button, the records in the BO_RO table are also imported into the Requests table.