Rajubhai Kotwal

Ranch Hand
+ Follow
since Nov 03, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Rajubhai Kotwal

Experts,

I am working on JSP-servlet to create a page which contains couple of editable drop-down list, text fields etc. I am using mysql at back end. I want to access the database in a such a way that I would be able to compare the database with what user has entered. If it matches, whatever user has entered will go in a flat file say txt file and if it is not present in database, error message will be displayed. At the moment I was able to create the UI part. But I am stuck at Submit button. I mean what condition should I write at click event to compare with database. Result sets is what i can see. Any suggestion guys? Any tutorials available about this? Thank you very much.

Best.
14 years ago
JSP
Experts, I am trying to work on report which contains main report and sub reports. In main report's header i want to pass sub report to print the header and in sub report i want to display data. I am using JRBeanCollectionDataSource. I have created a bean class where in I am setting/getting methods. In my main class I am exporting the beans to jasper file. My problem resides in passing collections of multiple beans. How should I pass multiple beans to jasper files?


Now my problem is how to pass Object of here? Instead of passing list through JRBeanCollectionDataSource jbs = new JRBeanCollectionDataSource(list); i would like to pass Object of list so that i can send multiple beans. I can pass collection through public JRBeanCollectionDataSource(java.util.Collection beanCollection) but not the objects. Does anyone know how should i pass objects? I am stuck in this problem as i am confused here while passing datasource. I can pass only one datasource to jasper report. Please do let me know your ideas and suggestions. Thank you.
Hello experts,

This is pretty older post but I hope, I would find a solution to my problem. I have been generating reports using java and ireport. I used to have only one subreport earlier and didn't face any problem while generating those reports. Now, I have to add another subreport and merge it with the main report. In short one main report along with 2 subreports. Right now, in my main report and subreport1, i am passing one parameter (same for both master and slave i.e. $P{recordId}). Subreport1 contains data based on the JDBC connection whilst 2nd one empty data source.subreport2(i want to display 3 columns of data called formula, status, result) . I am using empty datasource for the subreport3. Now, my question is, "can we pass objects to the reports from subreports?" I might have different values to display in the report via my java program. It would not be feasible to use multiple parameters for same columns/data. I would like to know, can we pass objects via any mechanism? Can we store any mechanism which can store objects those eventually consist of different parameters? I searched on the forum and found JRBeanCollectionDataSource. How should I use it in the program? It would be great if I know the steps to include this bean in java or in ireport. Will it be useful for me? Is it the right direction to get for what I am looking for? Please suggest your ideas. Thank you in advance.
@Paul

Thank you for responding to the topic. I am generating a report of the records using ireport. It is not possible to use multiple select queries in ireport. Therefore, I need to use java in order to execute those queries. I am trying to get the counts of the tables initially and later I wish to crosscheck them while exporting data to the destined table. For e.g if i delete some records from a table. Then those counts should explain that how many record counts were deleted. In order to execute those queries, i need to store them in a set. Here I am little confused; how to do that? Thank you.
Experts,

I have been working on jasper report. I am trying to execute the report within a java file. In order to do this, I need to execute sql statement within java. I wish to know how we can store multiple sql statements and execute them later? I have 3 statements to be executed. "select COUNT(*) from employee", "select COUNT(*) from employer" and "select COUNT(*) from company" How should I amend my code in order to execute all 3 queries? How should I map the stored data? Please suggest/help. Following is my code. Thank you.
Experts,

I am looking to calculate difference between two dates including milliseconds. I have gone through JODA API. I have a report as an output in ireport. I am executing it witihn a java now. I want to display difference between two dates including milliseconds. Initially, I changed the query to "TIME_FORMAT(TIMEDIFF(process1.end_datetime, process1.start_datetime),'%H:%i:%S%f') as exec_time". Later I tried to import joda-time-1.6.1.jar in the ireport itself. It didn't work. In a simple date difference program, how could I achieve this? Once I find the way to calculate difference including milliseconds, I would import same technique in the report later. Has anyone worked on this earlier? I would appreciate your suggestions/ideas. Thank you in advance. Following is my current output. On the RunTime i want to include milliseconds as well.

ID StepName StartTime EndTime RunTime Status
3 Process1 2010-08-09 02:08:00 AM 2010-08-09 02:08:01 AM 00:00:01 Success
4 Process2 2010-08-09 02:08:01 AM 2010-08-09 02:15:00 AM 00:06:59 Success


Best regards.
got the solution by passing HashMap and connection through the method.
Topic seized.
14 years ago
Hi all,

I have been working japer reports within java. I have developed a report using jdbc in ireport. Now, I want to execute this report within my java programme. I am exporting this report in a .pdf file using,
JasperPrint print = JasperFillManager.fillReport(jasperFileName, map, conn);

Now, here is a little trouble. I have already generated report in ireport including headers like Report generated by (name_from_database_at_the_runtime) process, (STEP_NAME_AT_RUN_TIME) step Profiled (TOTAL_COUNT_AT_RUN_TIME)records in (TABLE_NAME_AT_RUN_TIME) table. This is the header with some dynamic data present in parantheses at the run time. Therefore, I am writing a method to extract only data from the report and export it another method where I am prinitng header of the report. I need to write the query in order to getData() from the database. I would like to know when there are multiple row how should I use the hashmap with respect to connection? How should I map it? I would appreaciate your suggestions and ideas.

code of the method for writing data.


code for the getting data from the record.
14 years ago
yup...you must be right. I misunderstood the question.I thought requirement is to automatically update pdf file without any upgradation later once generated. Also I thought it' going to be executed within java as there was highlight on oo concept. That's why I thought in this direction.

Best regards.
I am not too sure about exact solution. But if you do not wish to update .pdf file each time and want to print ther report with path stored on server then use of peer to peer approach could be the solution for your problem . Just like RSS on news' website. This might be the idea. i am not too sure about it.
You might need to include following jar files in your classpath.
jasperreports-3.0.0.jar or whichever version you wish to include,
commons-beanutils-1.8.0jar or whichever verion you wish to include ,
commons-collections-3.2.jar or whichever verion you wish to include
commons-digester-1.8.jar or whichever verion you wish to include
commons-logging-1.1.1.jar. or whichever verion you wish to include

Just google about it if you want different version.
You might need to include following jar files in your classpath.
jasperreports-3.0.0.jar or whichever version you wish to include,
commons-beanutils-1.8.0jar or whichever verion you wish to include ,
commons-collections-3.2.jar or whichever verion you wish to include
commons-digester-1.8.jar or whichever verion you wish to include
commons-logging-1.1.1.jar. or whichever verion you wish to include

Just google about it if you want different version. Also if you are using any building tools like ant or maven, you would need to include dependencies in your pom.xml. Following is for the maven. This is just for an example. You might need to amend as per your requirements.

<dependency>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.5.3</version>
</dependency>

Best regards.