Excel Import

0
Hi there   Struggling to get a file imported based on a unique key in both   The following error occured when importing document: Employment_Details.xlsx -------- com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreException: replication.ReplicationSettings$MendixReplicationException: The association MyFirstModule.Employment_Details_Applicant_Details is already defined but with a different object type, the given type is: MyFirstModule.Applicant_Details and the retrieved type is: MyFirstModule.Employment_Details | VERSION: Mx5_20161013     at com.mendix.basis.component.InternalCore.execute(InternalCore.java:535) Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreException: replication.ReplicationSettings$MendixReplicationException: The association MyFirstModule.Employment_Details_Applicant_Details is already defined but with a different object type, the given type is: MyFirstModule.Applicant_Details and the retrieved type is: MyFirstModule.Employment_Details | VERSION: Mx5_20161013     at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.java:178) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreException: replication.ReplicationSettings$MendixReplicationException: The association MyFirstModule.Employment_Details_Applicant_Details is already defined but with a different object type, the given type is: MyFirstModule.Applicant_Details and the retrieved type is: MyFirstModule.Employment_Details | VERSION: Mx5_20161013     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:37) Caused by: com.mendix.core.CoreException: replication.ReplicationSettings$MendixReplicationException: The association MyFirstModule.Employment_Details_Applicant_Details is already defined but with a different object type, the given type is: MyFirstModule.Applicant_Details and the retrieved type is: MyFirstModule.Employment_Details | VERSION: Mx5_20161013     at excelimporter.reader.ExcelImporter.startImport(ExcelImporter.java:129) Caused by: replication.ReplicationSettings$MendixReplicationException: The association MyFirstModule.Employment_Details_Applicant_Details is already defined but with a different object type, the given type is: MyFirstModule.Applicant_Details and the retrieved type is: MyFirstModule.Employment_Details | VERSION: Mx5_20161013     at replication.AssociationConfig.validateObjectType(AssociationConfig.java:141)     at replication.ReplicationSettings.addMappingForAssociation(ReplicationSettings.java:638)     at excelimporter.reader.readers.replication.ExcelReplicationSettings.addAssociationMapping(ExcelReplicationSettings.java:23)     at excelimporter.reader.readers.ExcelReader.importData(ExcelReader.java:318)     at excelimporter.reader.ExcelImporter.startImport(ExcelImporter.java:120)     at excelimporter.actions.StartImportByTemplate.executeAction(StartImportByTemplate.java:54)     at excelimporter.actions.StartImportByTemplate.executeAction(StartImportByTemplate.java:25)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:50)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:76)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:55)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:51)     at com.mendix.basis.actionmanagement.ActionManager$1.execute(ActionManager.java:170)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:33)     at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.java:174)     at com.mendix.basis.component.InternalCore.execute(InternalCore.java:531)     at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:60)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:200)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:157)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:50)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:76)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:55)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:51)     at com.mendix.basis.actionmanagement.DefaultActionMonitor$$anonfun$run$1.apply(CustomMonitoredAction.scala:18)     at com.mendix.basis.actionmanagement.IMonitoredAction$$anon$1.execute(IMonitoredAction.scala:47)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:33)     at com.mendix.basis.actionmanagement.IMonitoredAction$class.monitor(IMonitoredAction.scala:49)     at com.mendix.basis.actionmanagement.CustomMonitoredAction.monitor(CustomMonitoredAction.scala:22)     at com.mendix.basis.actionmanagement.DefaultActionMonitor$.run(CustomMonitoredAction.scala:18)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.runMonitoredAction(CoreActionHandlerImpl.scala:65)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:53)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:51)     at com.mendix.basis.actionmanagement.AsyncExecution$AsyncCallableWrapper$$anonfun$2.apply(AsyncExecution.scala:33)     at scala.util.Try$.apply(Try.scala:192)     at com.mendix.basis.actionmanagement.AsyncExecution$AsyncCallableWrapper.call(AsyncExecution.scala:32)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)     at java.lang.Thread.run(Thread.java:748)  
asked
1 answers
3

Eben,

When importing data via Excel, the best practice is to import the raw data into a helper entity.  This entity can mirror the column structure of your spreadsheet.  You should set the Excel Importer to create an object for each row.

Once the data is in Mendix, you can create a microflow to process the data and populate your Mendix entities with the correct associations.  You can also implement robust data validation, error checking and batch processing using this method, if needed.  On my helper entities, I typically add 3 attributes:  Processed (boolean), Success (boolean) and Notes (string).  Then as I am processing the data, I can keep track of what has been processed, if it has been successfully added to the appropriate Mendix tables and record any notes about what didn't work while processing.

Let me know if you have any questions about this approach.

Mike

answered