最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Modify Row Data of the table in BIRT - Stack Overflow

programmeradmin0浏览0评论

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?

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?

Share Improve this question asked Mar 21, 2014 at 7:14 work_in_progresswork_in_progress 7671 gold badge12 silver badges28 bronze badges 2
  • This question is also posted at actuate developer.actuate./munity/forum/index.php?/topic/… – James Jenkins Commented Mar 21, 2014 at 13:30
  • Yes, I was the one who asks the same question there. – work_in_progress Commented Mar 22, 2014 at 14:27
Add a ment  | 

2 Answers 2

Reset to default 3

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);

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 puted 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"}
发布评论

评论列表(0)

  1. 暂无评论