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:
AttributesMapping
input parameter.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:
It's works properly.
I'd appreciate your thoughts on my changes! 😊