I’m a total newbie on BIRT and I’m not a javascript pro. I am using birt to create some reports by getting some information from my database. I have ip addresses on a column as strings. BIRT provides a sorting section for tables and I have this expression right there;
if(params["sorting"].value=="startdate")
dataSetRow["r_date_0"]
else if(params["sorting"].value=="enddate")
dataSetRow["r_date_1"]
else if(params["sorting"].value=="ipaddress")
dataSetRow["r_vchar_2"]
else
dataSetRow["r_vchar_3"]
this is working perfect for startdate and enddate, but when it comes to the ipaddresses, it compares them as string so in the sorted report, i see like ‘2’ is bigger then ‘199’.
I could just split ip addresses with ‘.’ and parse them to integers and compare if i was working with python or java, but I’m not sure how to do this with javascript in BIRT environment.
Any ideas on how can i modify my expression to achieve my needs will be appreciated.
Use in your dataset a computed column, where you transform your ip-addresses in a form that they can be sorted, e.g
You can use this field for sorting, and the original field for displaying ip-addresses