Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Extract numbers from a string using Birt Scripting
deltaaruna
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
}
Find more posts tagged with
Comments
There are no comments yet