I have configured datasource as oracle DB in ireport and am doing a select on a table. Is it possible to create a custom function or expression while adding a variable in ireport?

Below are some of the things i am trying to do:

1) Need to calculate the total on a column. But the data from DB is in varchar (mixed with numbers, NA, etc...). So i have to check the data and if has number, i have to convert it to big decimal and calculate the total. I tried inbuilt total function but, since the data from DB is varchar it is not calculating the total.

2) Also i need to calulate the average, so i should consider only the numberic values for calculating the average. Plz help.

example data in DB: 1 5 10 NA 0

Expected Results:

Total = 1+5+10 = 16

Average=16/4 (4 coz NA should not be counted)= 4

Thanks...

Post edited by: mohanchandar, at: 2008/07/09 21:32

Below are some of the things i am trying to do:

1) Need to calculate the total on a column. But the data from DB is in varchar (mixed with numbers, NA, etc...). So i have to check the data and if has number, i have to convert it to big decimal and calculate the total. I tried inbuilt total function but, since the data from DB is varchar it is not calculating the total.

2) Also i need to calulate the average, so i should consider only the numberic values for calculating the average. Plz help.

example data in DB: 1 5 10 NA 0

Expected Results:

Total = 1+5+10 = 16

Average=16/4 (4 coz NA should not be counted)= 4

Thanks...

Post edited by: mohanchandar, at: 2008/07/09 21:32

## 0 Answers:

*No answers yet*