Jump to content

how to add custom datatype


Recommended Posts

By: tommy - tommy2381

how to add custom datatype

2006-02-07 05:39

i need to add a new datataype for variables, fields and textfields and i want to used it for sums.

We need to make some sums that cannot be done with doubles(precision is lost); we have a custom framework for decimal numbers.

What I have to extend/modify?

Thanks.

 

 

By: Lucian Chirita - lucianc

RE: how to add custom datatype

2006-02-08 00:17

You'll have to implement JRIncrementerFactory and for JRVariable.CALCULATION_SUM implement a JRIncrementer (you can take JRDoubleSumIncrementer as an example).

 

Then, for all your sum variables of this type you'll have to set incrementerFactoryClass to the class name of your JRIncrementerFactory implementation.

 

HTH,

Lucian

 

 

By: tommy - tommy2381

RE: how to add custom datatype

2006-02-08 00:28

yes.

thise "for all your sum variables of this type" - what type i have to put to those variabiles?

Thanks.

 

 

By: Lucian Chirita - lucianc

RE: how to add custom datatype

2006-02-08 00:47

I guess that the type of the sum variables will be your custom datatype - I assume that your framework by adding two values produces a value of the same type.

 

Regards

 

 

By: tommy - tommy2381

RE: how to add custom datatype

2006-02-08 00:52

When i declare a variabile I have something like this :

<variable

name="PricingMatrixItemCustomerPrice_customerPriceAfterDiscountInEUR_SUM_General_group" class="java.lang.Double" calculation="Sum" resetType="Group" resetGroup="General_group"

<variableExpression>$F{PricingMatrixItemCustomerPrice_customerPriceAfterDiscountInEUR}</variableExpression>

</variable>

 

the problem is "class" atribute because jasper does a design verification (dtd validation), and i can choose only from java data type (double, boolean ans so on).

so what class i have to put there ? Object ?

Thanks.

 

 

By: Lucian Chirita - lucianc

RE: how to add custom datatype

2006-02-08 01:19

Which JR version are you using? I don't think there is a restriction on variable typs. What is the exact error you're getting?

 

 

By: tommy - tommy2381

RE: how to add custom datatype

2006-02-08 01:26

yes you are right.

but i want to used this also for fields , and textfields.

so there is this problem. i think.

thanks again.

 

 

By: Lucian Chirita - lucianc

RE: how to add custom datatype

2006-02-08 02:09

The restrictions on field types have been removed since 1.0.0. With 0.6.6, you should use Object.

 

With textfields, you could format the value to a String or, if your type extends java.lang.Number, use the text field pattern to format it.

 

HTH

 

 

By: tommy - tommy2381

RE: how to add custom datatype

2006-02-08 03:50

ok .thanks. this is the answer.

 

 

 

By: tommy - tommy2381

RE: how to add custom datatype

2006-02-08 01:28

sorry..

i'm using jasperreports 0.6.6

and this from dtd

<!ATTLIST field

name NMTOKEN #REQUIRED

class (java.lang.Object | java.lang.Boolean | java.lang.Byte | java.util.Date | java.sql.Timestamp | java.sql.Time | java.lang.Double | java.lang.Float | java.lang.Integer | java.io.InputStream | java.lang.Long | java.lang.Short | java.math.BigDecimal | java.lang.String) "java.lang.String"

>

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...