BIRT Exchange Forum: Extract numbers from a string using Birt Scripting - BIRT Exchange Forum

Jump to content


 

No Latest Open Poll.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Extract numbers from a string using Birt Scripting Rate Topic: -----

#1 User is offline   deltaaruna Icon

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 21-March 12


Posted 21 March 2012 - 01:43 AM

0 down vote favorite
share [g+] share [fb] share [tw]


I am developing a reporting application using BIRT. The database field contains other characters with the numerical data. I needed to filter out all other unwanted characters and extract only the numerical data from the database field. I didn't do it at the query(It was not feasible with my requirements). I did it at the BIRT script. But the javascript regex part of following BIRT script is not working. (But the javascript regex is correct. I tested it in online javascript validating sites) But with the BIRT script, regex part is not working. How can I implement this BIRT script correctly?

if(BirtComp.like(row["fldDescription"],"%Plate Count%",true)){
var data = row["bbb"];
var num = 0;
try{
num= parseFloat(data.match(/\d+/)[0]);//this is the regex part that is not working
}
catch(err){
num = row["bbb"];
}


if(num<=100){
if(BirtComp.match(row["fldResult3"],"/^.*<.*/") ){
1.4
}else if(num==100){
num
}else{
1.4
}
}else{
num
}
1

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users