Advanced Excel - ExcelToList java action throw Attribute not found in entity - Mendix Forum

Advanced Excel - ExcelToList java action throw Attribute not found in entity

0

I've been encountering an error with the Advanced Excel - ExcelToList Java action, specifically the 'Attribute not found in entity' error. This occurs under the following conditions:

To address this, I made some changes to the code in \javasource\advanced_excel\actions\ExcelToList.java:

  List<String> Fields = new ArrayList<String>();
        for (int i = 0; i < cellTotal; i++) {
            cell = row.getCell(i);
            if (cell == null) { throw new Exception("Cell 0 - " + i + " not found"); }

            // Manage Attribute skipped
            field = formatter.formatCellValue(cell);
            if (Arrays.asList(SkipArray).contains(field) || field.length()==0)
            { Fields.add(""); continue; }
            // find field before mapping
            IMetaPrimitive attribute = metaEntity.getMetaPrimitive(field);
            if (attribute == null) {
                // Manage attribute mapping
                for (String mapping : MappingArray)
                {
                    if (mapping.contains(field + "="))
                    { field = mapping.substring(field.length() + 1); break; }
                }
  
                attribute = metaEntity.getMetaPrimitive(field);
                if (attribute == null) { throw new Exception("Attribute " + field + " not found in the entity"); }
            };
            Fields.add(field);
        }

 

Committed:

commit-ebd0b69a-adbc-427e-870b-c5569ea50d07.png

 

It's works properly.

 

I'd appreciate your thoughts on my changes! 😊

Posted
0 comments