diff --git a/src/main/java/org/spin/report_engine/data/ReportInfo.java b/src/main/java/org/spin/report_engine/data/ReportInfo.java index 244dcdf..73cd4aa 100644 --- a/src/main/java/org/spin/report_engine/data/ReportInfo.java +++ b/src/main/java/org/spin/report_engine/data/ReportInfo.java @@ -335,12 +335,22 @@ private void processChildren(Row parent, int levelAsInt) { List children = parent.getChildren(); PrintFormatItem previosLevelGroup = groupLevels.get(levelAsInt - 1); PrintFormatItem levelGroup = groupLevels.get(levelAsInt); - if(levelGroup == null || previosLevelGroup == null) { + if((levelGroup == null && groupLevels.size() > 1) || previosLevelGroup == null) { return; } rows.stream().filter(row -> { - return row.getLevel() == levelGroup.getSortSequence() && compareRows(parent, row, levelAsInt); + if(levelGroup == null && row.getLevel() > parent.getLevel() && compareRows(parent, row, levelAsInt)) { + return true; + } + if(levelGroup != null && row.getLevel() == levelGroup.getSortSequence() && compareRows(parent, row, levelAsInt)) { + return true; + } + return false; }).forEach(row -> children.add(row)); + // No Recursive + if(groupLevels.size() == 1) { + return; + } int nextLevel = levelAsInt + 1; if(nextLevel < groupLevels.size()) { children.forEach(child -> processChildren(child, nextLevel));