Ankur Gupta
-
Posts
343 -
Joined
-
Last visited
Community Answers
-
Ankur Gupta's post in Rows are staggered in Excel was marked as the answer
Hey,
The solution suggested by robsil would actually work upto the extent when all the data in a particular column in excel does not exceed the width alloted.
But in order to make your excel full proof and the flawless, I would suggest that you can follow these things.
1. Make sure that all the text fields in the detail band have the height same to each of them preferred in case of excel only output.
2. To apply the the word wrap functionality you will have to make following properties true found in the property pane.
- Stretch Type (found under appearance) for all the text feilds in the detail band should be made Relative to the tallest object, so that all the fields stretch according to max width column so that uniformity prevails.
- Check the box Stretch with overflow (found under the text field in properties) , this will ensure that all the data in the text field gets printed.
Hope that this helps!!
Thanks
Ankur Gupta
www.reportlingo.com
http://ankurthetechie.blogspot.in/
-
Ankur Gupta's post in Unable to run iReport on Mac Machine was marked as the answer
I found a resolve by testing out few things.
when I looked into this problem I found you need to give the superuser permission.
you can do this by going to the terminal and type
chmod -R 777 <installer file name>
Thanks
-
Ankur Gupta's post in help with parameters was marked as the answer
Hi Marius,
What I can understand out your question is that,
you need to cascade the parameters that means, that if you select the first parameter that is the country you see the respective cities of that country.
For this you can refer to an article I wrote - http://ankurthetechie.blogspot.in/2014/03/cascading-parameters-in-jasper-reports.html
Also you could refer a tutorial video -
Hope you find them useful,
Thanks
Ankur Gupta
http://ankurthetechie.blogspot.in/
-
Ankur Gupta's post in Empty table with javabean collection datasource ? (simple) was marked as the answer
Hi,
The other problem which I can see is here is that ,the beans you have created should be at last should be storred in a collection/Array which should be fetched via report.
In the case of collection/ Array of beans, it could be looped in the Detail band and that will produce correct results. So Refer to the above links I have posted there are code snippets too . Go through them that will help you get the concept.
Hope that this helps.
Thanks
Ankur Gupta
http://ankurthetechie.blogspot.in/
-
Ankur Gupta's post in Problem while converting to excle file from jasper was marked as the answer
Hi Joby ,
This is happening because, the excel export takes the white space in the report as a column, as you say that there is an requirement of Header also, that will contain columns which correspond to whitespaces.
It is adviced, that the reports exported in Excel should rather shred the header, and the text feilds placed in the detail section or anywhere for that matter should be continuous in nature
Hope that this helps
Thanks
Ankur Gupta
http://ankurthetechie.blogspot.in/
-
Ankur Gupta's post in .98 % to 0.98 % was marked as the answer
Hi ,
This could be done by including the expression like for the text field which contains the percentage :
I have assumed that the percentage coming from the datasource is of double type.
For the case When the Percentage coming from the Data source is already calculated percentages.
($F{percentage} - $F{percentage}.intValue() !=0 )
? new java.text.DecimalFormat("###.00 ").format($F{percentage}) + " %"
: new java.text.DecimalFormat("###0 ").format($F{percentage}) + " %"
For the case When the Percentage coming from the Data source is not calculated percentages and needs to be multiplied with 100 or calculated.
($F{percentage} - $F{percentage}.intValue() !=0 )
? new java.text.DecimalFormat("###.00 %").format($F{percentage})
: new java.text.DecimalFormat("###0 %").format($F{percentage})
Hope that this helps
Thanks
Ankur Gupta
http://ankurthetechie.blogspot.in/
-
Ankur Gupta's post in Create pdf with attachment in jasper iReport was marked as the answer
Hi,
Yes you can achieve using the drill down reports, or in other words could place hypertext links which would redirect to other reports along with some parameters from the parent report, or just could be a attachment as your requirement suggests.
But remember, if you design drill down reports in iReport then you need to test the drill down links in the jasperserver, because the links wont respond in the iReports.
Hope that this helps.
Thanks
Ankur Gupta
http://ankurthetechie.blogspot.in/
-
Ankur Gupta's post in issue in report grouping was marked as the answer
Hi,
In order to sucessfully group, you need to use ORDER BY with the same field by which you want to group your data in the SQL Query(or which ever query you are using)
This happens beacause if you do not order the records retrieved by the query according to the grouping field it will not order the data, and when iReport group expression encounters the records coming from the query it still finds the similar kind of ordering as found in the MANAGER_NAME and not DEPT_NAME .
So my advice is which ever field you want to group your data according to the records must ordered/sorted by the same field.
Hope that this helps
Thanks
Ankur Gupta
http://ankurthetechie.blogspot.in/
-
Ankur Gupta's post in How to implement a custom made Scriplet in iReport? was marked as the answer
Figured out the solution
we need to use the parameter $P{REPORT_SCRIPTLET} and the custom function of the jar which we want to use.
Thanks,
Ankur Gupta
-
Ankur Gupta's post in Dependent Variables in group footer was marked as the answer
Hi ildar,
You can simply put a field with the expression dept_COLUMN_A_SUM / dept_COLUMN_B_SUM * 100 in the group footer , and you would get the result.And yes do crosscheck the type of the textfield which contains the expression , it should be same as the type used for the variables.
I hope for the variables dept_COLUMN_A_SUM and dept_COLUMN_B_SUM you have set the reset types as the group concerned
Hope that it helps
Thanks,
Ankur Gupta
-
Ankur Gupta's post in How to add user defined function in iReport 4.7.1? was marked as the answer
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 is
1. 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 datasource
3. Then next you need to activate the the sample database from Help(in the iReport Menu bar )---->Samples---->Run Sample Database
4. Then Run the Report
Crosscheck each and every thing , but I think what you missed is setting the classpath in iReport.Refer to point 1
Hope that it helps.Find the attachments attached
Thanks,
Ankur
-
Ankur Gupta's post in Jasper Reports doesn't format number when running report from Java code was marked as the answer
Hi tural,
The formatting done in the iReport is report specific it like extra utility , of providing the pattern provided by the iReport. When you run that in java code the formatting is removed. So what you can do for the java code is that you could use:
new java.text.DecimalFormat("pattern").format(put the field here)
So to provide similarity in the report and in the Java code what can be done is that you could replace the expression of the text field with the same expression and the discrepancy could be easily taken care off.In that case the expression would look something like this
new java.text.DecimalFormat("¤ #,##0").format($F{VALUE})
Now here the in the field expression easily , any field or parameter could be put and same would work fine for java code too,
Hope that it solves your query
Thanks,
Ankur
-
Ankur Gupta's post in How to execute Jasper Report through Java? was marked as the answer
Hi all ,
I have found a solution to the query on my own, thanks augarte for the explanation regarding the implementation in java that helped,but the real problem was that retrieving the parameters from the jrxml .It is possible to do so.
I found a way for that by parsing the xml and then extracting the tags with parameter and retrieving the attribute name and class keeping in mind the check attribut isForPrompting is blank or not present for the parameters , In this way I got the Hashmap of all the parameters with their types and I put that in the parameterMap and hence fulfilling the parameters in the jrxml dynamically .Solves the purpose for me.
The jars need to be included are-
1.commons-beanutils-x.x.x.jar
2.commons-collections-x.x.x.jar
3.commons-digester-x.x.jar
4.commons-logging-x.x.jar
5.groovy-all-x.x.x.jar
6.iText-x.x.x.jar
7.jasperreports-x.x.x.jar
8.poi-x.x.jar(for excel export)
9.jfreechart-x.x.x.jar
Hope that this is helpful
Regards,
Ankur
-
Ankur Gupta's post in How to put Vertical line in the Detail section and Summary Section? was marked as the answer
Hello everyone,
I have figured out how to draw vertical line, basically what we can do set the borders for the fields and if only a vertial line is to be set then just turn on the border for that particular side.
Regards,
Ankur
-
Ankur Gupta's post in Getting NullPointerException at JRFiller.createFiller(JRFiller.java:133) was marked as the answer
Hi,
First of all please check whether the parameters you have defined have a default value .
Second please check whether the parameters to be added are in a correct sequence in order of occuring in the query .
Thirdly are you trying to generate the sql dynamically I mean that based upon a condition you are putting the string in the query with the usage of parameter it will be used like $P!{Parameter1}
Please check and let me know if it works
Regards,
Ankur
-
Ankur Gupta's post in Column Headers not visible when generating report in HTML Format was marked as the answer
Hi rohit,
Actually I have faced this issue in the spreadsheet case but it might work for you too,
what you can do is identify the faulty column header and then check whether it is overlapping the adjoining column headers or not, but if all is fine then you just try and delete that column header and then again you could put a static field and enter the header again , basically re do the header. That might work.
Thanks,
Ankur
-
Ankur Gupta's post in Calculations by group and by field content was marked as the answer
Hi tinao,
1. First thing you need to do is that in the SQL query you need to use ORDER BY clause upon Location,Yard.
2, Then you need to make two groups in the report named Location and yard and in each of the group expression would be same as the respective fields suppose $F{location} and $F{Yard}
3. Then you need to put the fields Location and Yard into the respective group header so that you get a demarcation of the same
4. then put all the fields required in the details section
5. Remove the Group footers or you could place the subtotals based upon location and yard of bus in the group footers.
6. You would need to have a variable which would be counting the total number of busses with the status In Service, if you need the count of the In service busses yard wise or you need it location wise or total busses in service then you need to set the reset type for the variable to the either of groups Yard/Location or you could set it to report as it suits you, hope you got the concept of reset type.
Thats it you are good to go
Hope that above explanation solves your query
Regards,
Ankur
-
Ankur Gupta's post in Using user-entered formulas at runtime was marked as the answer
Hi raffaele,
Yes it could be done, by specifying the various calculations inside jasper Report in form of conditions of the parameters for instance there would be three parameters 1st and 2nd will take two parameters and 3rd would take the operation to be made and then the evaluation could be performed in a variable expression and then that variable could be displayed in the report.
Hope that works
Thanks,
Ankur