mondhe.mayur Posted June 5, 2013 Share Posted June 5, 2013 Hii there..I have made a jar file named ConvertToWord.jarThis jar file contains pkg1 package. Inside that package a class named ConvertToWord exists. This class has a function named fun2 which takes argument in double and converts it into character.For example for input 7500.00 it will give output as seven thousand five hundred. Now I want to add this function to my report and want to convert a summation generated by report into characters.this class file extends JRDefaultScriptlet.For that I have added this jar file into a class path from netbeans IDE7.2.1 > Tools > Option > iReport > Classpath > Add JarAfter that in report inspector window I opend Scriptlets node which is having default scriptlet as REPORT. In its property Scriplet class I changed to COnvertToWord.pkg1.ConvertToWordNow in summary part of my report I added a text field and selected its Edit Expression option.In that I edited this -------> $P{REPORT_SCRIPTLET}.fun2($V{Total})Here $V{Total} is total of a column.when I click on preview it doen't even run...can any one here help me for this...I have attached ConvertToWord.jarA line of reply will be highly appriciated. Link to comment Share on other sites More sharing options...
Ankur Gupta Posted June 5, 2013 Share Posted June 5, 2013 Hi mondhe,The problem which I see here is with the scriptlet class you changed.After that in report inspector window I opend Scriptlets node which is having default scriptlet as REPORT. In its property Scriplet class I changed to COnvertToWord.pkg1.ConvertToWord Here the scriptlet class would simply be pkg1.ConvertToWord as the jar file is already present in the classpath so you need not mention the name of the jar. Change this class definition and it would work fine.If this answers your query please don't forget to mark the answer as correct. Cheers,Ankur Link to comment Share on other sites More sharing options...
Solution Ankur Gupta Posted June 5, 2013 Solution Share Posted June 5, 2013 Hi mondhe,For me the above thing works, I am attaching a working copy of the file : In this I have used the scriptlet class of yours , in the details section using one of the fields, and then I have used the same class coverting a variable which contains the sum of feilds over the report , and as it is working could be used anywhere.In order to get the JRXML attached working what you will need to do is1. Import the jar Tools(in the iReport Menu bar )-----> Options ----- > Click on Claspath Tab ------> ADD Jar -----> choose the JAr file (I Think You missed this step You need to import the JAR file through iReport through the above described process, no need of using netbeans for classpath setting use iReport only)2. Then you must choose Sample Database in the datasource3. Then next you need to activate the the sample database from Help(in the iReport Menu bar )---->Samples---->Run Sample Database4. Then Run the Report Crosscheck each and every thing , but I think what you missed is setting the classpath in iReport.Refer to point 1Hope that it helps.Find the attachments attachedThanks,Ankur Link to comment Share on other sites More sharing options...
NikunjB Posted July 23, 2014 Share Posted July 23, 2014 Hi Ankur! Can we display alert message using scriptlet in ireport? I want to display standard alert message in between report execution in jasperserver. is it possible using scriptlet or any other way? A line of reply will be highly appriciated. 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