2006 JR Open Discussion Posted August 22, 2006 Share Posted August 22, 2006 By: tommy - tommy2381 how to add custom datatype 2006-02-07 05:39i 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:17You'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:28yes. 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:47I 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:52When 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:19Which 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:26yes 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:09The 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:50ok .thanks. this is the answer. By: tommy - tommy2381 RE: how to add custom datatype 2006-02-08 01:28sorry.. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now