Excel Importer Schema - Not Able to Import a Template Document
0
Hello everyone, I am new using the ExcelImporter. I have created an import schema to import some rule definitions for my project. I noticed, I am not able to import the data. I assume it has to do with the enumerations, I am trying to map. This is the Data model I have used. I am importing the MlfbElectricConsumption, which also has MlfbElement (Property: Name) information in it, so I have mapped it as a Reference ( this was the only way possible). You can check the xml schema below for the mapping. When I perform the import, I get “Import is Finished. 0 records imported”. The following is the error message, I get in the stack trace ---------------------------------------------------------------------------------------------------------------------------------------------------------com.mendix.systemwideinterfaces.core.DataValidationRuntimeException: Calculation Type is required at com.mendix.basis.objectmanagement.DataValidationUtil.validateObjectMember(DataValidationUtil.java:64) at com.mendix.basis.objectmanagement.MendixObjectMemberImpl.checkBeforeSetValue(MendixObjectMemberImpl.java:253) at com.mendix.basis.objectmanagement.MendixObjectMemberImpl.setValue(MendixObjectMemberImpl.java:241) at com.mendix.basis.objectmanagement.member.MendixEnumImpl.setValue(MendixEnumImpl.java:67) at com.mendix.basis.objectmanagement.member.MendixEnumImpl.setValue(MendixEnumImpl.java:18) at com.mendix.basis.objectmanagement.MendixObjectMemberImpl.parseValueFromString(MendixObjectMemberImpl.java:272) at com.mendix.basis.objectmanagement.MendixObjectImpl.setValue(MendixObjectImpl.java:193) at com.mendix.basis.objectmanagement.MendixObjectImpl.setValue(MendixObjectImpl.java:185) at replication.MetaInfoProcessor.updateMemberAndSetState(MetaInfoProcessor.java:665) at replication.MetaInfoProcessor.changeMembersForBatch(MetaInfoProcessor.java:487) at replication.MetaInfoProcessor.storeChangedObjects(MetaInfoProcessor.java:235) at replication.MetaInfoProcessor.startProcessing(MetaInfoProcessor.java:66) at replication.MetaInfo.startProcessingObjects(MetaInfo.java:743) at replication.MetaInfo.finished(MetaInfo.java:768) at excelimporter.reader.readers.ExcelRowProcessor.finish(ExcelRowProcessor.java:169) at excelimporter.reader.readers.ExcelXLSXDataReader.readData(ExcelXLSXDataReader.java:48) at excelimporter.reader.readers.ExcelReader.importData(ExcelReader.java:451) 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:46) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54) at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:26) at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152) at com.mendix.basis.actionmanagement.UserActionCallBuilderImpl.execute(UserActionCallBuilderImpl.scala:30) at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:56) at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:50) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:217) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:167) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54) at com.mendix.basis.actionmanagement.DefaultActionMonitor$.$anonfun$run$1(CustomMonitoredAction.scala:18) at com.mendix.basis.actionmanagement.IMonitoredAction$$anon$1.execute(IMonitoredAction.scala:47) at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:26) at com.mendix.basis.actionmanagement.IMonitoredAction.monitor(IMonitoredAction.scala:49) at com.mendix.basis.actionmanagement.IMonitoredAction.monitor$(IMonitoredAction.scala:25) 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:60) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:47) at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54) at com.mendix.basis.actionmanagement.ActionManager.$anonfun$execute$1(ActionManager.scala:118) at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:659) at scala.util.Success.$anonfun$map$1(Try.scala:255) at scala.util.Success.map(Try.scala:213) at scala.concurrent.Future.$anonfun$map$1(Future.scala:292) at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33) at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33) at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) -------------------------------------------------------------------------------------------------------------------------------------------------------- My Schema definition used for the Import is shown below here in the xml: <?xml version='1.0' encoding='utf-8'?><ns1:ExcelTemplate xmlns:ns1="http://www.mendix.com/"><Nr>16</Nr><Title>Electrical Consumption Rule</Title><Description>Imports the Rules for the Electrical Consumption</Description><SheetIndex>1</SheetIndex><HeaderRowNumber>1</HeaderRowNumber><FirstDataRowNumber>2</FirstDataRowNumber><Status>VALID</Status><ImportAction>SynchronizeObjects</ImportAction><Column_Template><Column><ColNumber>0</ColNumber><Text>Calculation type</Text><MappingType>Attribute</MappingType><IsKey>No</IsKey><IsReferenceKey>NoKey</IsReferenceKey><Status>VALID</Status><Details>Attribute: CalculationType, type: Enum</Details><CaseSensitive>No</CaseSensitive><FindAttribute>CalculationType</FindAttribute><FindReference xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><FindObjectType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><FindMicroflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><DataSource>CellValue</DataSource><Column_MxObjectType_Reference/><Column_MxObjectType><MxObjectType><Name>MlfbElectricConsumption</Name><Module>Main</Module></MxObjectType></Column_MxObjectType><Column_MxObjectMember><MxObjectMember><AttributeName>CalculationType</AttributeName><CompleteName>Main.MlfbElectricConsumption / CalculationType</CompleteName></MxObjectMember></Column_MxObjectMember><Column_MxObjectMember_Reference/><Column_MxObjectReference/><Column_Microflows/></Column><Column><ColNumber>1</ColNumber><Text>MLFB element</Text><MappingType>Reference</MappingType><IsKey>No</IsKey><IsReferenceKey>YesMainAndAssociatedObject</IsReferenceKey><Status>VALID</Status><Details>Reference: Main.MlfbElectricConsumption_MlfbElement/Main.MlfbElement/Name, type: String</Details><CaseSensitive>No</CaseSensitive><FindAttribute>Name</FindAttribute><FindReference>Main.MlfbElectricConsumption_MlfbElement</FindReference><FindObjectType>Main.MlfbElement</FindObjectType><FindMicroflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><DataSource>CellValue</DataSource><Column_MxObjectType_Reference><MxObjectType><Name>MlfbElement</Name><Module>Main</Module></MxObjectType></Column_MxObjectType_Reference><Column_MxObjectType><MxObjectType><Name>MlfbElectricConsumption</Name><Module>Main</Module></MxObjectType></Column_MxObjectType><Column_MxObjectMember/><Column_MxObjectMember_Reference><MxObjectMember><AttributeName>Name</AttributeName><CompleteName>Main.MlfbElement / Name</CompleteName></MxObjectMember></Column_MxObjectMember_Reference><Column_MxObjectReference><MxObjectReference><Module>Main</Module><Name>MlfbElectricConsumption_MlfbElement</Name></MxObjectReference></Column_MxObjectReference><Column_Microflows/></Column><Column><ColNumber>2</ColNumber><Text>Base MLFB Component</Text><MappingType>Attribute</MappingType><IsKey>Yes</IsKey><IsReferenceKey>YesOnlyMainObject</IsReferenceKey><Status>VALID</Status><Details>Attribute: BaseMLFBComponent, type: String</Details><CaseSensitive>No</CaseSensitive><FindAttribute>BaseMLFBComponent</FindAttribute><FindReference xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><FindObjectType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><FindMicroflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><DataSource>CellValue</DataSource><Column_MxObjectType_Reference/><Column_MxObjectType><MxObjectType><Name>MlfbElectricConsumption</Name><Module>Main</Module></MxObjectType></Column_MxObjectType><Column_MxObjectMember><MxObjectMember><AttributeName>BaseMLFBComponent</AttributeName><CompleteName>Main.MlfbElectricConsumption / BaseMLFBComponent</CompleteName></MxObjectMember></Column_MxObjectMember><Column_MxObjectMember_Reference/><Column_MxObjectReference/><Column_Microflows/></Column><Column><ColNumber>3</ColNumber><Text>Order code</Text><MappingType>Attribute</MappingType><IsKey>Yes</IsKey><IsReferenceKey>YesOnlyMainObject</IsReferenceKey><Status>VALID</Status><Details>Attribute: OrderCode, type: String</Details><CaseSensitive>No</CaseSensitive><FindAttribute>OrderCode</FindAttribute><FindReference xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><FindObjectType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><FindMicroflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><DataSource>CellValue</DataSource><Column_MxObjectType_Reference/><Column_MxObjectType><MxObjectType><Name>MlfbElectricConsumption</Name><Module>Main</Module></MxObjectType></Column_MxObjectType><Column_MxObjectMember><MxObjectMember><AttributeName>OrderCode</AttributeName><CompleteName>Main.MlfbElectricConsumption / OrderCode</CompleteName></MxObjectMember></Column_MxObjectMember><Column_MxObjectMember_Reference/><Column_MxObjectReference/><Column_Microflows/></Column><Column><ColNumber>4</ColNumber><Text>Electric consumption</Text><MappingType>Attribute</MappingType><IsKey>No</IsKey><IsReferenceKey>NoKey</IsReferenceKey><Status>VALID</Status><Details>Attribute: ElectricConsumption, type: Decimal</Details><CaseSensitive>No</CaseSensitive><FindAttribute>ElectricConsumption</FindAttribute><FindReference xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><FindObjectType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><FindMicroflow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/><DataSource>CellValue</DataSource><Column_MxObjectType_Reference/><Column_MxObjectType><MxObjectType><Name>MlfbElectricConsumption</Name><Module>Main</Module></MxObjectType></Column_MxObjectType><Column_MxObjectMember><MxObjectMember><AttributeName>ElectricConsumption</AttributeName><CompleteName>Main.MlfbElectricConsumption / ElectricConsumption</CompleteName></MxObjectMember></Column_MxObjectMember><Column_MxObjectMember_Reference/><Column_MxObjectReference/><Column_Microflows/></Column></Column_Template><ReferenceHandling_Template><ReferenceHandling><Handling>FindCreate</Handling><DataHandling>Overwrite</DataHandling><PrintNotFoundMessages>false</PrintNotFoundMessages><CommitUnchangedObjects>true</CommitUnchangedObjects><IgnoreEmptyKeys>true</IgnoreEmptyKeys><ReferenceHandling_MxObjectReference><MxObjectReference><Module>Main</Module><Name>MlfbElectricConsumption_MlfbElement</Name></MxObjectReference></ReferenceHandling_MxObjectReference></ReferenceHandling></ReferenceHandling_Template><Template_AdditionalProperties><AdditionalProperties><PrintStatisticsMessages>AllStatistics</PrintStatisticsMessages><PrintNotFoundMessages_MainObject>true</PrintNotFoundMessages_MainObject><IgnoreEmptyKeys>true</IgnoreEmptyKeys><CommitUnchangedObjects_MainObject>true</CommitUnchangedObjects_MainObject><RemoveUnsyncedObjects>Nothing</RemoveUnsyncedObjects><ResetEmptyAssociations>false</ResetEmptyAssociations><Column_MxObjectMember/></AdditionalProperties></Template_AdditionalProperties><Template_MxObjectType><MxObjectType><Name>MlfbElectricConsumption</Name><Module>Main</Module></MxObjectType></Template_MxObjectType><Template_MxObjectReference_ParentAssociation/></ns1:ExcelTemplate> Can anyone please let me know what is the problem. If there is any workaround for this ?
asked
Jasper Lawrence
4 answers
0
Did you connect a microflow to your template to get the enumeration value from the excel file (likely to be a string) and return the correct value as an enumeration?
answered
Lennart Spaans
0
Hi Lars,
I just found out, but I am having a problem with my if else statement. do you know what should be my EOF ?
These are my ENUM
I am having problem with the if else statement
I used the idea, based on the example and I get the following error
Do you know what I should do here ?
answered
Jasper Lawrence
0
Hi Lennart,
I tried that (else empty) and I still had error, but I found another way to solve it and it now works. Thank you for the help.