Skip to content

Commit

Permalink
Merge pull request #53 from thehyve/issue-324
Browse files Browse the repository at this point in the history
Issue OHDSI#324 - RiaH export highlight required and unmapped fields
  • Loading branch information
guuswilmink authored Nov 25, 2024
2 parents d35f930 + 324e39e commit 21f46e5
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,15 @@ private static void addTargetTableSection(CustomXWPFDocument document, ETL etl,
int rowNr = 1;
for (MappableItem targetField : fieldtoFieldMapping.getTargetItems()) {
XWPFTableRow row = table.getRow(rowNr++);
row.getCell(0).setText(targetField.getName());

// Check if the field is non-nullable and prepend an asterisk if true
String fieldName = targetField.getName();
for (Field field : targetTable.getFields()) {
if (field.getName().equals(fieldName) && !field.isNullable()) {
fieldName = "*" + fieldName;
break;
}
}

StringBuilder source = new StringBuilder();
StringBuilder logic = new StringBuilder();
Expand Down Expand Up @@ -177,6 +185,15 @@ private static void addTargetTableSection(CustomXWPFDocument document, ETL etl,
comment.append(field.getComment().trim());
}
}

// Grey out the font if source field, logic, and comment are all empty
if (source.toString().trim().isEmpty() && logic.toString().trim().isEmpty() && comment.toString().trim().isEmpty()) {
XWPFRun runGrey = row.getCell(0).getParagraphs().get(0).createRun();
runGrey.setColor("999999");
runGrey.setText(fieldName);
} else {
row.getCell(0).setText(fieldName);
}

createCellParagraph(row.getCell(1), source.toString());
createCellParagraph(row.getCell(2), logic.toString());
Expand Down

0 comments on commit 21f46e5

Please sign in to comment.