I need to import data from CSV file to Navision. While importing record/data with discrepancy is common. I need to identify those records/data and intimate to the concerned persons.
1... Discrepancy I mean some mismatch of data. Say if some decimal field contains text character sort of things. What I need is, the mismatching records has to separately maintain in some temporary tables and export those data to excel. Then that excel sheet will be sent to concerned persons through mail as attachment. They'll rectify and import manually again. I have the concept, but don't know how to perform further. ](*,)
2... I am importing the Unit Price of Items on daily basis.
Let me know in case of any further clarification...
Ok, now it's clear, you have to:
1. Import the data into text variables (ONLY TEXT), instead of directly in your table
2. Do
Haserror := false;
//-Do this for all fields...
if not haserror then
Haserror := EVALUATE(mytable.myfield,mytextvariable);
//+Do this for all fields...
If not haserror then
mytable.insert; //or Modify
Else
InsertInErrorLog();
Where InsertInErrorLog() is a function to manage the population of the error log table.
Write the code in the onbeforeimport or onafterimport trigger (i never remember what's the right one).
obviously, the autosave,autoupdate,autoreplace properties of the dataport must be false, because you manually do the insert by code.
this is just a hint
-Mirko-
"Never memorize what you can easily find in a book".....Or Mibuso My Blog
Comments
Can you define "discrepancy"?
What are you importing?In what tables?
Can you post a piece of csv file?
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
1... Discrepancy I mean some mismatch of data. Say if some decimal field contains text character sort of things. What I need is, the mismatching records has to separately maintain in some temporary tables and export those data to excel. Then that excel sheet will be sent to concerned persons through mail as attachment. They'll rectify and import manually again. I have the concept, but don't know how to perform further. ](*,)
2... I am importing the Unit Price of Items on daily basis.
Let me know in case of any further clarification...
1. Import the data into text variables (ONLY TEXT), instead of directly in your table
2. Do
Where InsertInErrorLog() is a function to manage the population of the error log table.
Write the code in the onbeforeimport or onafterimport trigger (i never remember what's the right one).
obviously, the autosave,autoupdate,autoreplace properties of the dataport must be false, because you manually do the insert by code.
this is just a hint
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog