How to Load data from staging table to Main table

We have an requirement to extract the data from other source and then have to store in the main entity. 1. we are having an API to get the data from source. 2. we have a staging entity to load the data from API(Ex Entity Name OutflowProjectionImport and OutflowActualImport). 3. we have to load the data to main entity from staging entity(Ex.OutflowProjection,Vendor,PurchaseOrder,Currency,PaymentType. we are using MF to retrieve the list from staging entity then store the attributes values to main entity and master entities. This activity will be performed on daily basis. we would like to know what would be the best approach to achieve this. 
1 answers

Hi there,


Firstly, you would require a scheduled event to trigger the data collection using the API.


Assuming you do not want to process or alter the data that you are pulling from your external source, you can apply an import mapping to create your desired objects (and map the appropriate values).


If you do want to process or alter the data, I would apply an import mapping to create my staging objects and commit them. I would then trigger the processing of the data using a task queue (see the documentation here: Task Queue | Mendix Documentation).


Alternatively, you can use a secondary scheduled event to trigger your processing, where you can retrieve the list of staging entities and then process them - just keep your load in mind, though