...
Code Block |
---|
resultMatrix.imageCell("./images/small_trafficlight_1_green.png") resultMatrix.imageCell("./images/small_trafficlight_2_yellow.png") resultMatrix.imageCell("/images./small_trafficlight_3_red.png") |
...
Code Block |
---|
def rawMatrix = api.datamartLookup("CustTX","CustomerName","CustomerID","NetMargin%-") def resultMatrix = api.newMatrix("Margin Status","Customer Id","Name","Net Margin %") if(rawMatrix == null) return 0 def i=0 for(entry in rawMatrix.getEntries()) { def row =[:] row.put("Customer Id",resultMatrix.linkCell(entry.get("CustomerID"),"customersPage",entry.get("CustomerID"))) row.put("Name",entry.get("CustomerName")) def margin = entry.get("NetMargin%")/100 row.put("Net Margin %",resultMatrix.styledCell(margin,"#006300",null,"bold")) if(margin <= 0) row.put("Margin Status",resultMatrix.imageCell("./images/small_trafficlight_3_red.png")) if(margin <0.1 && margin > 0) row.put("Margin Status",resultMatrix.imageCell("./images/small_trafficlight_2_yellow.png")) if(margin >=0.1 ) row.put("Margin Status",resultMatrix.imageCell("/images./small_trafficlight_1_green.png")) resultMatrix.addRow(row) i++ if(i>10) break; } resultMatrix.setColumnFormat("Net Margin %",FieldFormatType.PERCENT) return resultMatrix |
...