Question

I want to change the data present in the row of the table which I used for grouping purpose in the BIRT. I know how to retrieve the value but I want to change the rendering value, precisely I want to transform the string. I checked an example on official page here:

if (this.getRowData().getExpressionValue(3) > 100)
    this.getStyle().backgroundColor="red";//This will only change the row instance

This is helpful to change the style of the text but I want to change the text rather than the style

var t = this.getRowData().getExpressionValue("row[colname]");
t= t.toUpperCase();  //any string transformation
this.valueExpr = t;  //this is not working

So how to assign new string to the row. I write this script at onRender event of the row. But it is not working. Any Idea?

Was it helpful?

Solution

You can achieve this in the onRender event of a data element (not on the row element):

var newval=this.getValue().toString().toUpperCase();
this.setDisplayValue(newval);

OTHER TIPS

I am not exactly sure what your desired end result is, but what I usually do when I want to modify a value; is create a computed column.

In this example I have a numerical values in the column (seAssignment) and I want to display a string value that is not not in the database. I can than add this to my table just like any existing data column includig using it to group on.

  • Open the data set in Outline
  • Click on Computed Column
  • New
  • Give it a name & Data Type (string)

Expression

if (row["seAssignment"] ==0){
"In use"
}else if (row["seAssignment"] ==1){
"In stock"
}else if (row["seAssignment"] ==2){
"Retired (or consumed)"
}else if (row["seAssignment"] ==3){
"Awaiting receipt"
}else if (row["seAssignment"] ==4){
"Return for maintenance"
}else if (row["seAssignment"] ==5){
"Return to supplier"
}else if (row["seAssignment"] ==6){
"Missing"
}else { 
"Undefined"}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top