I have sequence throwing the error message: “ColumnName and while merging two datatables. The thing is, the column where it fails, it was created by me with a concrete DataType (string). Please see the details below:
My question is… why the column ‘Plant Name’ from DataTable1 and ‘Plant Name’ from DataTable2 have different DataTypes if I personally added the column in both of them indicating ‘String’ as the DataType?
I don’t directly add the column to io_dtMaterials, but io_dtMaterials is a consolidation of many dtMaterialSheet. The workflow is the following:
I read an Excel sheet and store it in dtMaterialSheet
I add 3 new columns (Plant Name, Product Name and Sheet Name) to dtMaterialSheet, all of them of Type String.
I merge dtMaterialSheet with io_dtMaterials
Write io_dtMaterials in a new Consolidation Excel at the end of the process.
Next time I execute the process, the robot reads the Consolidation Excel from last time, stores the data in io_dtMaterials and starts the loop again. (Read an Excel Sheet, store data in dtMaterialSheet, merge to io_dtMaterials, consolidate, etc.)
For that reason, io_Materials is a DataTable extracted from a consolidation of all previous read sheets to which new columns have been added. Therefore, I understand that the DataType of the consolidation Excel should be exactly the same as all the individual read sheets. But it isn’t…
@Marina_Ballester
thanks for your input. Lets keep in mind when read in data with read range the detected / used datatype can flicker driven by some values (e.g. string string string, vs. striong, int, date)
So lets find out what is happening - do debuggin the flow
after readin the Excel (dtMaterialSheet), adding additional columns it is merged with io_dtMaterials (so far we did understood)
But on the first merge how is io_dtMaterials initialized? Was it a clone or assignment from first MaterialSheet, (where nothing was to merge)?. Maybe do some debug checks on this.
However, to progress give a try on following:
use Object as Column DataType for e.g Plant Name Column
Or let control io_MaterialSheet the Plant Name Column Datatype dynamicly after adding as String datatype: