darya Posted March 6, 2007 Share Posted March 6, 2007 Hi, I want to convert a long value into a String (for a patternized duration) and have a method which does right this conversion. But how on earth can implement or use this method in iReport :whistle: ? Any hints are welcome :) Regards,darya Link to comment Share on other sites More sharing options...
jmurray Posted March 7, 2007 Share Posted March 7, 2007 Recast it. eg. $P{myLongParameter}.toString() Link to comment Share on other sites More sharing options...
darya Posted March 7, 2007 Author Share Posted March 7, 2007 It seems that I wasn't clear with my question :unsure: . The $P{myLongParameter}.toString() is too less. I have a method that displays the duration, say public String getDuration(long l) {...}. This method displays the duration as I want it to be displayed. The question is now, how can I make this method known to iReport? Regards,Darya Link to comment Share on other sites More sharing options...
darya Posted March 7, 2007 Author Share Posted March 7, 2007 Any hints :dry: ? Link to comment Share on other sites More sharing options...
darya Posted March 8, 2007 Author Share Posted March 8, 2007 :woohoo: . I'm not sure whether the question is too hard or too easy. Let me know :cheer: Link to comment Share on other sites More sharing options...
darya Posted March 8, 2007 Author Share Posted March 8, 2007 There is a very nice thread from the JasperReports Discussion/Help forum rename values/Months which seems to solve my problem :woohoo: . I thought I could do all editing stuff from inside iReport (I use v1.1.0) but that's obviously not the case at least not for the version I use. But since there is this wonderful .jrxml file one can do some editing like adding an <import .... /> and so bypassing iReport's weakness. So far the theory, I'll have to check that out :sick: . Regards,darya Link to comment Share on other sites More sharing options...
darya Posted March 8, 2007 Author Share Posted March 8, 2007 Ok, seems that I had to answer this question myself :S . I got my own class integrated with iReport and share the steps with you as shown below: go to your jasperreports home directorygo to the lib directory and copy jdt-compiler-3.1.1.jar into your clipboardgo to your iReport home directory and paste jdt-compiler-3.1.1.jar into the lib directoryrename or delete the original file jdt-compiler.jarstart your iReportgo to the file menu Tools->Options and click the Compiler tab folderUnder Compiler select JDT Compiler (need jdt-compiler.jar) and click Saveto add your class to iReport's classpath, go to menu Tools->Classpathadd your own class and click on Save classpath[/ol] I do this broad explanation because I saw this similar question asked again and again. This feature of using one's own class is not well documented (at least I couldn't find a hint :blink:). When one moderator read this, I recommend that we create a FAQ list with common problem solutions explained like this one. Regards,darya Link to comment Share on other sites More sharing options...
Echo Posted March 8, 2007 Share Posted March 8, 2007 A simpler approach would be to use the scriptlet functionality in iReport. First compile your class and put it into a .jar file. Add that .jar file to your classpath as you decsribed previously. Go to Report Properties under the edit menu and on the scriptlet tab tell it to use your scriptlet class. You can now use $P{REPORT_SCRITPLET}.yourownmethod() to reference any method in your class. For my reports, I have put all my methods into a single class in a .jar, made sure that iReport has a path to it and also made sure that jasper reports has a path to it as well. This way whenever I need to add a new method to my collection I simply update my .jar and I'm done. Link to comment Share on other sites More sharing options...
darya Posted March 9, 2007 Author Share Posted March 9, 2007 :pinch: Couldn't you post that earlier? Nice, now we have two ways for solving this problem :woohoo: . Regards,darya Link to comment Share on other sites More sharing options...
jmurray Posted March 10, 2007 Share Posted March 10, 2007 darya wrote::pinch: Couldn't you post that earlier?Regards,darya Get a grip on reality: most posters only visit occaisionally and even frequent posters have difficulty keeping track of what's going on because there's no email notification of changes to threads that you are involved in. It's really annoying for ppls trying to help out, so take a chill pill and be grateful for the excellent FREE assitance that has been provided to you Link to comment Share on other sites More sharing options...
darya Posted March 11, 2007 Author Share Posted March 11, 2007 Calm down. First of all I did help myself in this thread :) . Second, I was very nice to share my wisdom here, and this even for FREE ;) . Third, don't you think you should restrain yourself a little bit before insulting me :sick: ? I think the emoticons I used in my posts all speak for themselfs. If YOU feel upset send a private message to me but don't do it in public, if you want beware your social behavior. Link to comment Share on other sites More sharing options...
hprasanna84 Posted March 12, 2007 Share Posted March 12, 2007 hi all, i need to pass a set of formatting parameters at runtime to be applied to certain fields. for eg: say a param mask_ssn to mask the first 4 digits of ssn and other such formatting params. is there a way to accomplish this with ireport??? i've just started working on ireport and this is one particular requirement. 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