When it comes to establishing rules for columns during the process of uploading data through an Excel importer, you have the option of utilizing a microflow to achieve this task. To implement this, consider the following steps:
Add New Attribute:
To the table where you intend to import the data, introduce a fresh attribute. You can either name it _IsImported or choose a more descriptive name, like IsDataImported. This attribute should be of the Boolean data type and initialized with a value of false. This attribute will play a crucial role in tracking whether data has been imported.
After The Import Java Action Inside the Microflow, you need to do:
Utilize the _IsImported Attribute:
Incorporate the _IsImported attribute to filter data retrieval from the database. Retrieve data where the _IsImported attribute has a value of false. This ensures that you only work with data that hasn't been processed yet.
Loop through Data:
Once you have the unretrieved data, loop through the corresponding table. Within the loop, you can implement your logic to process each record as required.
Logic Validation and Corrections:
During the loop, you can apply your validation and correction logic to each record. If you encounter records that need to be deleted, it's advisable to create a list (e.g., listToDelete) to store these records temporarily. You can add incorrect records to this list, and later, after the loop, delete them collectively.
Update _IsImported Attribute:
After processing each record within the loop, remember to update the _IsImported attribute of that record to true. This action marks the record as imported, preventing it from being processed again in the future.
By following these steps, you can establish an effective process for importing data while adhering to predefined rules. This method allows you to maintain data integrity, correct inconsistencies, and ensure accurate imports.