PDA

View Full Version : User Functions



Anonymous
03-19-2002, 04:24 PM
Great start with JFreeReport it will come in very handy.

I'm trying to create my own functions and I've run into a couple of problems.

1) The function I'm creating is a String Function. getValue is never called on it. I looked at your source and I see that getFormattedText is called for NumberFunctionElement which calls getValue on functions, but I don't see an equivalent for StringFunctionElement (for now I've set the function as a number function in the xml with and empty format).

2) Can I break on a group as the result of a function instead of a field?

3) Is there a way to create a function which will take more parameters than just the field name?

Thanks

Anonymous
03-20-2002, 03:40 AM
Hi Steven,

Thanks for the feedback.

1) The NumberFunctionElement overrides the getFormattedText() to apply formatting to the number. StringFunctionElement doesn't override the default implementation of that method (in the FunctionElement class) which should just return the string. Unless there is a bug that I'm not seeing.
2) You can't but it would be a nice feature - I'll add it to the to-do list.

3) Same as 2.

Regards,

Dave Gilbert

Anonymous
03-20-2002, 08:45 AM
I believe this may be a bug. TextElement calls getFormattedText. FunctionElement's getFormattedText calls this.value. As you said, StringFunctionElement does not override this. The problem (in my opinion) is that getValue is not being called, instead this.value is called.

this.value is defined as protected so I don't know if your plan was to set this value directly, but by habit, I usually override methods if possible. I think FunctionElement's getFormattedText should call getValue.

Steve

Anonymous
07-18-2003, 12:00 AM
Pls refer to that:

http://forums.pentaho.org/showthread.php?t=31033+pageheader

Hope it helpful.

Taqua
07-18-2003, 04:51 AM
Hi,

the versions that contain the function element are heavily outdated and are no longer supported. After 2 redesigns, we don use the old way of formating values (or even supplying) values.

Since version 0.8.0 (which was released half a year ago) the values are no longer stored in the elements, they are read directly from the tablemodel. And the function element class was completly removed.

I dont know where you found that ancient version, but I guess it would be better to use one of the newer releases. :)

Have more fun,
said Thomas