How to print all records in database ?
Hello,
I am developing a small Database System. Which is used to store some information about student and then print that record, which I want to print. I have used JPanel for Printing single record. As like When I insert student id in TextBox. which is unique. then Click on Search button that is use for searching Record from database. After that the information shown in belowing JPanel. Then using one button for printing this record. It is printing only one record that I have searched. Now what is the problem, I want to print All record from database(can be 500 or 5000) without mentioning any student id in textbox.
Any type of help Appreciated.
Thanks in advance.
Manveer
Hello Manveer,
your problem is neither Swing-related or in any other way java specific.
If you manage to get the data of one student, excellent. Now modify your db-query in the way that the result set returns all students. Loop over the result set and print as usual.
Similar Messages
-
How to inlcude all records in a report, with a formula result of 0 or 0?
I'm reporting on classes scheduled for a certain location, and calculating the number of available seats per class. A formula will give me the net seats available (Max seats-count of students). BUT if there are no students enrolled, class does not appear on the report. Formula is {SCHEDULES.qy_sch_max} - Count ({WAITING_LISTS.no_emp}, {SCHEDULES.cd_crs)
What am I missing? Currently using Crystal 8.5 and reporting against a SQL database.
Appreciate your help.
christi
thanks, Sanjay - been there done that.
basically, I need to show the net result for the open seats available,which will be the same as the max seats offered.
I tried the following:
If Isnull{WAITING_LISTS.no_emp}
then {@Open}={SCHEDULES.qy_sch_max}
else
{SCHEDULES.qy_sch_max} - Count ({WAITING_LISTS.no_emp}, {SCHEDULES.cd_crs})
and got a message "Missing the then". (@Open is the formula title)
thanks, Sanjay - been there done that.
basically, I need to show the net result for the open seats available,which will be the same as the max seats offered.
I tried the following:
If Isnull{WAITING_LISTS.no_emp}
then {@Open}={SCHEDULES.qy_sch_max}
else
{SCHEDULES.qy_sch_max} - Count ({WAITING_LISTS.no_emp}, {SCHEDULES.cd_crs})
and got a message "Missing the then". (@Open is the formula title)
How to print all columns in one page
Hi,
Can anybody explain me how to print all columns in one page.we have around 15 to 20 columns for 4 reports and all these reports are build on one multiprovider.we are using BW 3.5.
Can anyone explain me how to print ALL COLUMNS IN ONE PAGE .currently they are getting all columns in 2 to 3 pages. They are using PORTAL to run the reports here.
Is it possible to do by customizing Webtemplate or by macros in Workbook.Please help me
Edited by: kotha123 on Oct 11, 2010 5:58 PM
Hi,
Your best bet is to use a workbook template or else Excel to pdf option...Thanks
How to print all values in record datatype?
Hello friends ,
I wrote one function which returned the departments record type.
when ever I called the function that returned departments record type and stored in department record type variable..I have to print all the values in record...
What can I do???
My code is like this...
set serveroutput on
declare
type depcur is ref cursor return departments%rowtype;
dep depcur;
rec departments%rowtype;
function ref_cur_demo(ref1 in depcur) return departments%rowtype
is
v_dep departments%rowtype;
begin
loop
fetch ref1 into v_dep;
exit when ref1%notfound;
end loop;
return v_dep;
end;
begin
open dep for select *from departments;
rec:=ref_cur_demo(dep);
--Here I have to print all the record variables;
end;
Hi Gopi,
You have to write the program in different way. In your case the function always returns only one value. You can see only one department detail as output.
To display a record type variable you need to use record type variable name .(dot) field name.
SQL> set serveroutput on
SQL> declare
2 type depcur is ref cursor return departments%rowtype;
3 dep depcur;
4 rec departments%rowtype;
5 function ref_cur_demo(ref1 in depcur) return departments%rowtype
6 is
7 v_dep departments%rowtype;
8 begin
9 loop
10 fetch ref1 into v_dep;
11 exit when ref1%notfound;
12 end loop;
13 return v_dep;
14 end;
15 begin
16 open dep for select *from departments;
17 rec:=ref_cur_demo(dep);
18 --Here I have to print all the record variables;
19 dbms_output.put_line(rec.department_id||' '|| rec.department_name||' '|| rec.manager_id||' '||rec.location_id);
20 end;
21 /
270 Payroll 1700
PL/SQL procedure successfully completed.
Here is the sample code which will demonstrates using ref cursors.
SQL> create or replace function get_dept_detail
2 return sys_refcursor
3 is
4
5 x_res sys_refcursor;
6
7 begin
8
9 open x_res for select * from departments;
10 return x_res;
11
12 end get_dept_detail;
13 /
Function created.
SQL>
SQL>
SQL> -- Execution
SQL>
SQL> declare
2
3 res sys_refcursor;
4 l_rec departments%rowtype;
5
6 begin
7
8 res := get_dept_detail;
9
10 loop
11 fetch res into l_rec;
12 exit when res%notfound;
13 dbms_output.put_line( l_rec.department_id||' '||l_rec.department_name);
14 end loop;
15
16 end;
17 /
10 Administration
20 Marketing
30 Purchasing
40 Human Resources
50 Shipping
60 IT
70 Public Relations
80 Sales
90 Executive
100 Finance
110 Accounting
120 Treasury
130 Corporate Tax
140 Control And Credit
150 Shareholder Services
160 Benefits
170 Manufacturing
180 Construction
190 Contracting
200 Operations
210 IT Support
220 NOC
230 IT Helpdesk
240 Government Sales
250 Retail Sales
260 Recruiting
270 Payroll
PL/SQL procedure successfully completed.
SQL>
SQL> -- In SQL*PLUS
SQL>
SQL> var res refcursor
SQL> execute :res := get_dept_detail;
PL/SQL procedure successfully completed.
SQL>
SQL> print res;
DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
10 Administration 200 1700
20 Marketing 201 1800
30 Purchasing 114 1700
40 Human Resources 203 2400
50 Shipping 121 1500
60 IT 103 1400
70 Public Relations 204 2700
80 Sales 145 2500
90 Executive 100 1700
100 Finance 108 1700
110 Accounting 205 1700
DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
120 Treasury 1700
130 Corporate Tax 1700
140 Control And Credit 1700
150 Shareholder Services 1700
160 Benefits 1700
170 Manufacturing 1700
180 Construction 1700
190 Contracting 1700
200 Operations 1700
210 IT Support 1700
220 NOC 1700
DEPARTMENT_ID DEPARTMENT_NAME MANAGER_ID LOCATION_ID
230 IT Helpdesk 1700
240 Government Sales 1700
250 Retail Sales 1700
260 Recruiting 1700
270 Payroll 1700
27 rows selected.
SQL>
Cheers,
Suri ;-)
Problem when printing the records of database
Hi all,
Although I can use the PrinterJob class to print the records of certain table in database directly to printer, it is difficult to deal with the different length of fields between different records so that, say, the first field of some records overlap with the second field when printing.
I find any layout/table method in java cannot be used in the PrinterJob class, only Graphics can be used. Does anyone know how to print the database in a good way?
thanks!
Perhaps java.text.MessageFormat is what you're looking for.
Note that in v1.4 there's also the new Java Print Service API (javax.print). (I haven't used it yet).
Greets
Puce
How to show all records by default on search result page?
Hi
I am trying to make a search page that would execute the search in the database based on one or more field constraints.
(Using MySQL,PHP)
I have 2 columns in the database "vm_ip" (primary key) <IP address>, "Operating_System" <Any, Windows, Solaris, AIX>
need to search vm_ip based on other two fields.
PROBLEM: Need to show all the record when I select "Any" in the Operating_System drop down menu.
<p>Operating System:
<select name="os_select" id="os_select">
<?php
$os_count=1;
foreach($os_type as $value) //(os_type is array with possible values of OS)
echo "<option value=".$os_count.">".$value."</option>";
$os_count++;
?>
<option value=" " selected="selected">Any</option>
</select>
</p>
this code POSts NULL value to the search page.
Below code is of recordset on search page
$varOS_virtual = "Operating_System"; // recordset variable set to same as column name (default value)
if (isset($_POST['os_select'])) //this should not be true
$varOS_virtual = $_POST['os_select'];
mysql_select_db($database_xyz_db, $xyz_db);
$query_virtual = sprintf("SELECT table.VM_IP FROM table
WHERE table.Operating_System=%s", GetSQLValueString($varOS_virtual, "int"));
$virtual = mysql_query($query_virtual, $xyz_db) or die(mysql_error());
$row_virtual = mysql_fetch_assoc($virtual);
$totalRows_virtual = mysql_num_rows($virtual);
I expected the 'os_select' field to be null and default value of Operating_System to be "Operating_System" so that the Query shows all records.
But instead the value being passed in the Query is "0". and no records are shown.
What can I do to show all records?
As probably obvious I am new to php/MySQL so all the help is most welcomed .
Thanks
Hi
Thanks for the prompt reply but this does not solve my problem.
First thing I appologise for giving you incorrect info. Actually I have many more constraints on the search apart from OS.
Didn't think I would get single constraint specific ans.
Here is what all i tried and problems I faced:
1. I cannot use seperate queries cause I have around 7-8 other constraints on the search.
2. I cannot play around with the Record set code. For some reason even if I mess with it a little bit Dreamweaver stops recognising the recordset. for eg i tried the below code:
$query_virtual = sprintf("SELECT table.VM_IP FROM table WHERE
table.Operating_System=%s ,($_POST['os_select']=="")? TRUE:GetSQLValueString($varOS_virtual, "int"));
this ran well for the first time, and then the record set was screwed up. kept on asking me to "Discover" the links, which it couldn't do.
3. take a look at this code:
$varOS_virtual = "Operating_System";
if (isset($_POST['os_select'])) {
$varOS_virtual = $_POST['os_select'];
$varState_virtual = "State"; //second constraint
if (isset($_POST['state_select'])) {
$varState_virtual = $_POST['state_select'];
mysql_select_db($database_xyz, $xyz);
$query_virtual = sprintf("SELECT table.VM_IP FROM table AND table.Operating_System=%s AND State=%s",
GetSQLValueString($varOS_virtual, "int"),GetSQLValueString($varState_virtual, "int"));
$virtual = mysql_query($query_virtual, $xyz) or die(mysql_error());
$row_virtual = mysql_fetch_assoc($virtual);
$totalRows_virtual = mysql_num_rows($virtual);
here on passing NULL value for "Any" GetSQLValueString($varOS_virtual, "int") functions returns NULL and though the Default value of
varOS is set to 'Operating_System" query takes NULL value only which when executed shows no records.
My problem majorly revolves around how to put something like "WHERE Operating_System= Operating_System" OR "WHERE Operating_System= TRUE" in the query, when passed through variable they are sent as Strings or NULL.
Thats why WHERE 1=1 also doesnt work, because it has "WHERE Operating_System= NULL" in AND.
Logically when NULL is passed default value of variable should comeinto picture, but tha isnt happening.
Thanks again for answering. hope I was able to explain my problem.
How to print all the pages in wad
HI i am having a report with 3000 records when opened in wad, but when we print the Report, it is giving us records(60) on only first page, how do we print all the 3000 records from all the pages by clciking on print only once.
Thank You,
Kris.
i am not able to print any pages after inserting the code, am i placing the code in the right place.
<HTML>
<!-- BW data source object tags -->
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="SET_DATA_PROVIDER"/>
<param name="NAME" value="DATAPROVIDER_2"/>
<param name="DATA_PROVIDER_ID" value=""/>
DATA_PROVIDER: DATAPROVIDER_2
</object>
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="SET_DATA_PROVIDER"/>
<param name="NAME" value="DATAPROVIDER_1"/>
<param name="QUERY" value="ZPARAMTEST"/>
<param name="INFOCUBE" value="ZEMPPRM"/>
DATA_PROVIDER: DATAPROVIDER_1
</object>
<object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="SET_PROPERTIES"/>
<param name="TEMPLATE_ID" value="ZEMPPARM"/>
TEMPLATE PROPERTIES
</object>
<td>
<table class="SAPBEXBtnStdBorder" cellspacing="0" cellpadding="0" border="0"><tr><td nowrap>
<table border="0" cellpadding="0" cellspacing="1"><tr><td nowrap class="SAPBEXBtnStdIe4">
<A class=SAPBEXBtnStd title="Print via Web Button" href="<SAP_BW_URL cmd="PROCESS_HELP_WINDOW" help_service="ZPRINTING" item="GR1Table">" target=_blank><nobr> Print</nobr> </A>
</td></tr></table>
</td></tr></table>
</td>
<td width="100%"> </td>
</tr></table>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">
<TITLE>BW Web Application</TITLE>
<link href="/sap/bw/Mime/BEx/StyleSheets/BWReports.css" type="text/css" rel="stylesheet"/>
</HEAD>
<BODY>
<P><object>
<param name="OWNER" value="SAP_BW"/>
<param name="CMD" value="GET_ITEM"/>
<param name="NAME" value="EMPLOYEE_TABLE"/>
<param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_GRID"/>
<param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>
<param name="BLOCK_SIZE" value="5"/>
ITEM: EMPLOYEE_TABLE
</object></P>
</BODY>
</HTML>
How to delete a record in database it should be effect in XML
In my application wheni insert a record in database it automatically inserted in XML now my problem is when i delete a record in database it should also effect in XML
plz anybody anything knows about this reply me
First up all, when u insert a record in database, how the data is inserted in xml file. Is there any application written for that?
So when u delete the record from database,and want that same data should be deleted from the xml file, write a application to delete data from xml, and call that when u delete record from database.
U can Write application using DocumentBuilderFactory.
And using XQuery, you can delete data from xml.
Hope this will help u.
.....yogesh
Print all records in detail view
How do you save all records in a detail view to a PDF file?
Hello Manveer,
your problem is neither Swing-related or in any other way java specific.
If you manage to get the data of one student, excellent. Now modify your db-query in the way that the result set returns all students. Loop over the result set and print as usual.
HOW TO PRINT ONE RECORD PER ONE PAGE
Hi I have report , with two queries. Each query has one group with the same data. lets say the queries are Q1 and Q2. The Groups are with column DeptNo, and DeptNo1 both pointing to the same column DEPTNO. Now I want to design it in such a manner that it shoudl print each group , one record per page, but same group on the same page. For Example
ON PAGE 1
DpetNo 10
Emp1
Emp2
Emp3
DeptNo1 10
Emp1
EMp2
Emp3
ON PAGE 2
DeptNo 20
Emp4
Emp5
DeptNo1 20
Emp4
Emp5
ON PAGE 3
DeptNo 30
Emp6
Emp7
Emp8
DeptNo1 30
Emp6
Emp7
Emp8
How the lay our will be ? What will be the conditions. I can set the property in each group to print one record per page. But how to make it so that it will print like above.
Thanks
FEROZ
Hi Feroz,
You can create a query Q0 to return DeptNo 10, DeptNo 20..... and make it as the parent of Q1 and Q2. Then you can print one dept per page.
Regards,
George
How to print blank records after the detail records in a masterdetail report
Hi,
Developing a report for time and attendance record. In this report I am printing all the employees in a department, limiting the no. of records per page to 10.
I need to insert blank lines at the end of all of the detail records in a page that has less than 10 employee records so that the no. of records displayed on a page can always be 10(these blank lines will facilitate the management to note down the temporary employees who worked for the department but are not part of the department).
I am using a tabular form with group above layout.
The report layout is as follows:
Department : FINANCE & ADMINISTRATION
Employee Name | Employee Number |
1 Jim | 1234 | _________________
2 John | 5678 |__________________
3 blank
4 blank
5
6
7
8
9
10 balnk
Supervisor's Sign:______________________
Note: the no. of blank lines should be inserted dynamically based on the no. of emp. records being printed on the page.
Any help is greatly appreciated.
Thanks in advance.
Kavita.
Your solution works when I am not limiting the no. of records per page for a department to 10 records and when I want to print blanks lines for the depts that has fewer than 10 employees in it.
Exactly in my report I have several dept's that has more than 10 emp's. In such cases I'll be printing first 10 in one page and the rest in the next page. Now I want to dynamically print the blank lines in the second page depending on the no. of emp's on that page. I tried to acheive this by using a CS column that reset's at page level but, REPORTS is not letting me use CS column that reset's at page level in a format trigger. I also tried to copy the CS value into a parameter and or to a Place holder column and did not help.
Any more work around ideas to acheive this?? please help.
Thanks alot
Kavita.
Hi
Create a column called Serial_No in ur emloyee query like this
select 1 , empno ,ename from emp;
Create a summary column on the serial column with the function SUM
and resetting it to Page
Display the column in the report by using the text color as white
so it doesn't display in the report
I think this should help u i believe
Sri
Hi,
Developing a report for time and attendance record. In this report I am printing all the employees in a department, limiting the no. of records per page to 10.
I need to insert blank lines at the end of all of the detail records in a page that has less than 10 employee records so that the no. of records displayed on a page can always be 10(these blank lines will facilitate the management to note down the temporary employees who worked for the department but are not part of the department).
I am using a tabular form with group above layout.
The report layout is as follows:
Department : FINANCE & ADMINISTRATION
Employee Name | Employee Number |
1 Jim | 1234 | _________________
2 John | 5678 |__________________
3 blank
4 blank
5
6
7
8
9
10 balnk
Supervisor's Sign:______________________
Note: the no. of blank lines should be inserted dynamically based on the no. of emp. records being printed on the page.
Any help is greatly appreciated.
Thanks in advance.
Kavita.
How to print all information in the contacts
does anyone know how to print a concise list of everything in your contacts ?
Hello emerykt
You should be able to print a list of contacts and then all you have to do is select the fields that you want to print.
Contacts (Mavericks): Print contact information
http://support.apple.com/kb/ht1766
Regards,
-Norm G.
How to print all data in a table?
Hello!
I am doing report with VC. Now I want to print data ,The system action "print" can not print all data,only a page in the table can be printed. Are there any ways to finishe the print function,Can you help me?
Thank you very much!
See this how to guide I put together:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/47fe4fef-0d01-0010-6f87-ed8ecb479123
How to print all columns using af:showPrintablePageBehaviour component ?
Hi,
JDev ver : 11.1.1.2.0
I have 25 columns in my table and table is surrounded by panel collection.
In panel collection toolbar facet I have added one command button and inside command button I have added af:showPrintablePageBehaviour compoent.
I can able to see only 15 columns which are fits to entire browser window.
How can I print all 21 columns using this in new browser window or any other way ?
regards,
devang
Hi,
showPrintable behavior only removes action components and beside of this renders the screen as you have it. If the screen you have doesn't show all of the columns then show printable behavior doesn't do either and you may need to look for alternative printing/reporting solutions
Frank
How to SELECT ALL records of a TABLE VIEW in the BSP page
Hi All,
In the BSP portal, I am displaying some data(multple records) in the form of a table using the BSP TAG <htmlb:tableView>. I wrote the logic in the 'VIEW' of the BSP application which will be triggered by the controller. I have used the attribute selectionMode = "MULTISELECT" to have a Check Box to select a row.
My requirement is to have a button/checkbox on the first column of the header of the table view. By clicking on this, it should select/desect all the records of the table. Could someone please help me how to do this? What attribute I should use in the tableview to get the button in the header row of the table and how to select all the records of the table.?
Please provide your valuable inputs.
Thanks & Regards,
Paddu.
Select all / Deselect all functionality when onRowSelection is there
Maybe you are looking for
-
No sound in imported photobooth videos into imovie
Very frustrated, as I need to edit my photobooth videos in imovie. I can import them with no problems, but for some reason there is no sound in the videos when I import them into imovie - although there is sound when I use a diferent video converter
-
Has anyone figured out a way to export a chart as a .jpg? I tried to export as a PDF and then save the PDF as a jpg but I can't get the background cell lines not to show - so those end up getting in the way.
-
Plumtree and Weblogic Portal Server | URL rewriting incompatibility
Hi All, I am using Weblogic Portal as the Producer and Plumtree as the consumer for my WSRP portlets. I have enabled Producer URL rewriting. When i invoke an action URL i get a "Mode is not supported in this portlet." error. The template being passed
-
The object array comes under which class
hi there, can anybody tell me an array is defined in which class . for ex: when we give int a[ ]=new int[ ] wen "new "is used an object of array is created. and i studied somewhere that array is an object. then wen an array is an object it must b def
-
Java application mysteriously disappears
Hi! We have a Java application deployed on an EP7.0. It shows up normally as a tab called "upload interface". However, frequently after several weeks, it will disappear UNLESS we re-start the EP7. Could anybody explain why and how to fix it for good?