If you are trying to use a dataport to import, you should know that when you run a dataport while it is in design mode, it will not actually import the data. So it could be that it works perfectly, it is not showing you an error message, but because it is not actually importing enything you *think* it fails. You need to save the object and run it in run mode, and test it that way.
yes, DenSter is right, this is the most significant "error" of an user which use a dataport in design mode. Take a look also here. It's an other situation, but the same problem / solution
I find dataports are always tricky for precicesly this reason. So to get around it I almost always read all the data into text variables instead of the actual fields in the table and write an error file. Then have 2 ways of running it - import all or show error.
1) If all values are read into text variable that are 1024 characters wide there is very little chance that an error will occur. If you use an array then you can easily pass the data around with one variable.
2) Build a codeunit to do all of the work of inserting customer, vendor, or whatever record you need to create. Then you can use the
IF CODEUNIT.RUN
call to write the data - if it fails then you know the data couldn't be written. Note that this step should only be run in the "show error" mode
3) Write any records to an error file that failed the import process in step 2. This will allow only those records that were in error to be processed again. This follows the paradigm of writing the records that you can and saving the records you can't.
This will then allow a user to run the data port repeatedly until all of the records are imported and they can run it to show the error (e.g. posting group X does not exist).
The Migration tool does this. The only reason we created an extra import option to our AddOn is because the tool import the field in order of field number.
Comments
Or you can use a variable to count number of lines input and use COMMIT to save the records.
These are the methods I used when import huge amount of data.
RIS Plus, LLC
http://www.mibuso.com/forum/viewtopic.p ... t=dataport
regards
1) If all values are read into text variable that are 1024 characters wide there is very little chance that an error will occur. If you use an array then you can easily pass the data around with one variable.
2) Build a codeunit to do all of the work of inserting customer, vendor, or whatever record you need to create. Then you can use the call to write the data - if it fails then you know the data couldn't be written. Note that this step should only be run in the "show error" mode
3) Write any records to an error file that failed the import process in step 2. This will allow only those records that were in error to be processed again. This follows the paradigm of writing the records that you can and saving the records you can't.
This will then allow a user to run the data port repeatedly until all of the records are imported and they can run it to show the error (e.g. posting group X does not exist).
Epimatic Corp.
http://www.epimatic.com