How to avoid duplication data from export and import csv file in ERP

Hello to everyone,
I’m ever working on my app to record training courses of employee. I created a slice called “Export_Odoo” only with some selected columns from the table “CORSI” because I have to keep a specific column structure in order to import the csv in the ERP of my company. Now, I tried whit my colleagues the import in the ERP and after some setting, it works correctly and it’s amazing!! But I have a big problem that i hope to overcame with your help. The main problem is that when i import the csv once a month(more or less), the rows are duplicated in the ERP because I also import the data that I have already imported the previous month.

In order to avoid this problem, I think to set a virtual column called “EXPORT_CHECK” with type “Y/N” and every time i use action to export some data from the view based on table “Export_Odoo”, is set “Y” on the exported rows. So when i created a new record in the app (a new training course) is applied automatically the value “N” and on the next export, I’ll export only data whit “N”. How can i set this features?

I hope I was clear, but I would appreciate your advice to overcome the data duplication problem in every import on the ERP
Tks ALL!!

There are several ways of solving this problem. Let me suggest one.

Add a new DateTime field in table “CORSI” called “DateAdded” and give it the InitialValue NOW(). As you add new records to your table the DateAdded field will be assigned the current date/time. In slice “Export_Odoo” filter only those records added since the last time you did an export.

When you first add the new “DateAdded” field you will need to initialize all existing records in table “CORSI” to some date/time in the past.

4 Likes

Hi @Phil , I added a new column called “DATA_AGGIUNTA” with initial value NOW() and i set all existing records in a past date. If i set in slice “Export_Odoo” the filtered condition [DATA_AGGIUNTA]>NOW() of course i don’t see the value to export.

How can i set the condition on order to see only the new record?
Is it possible to export by selecting a particular period?
Tks you!

Create a Slice with a Row filter condition that only includes the newly created records.
Then export that slice.

@Phil Export_Odoo is already a slice. what formula can i use to include only the new records?

You could use a Row filter condition like:

ok, another way is insert a column “CHECK_EXPORT” type Y/N with initial value “N” and set in the slice the formula [CHECK_EXPORT]=“N”. then when i make the export, i set Y the exported data in database. It might works?

Yes, that should work also. You simply need a data column who’s value indicates the rows of interest.