Help with joining tables
hello can some one help me in joining the tables
po_vendors of AP and gl_je_headers or gl_he_headers of GL
thankyou
How about this:
Build first an auxiliary table (you can truncate it every time) and in it:
create table auxtab as
select distinct employeeid, row_date from table1
union
select distinct employeeid, row_date from table2
union
select distinct employeeid, row_date from table3
union
Then you can use this "auxiliar" table as the driving one for outer joins
select * from auxtab left outer join table1 on ()
left outer join table2 on ()
left outer join table3 on ()
etc..
Similar Messages
-
Please I need some help with a table
Hi All
I need some help with a table.
My table needs to hold prices that the user can update.
Also has a total of the column.
my question is if the user adds in a new price how can i pick up the value they have just entered and then add it to the total which will be the last row in the table?
I have a loop that gets all the values of the column, so I can get the total but it is when the user adds in a new value that I need some help with.
I have tried using but as I need to set the toal with something like total
totalTable.setValueAt(total, totalTable.getRowCount()-1,1); I end up with an infinite loop.
Can any one please advise on some way I can get this to work ?
Thanks for reading
CraigHi there camickr
thanks for the help the other day
this is my full code....
package printing;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.swing.*;
import javax.swing.table.*;
import java.text.DecimalFormat;
public class tablePanel
extends JDialog implements Printable {
BorderLayout borderLayout1 = new BorderLayout();
private boolean printing = false;
private Dialog1 dialog;
JPanel jPanel = new JPanel();
JTable table;
JScrollPane scrollPane1 = new JScrollPane();
DefaultTableModel model;
private String[] columnNames = {
private Object[][] data;
private String selectTotal;
private double total;
public tablePanel(Dialog1 dp) {
dp = dialog;
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
public tablePanel() {
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
private void jbInit() throws Exception {
jPanel.setLayout(borderLayout1);
scrollPane1.setBounds(new Rectangle(260, 168, 0, 0));
this.add(jPanel);
jPanel.add(scrollPane1, java.awt.BorderLayout.CENTER);
scrollPane1.getViewport().add(table);
jPanel.setOpaque(true);
newTable();
addToModel();
addRows();
setTotal();
public static void main(String[] args) {
tablePanel tablePanel = new tablePanel();
tablePanel.pack();
tablePanel.setVisible(true);
public void setTotal() {
total = 0;
int i = table.getRowCount();
for (i = 0; i < table.getRowCount(); i++) {
String name = (String) table.getValueAt(i, 1);
if (!"".equals(name)) {
if (i != table.getRowCount() - 1) {
double dt = Double.parseDouble(name);
total = total + dt;
String str = Double.toString(total);
table.setValueAt(str, table.getRowCount() - 1, 1);
super.repaint();
public void newTable() {
model = new DefaultTableModel(data, columnNames) {
table = new JTable() {
public Component prepareRenderer(TableCellRenderer renderer,
int row, int col) {
Component c = super.prepareRenderer(renderer, row, col);
if (printing) {
c.setBackground(getBackground());
else {
if (row % 2 == 1 && !isCellSelected(row, col)) {
c.setBackground(getBackground());
else {
c.setBackground(new Color(227, 239, 250));
if (isCellSelected(row, col)) {
c.setBackground(new Color(190, 220, 250));
return c;
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (e.getClickCount() == 1) {
if (table.getSelectedColumn() == 1) {
table.setTableHeader(null);
table.setModel(model);
scrollPane1.getViewport().add(table);
table.getColumnModel().getColumn(1).setCellRenderer(new TableRenderDollar());
public void addToModel() {
Object[] data = {
"Price", "5800"};
model.addRow(data);
public void addRows() {
int rows = 20;
for (int i = 0; i < rows; i++) {
Object[] data = {
model.addRow(data);
public void printOut() {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(tablePanel.this);
pj.printDialog();
try {
pj.print();
catch (Exception PrintException) {}
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
int fontHeight = g2.getFontMetrics().getHeight();
int fontDesent = g2.getFontMetrics().getDescent();
//leave room for page number
double pageHeight = pageFormat.getImageableHeight() - fontHeight;
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
double scale = 1;
if (tableWidth >= pageWidth) {
scale = pageWidth / tableWidth;
double headerHeightOnPage = 16.0;
//double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
//System.out.println("this is the hedder heigth " + headerHeightOnPage);
double tableWidthOnPage = tableWidth * scale;
double oneRowHeight = (table.getRowHeight() + table.getRowMargin()) * scale;
int numRowsOnAPage = (int) ( (pageHeight - headerHeightOnPage) / oneRowHeight);
double pageHeightForTable = oneRowHeight *numRowsOnAPage;
int totalNumPages = (int) Math.ceil( ( (double) table.getRowCount()) / numRowsOnAPage);
if (pageIndex >= totalNumPages) {
return NO_SUCH_PAGE;
g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
//bottom center
g2.drawString("Page: " + (pageIndex + 1 + " of " + totalNumPages), (int) pageWidth / 2 - 35, (int) (pageHeight + fontHeight - fontDesent));
g2.translate(0f, headerHeightOnPage);
g2.translate(0f, -pageIndex * pageHeightForTable);
//If this piece of the table is smaller
//than the size available,
//clip to the appropriate bounds.
if (pageIndex + 1 == totalNumPages) {
int lastRowPrinted =
numRowsOnAPage * pageIndex;
int numRowsLeft =
table.getRowCount()
- lastRowPrinted;
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(oneRowHeight *
numRowsLeft));
//else clip to the entire area available.
else {
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(pageHeightForTable));
g2.scale(scale, scale);
printing = true;
try {
table.paint(g2);
finally {
printing = false;
//tableView.paint(g2);
g2.scale(1 / scale, 1 / scale);
g2.translate(0f, pageIndex * pageHeightForTable);
g2.translate(0f, -headerHeightOnPage);
g2.setClip(0, 0,
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(headerHeightOnPage));
g2.scale(scale, scale);
//table.getTableHeader().paint(g2);
//paint header at top
return Printable.PAGE_EXISTS;
class TableRenderDollar extends DefaultTableCellRenderer{
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean isFocused,
int row, int column) {
setHorizontalAlignment(SwingConstants.RIGHT);
Component component = super.getTableCellRendererComponent(
table,
value,
isSelected,
isFocused,
row,
column);
if( value == null || value .equals("")){
( (JLabel) component).setText("");
}else{
double number = 0.0;
number = new Double(value.toString()).doubleValue();
DecimalFormat df = new DecimalFormat(",##0.00");
( (JLabel) component).setText(df.format(number));
return component;
} -
F4 Help with text table in WD abap
Hi,
i am using country related input help with check table T005 in one of table and i want to display the country text along with country id in my table, f4 for country is coming however if i select country from f4 it showing country id in the input field of table.
i want to have country text also in one of my input fields in the table, i have seen f4 help works if we have explicit search help and using parameter assignment we can have id and text defaulted if we use same context for id and text fields, however in this case country table t005 has check table t005 where texts are stored in text table t005t so web dynpro abap is't picking up the texts??
please suggest how can i get the texts as soon as i select country in the f4??Hi Kranthi,
You merely have to have an internal table storing list of countries, which you only need to do once, e.g. on load of application (method WDDOINIT of COMPONENTCONTROLLER). In your view, you have to declare a method for event onEnter of the input field, but this method doesn't have to have any code. Your code will be in method WDDOBEFOREACTION, where you read get country name from country key. Once you've got country name, transfer value to a context attribute to which you've already mapped as a source for attribute value of the UI element.
Check out SAP Webdynpro component FITV_IMG_DEFHTLCATA -> view V_ITEM. -
Hello All,
I need some help with custom tables. I have created a custom table to maintain names and I also did table maintenance generation so that the user can maintain names in this table using SM30 transaction.
The question is, in my program on the selection screen when the user press F4 I need to display the values maintained in this custom table...
Can anyone help me with this.
Thanks
PavanIf I understood you correctly, you have a program in which one or some of the selection screen fields refer to a custom database table field(s).
You want to implement a F4 functionality.
Fill an internal table with the values you want to show.
Call the function module 'F4IF_INT_TABLE_VALUE_REQUEST' in the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR MYPARAM as follows.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = MYITAB-FIELD
dynprofield = MYSELSCREENPARAM
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = my_f4_itab.
Srinivas -
Help with Joining a few tables
I need a help using JOINS. I plan to create ONE VIEW by bringing in all fields from First and Second table and a few chosen columns from Third, Fourth and Fifth tables. I have put to together below select statement which appears to be working syntax-wise but not efficient and may have dupes.
Table1 - RPT_APRL_PRODUCT with key field KEY_MATERIAL (KEY_MATERIAL = DIVISION||PLAN_CTRY||MKT_TYP_ID||MATERIAL)
Table 2 - RPT_FWEQ_PRODUCT with key field KEY_MATERIAL (KEY_MATERIAL = DIVISION||PLAN_CTRY||MATERIAL)
Table 3 - NSC_PROD_CIMG has a Key Field = MATERIAL_NBR
Table 4- STAGE#EMEA_NSAP.NSC_PROD_REG_CIMG has the Key field MATERIAL_NBR, REG_ID
Table 5 - STAGE#EMEA_NSAP.NSC_PROD_REG_CYC_CIMG has Key Fields MATERIAL_NBR, REG_ID, CYC_ID and ORGVERSIONID
Columns needed from Table 3 -- B.DIVISION, B.DIVISIONNAME, B.SUBLABEL, B.SUBLABELNAME and B.DEVELOPMENTREGION.
Columns needed from Table 4 --- C.GLOBALSOURCEINDICATOR
Columns needed from Table 5--- D.CARRYOVERFLAG
SELECT statement:
SELECT /*+ parallel (a,5) parallel (NET,5) */
a.key_material,
a.mkt_typ_id,
a.region_id,
CASE
WHEN a.region_id = '3' THEN 'USA'
WHEN a.region_id = '4' THEN 'EMEA'
WHEN a.region_id = '7' THEN 'CANADA'
END AS region_desc,
a.mkt_reg_cd,
CASE
WHEN a.mkt_reg_cd = '01' THEN 'USA'
WHEN a.mkt_reg_cd = '02' THEN 'EMEA'
WHEN a.mkt_reg_cd = '05' THEN 'AMER'
END AS mkt_reg_desc,
a.cat_bus_cd1,
a.cat_bus_desc1,
a.cat_bus_cd2,
a.cat_bus_desc2,
a.cat_bus_cd3,
a.cat_bus_desc3,
a.cat_bus_cd4,
a.cat_bus_desc4,
a.mkstr_cd,
a.mkt_clsfn_desc,
a.mkt_clsfn_cd1,
a.mkt_clsfn1_desc,
a.mkt_clsfn_cd2,
a.mkt_clsfn2_desc,
a.mkt_clsfn_cd3,
a.mkt_clsfn3_desc,
a.exp_sty_ind,
a.silh_cd,
a.silh_desc,
a.whlsl_prc,
0,
NULL,
NULL,
NULL,
NULL,
NULL,
a.gender_age_class_id,
a.gender_age_desc,
a.sports_activity_class_id,
a.sports_act_cls_desc,
a.gblcatsummcode,
a.gblcatsummdesc,
a.gblcatcorefocuscode,
a.gblcatcorefocusdesc,
a.segment,
a.segmentname,
a.l4l_fl,
NET.DIVISION,
NET.DIVISIONNAME,
NET.SUBLABEL,
NET.SUBLABELNAME,
NET.DEVELOPMENTREGION,
NULL,
NULL,
NULL,
NET.globalsourceindicator,
NET.CARRYOVERFLAG,
a.zz_chng_tmst,
a.zz_update_tmst,
a.zz_insert_tmst
FROM RPT_APRL_PRODUCT A,
(SELECT
APRL.DIVISION||APRL.PLAN_CTRY||APRL.MKT_TYP_ID||APRL.MATERIAL ; AS KEY_MATERIAL,
B.DIVISION,
B.DIVISIONNAME,
B.SUBLABEL,
B.SUBLABELNAME,
B.DEVELOPMENTREGION,
C.GLOBALSOURCEINDICATOR,
D.CARRYOVERFLAG
from RPT_APRL_PRODUCTAPRL,
NSC_PROD_CIMG B,
NSC_PROD_REG_CIMG C,
NSC_PROD_REG_CYC_CIMG D
where APRL.MATERIAL = B.MATERIAL_NBR AND
APRL.MATERIAL = C.MATERIAL_NBR AND
APRL.MATERIAL = D.MATERIAL_NBR AND
C.REG_ID = D.REG_ID) NET
WHERE A.KEY_MATERIAL = NET.KEY_MATERIAL(+)
Thanks for help in advance.I have 4 tables and these are some sample data for
RPT_APRL_PRODUCT - Key Field = KEY_MATERIAL (this is a combination of plan_ctry,division,mkt_typ_id and material)
Sample data
KEY_MATERIAL PLAN_CTRY DIVISION MKT_TYP_ID MATERIAL
10PART1136353-010 PART 10 1 136353-010
10AMER1136353-010 AMER 10 1 136353-010
10USA1136353-010 USA 10 1 136353-010
10CANA1136353-010 CANA 10 1 136353-010
10PART1137508-050 PART 10 1 137508-050
10AMER1137508-050 AMER 10 1 137508-050
10CANA1137508-050 CANA 10 1 137508-050
10USA1137508-050 USA 10 1 137508-050
10PART1137617-050 PART 10 1 137617-050
10AMER1137617-050 AMER 10 1 137617-050nsc_prod_reg_cimg - keys (material_nbr and reg_id)
MATERIAL REG_ID GLOBALSOURCEINDICATOR
136353-010 3 G
136353-010 6 G
136353-010 7
137508-050 3
137508-050 6 G
137508-050 7
137508-050 46 G
137617-050 3
137617-050 6
137617-050 46 nsc_prod_reg_cyc_cimg - key is material_nbr, cyc_id, reg_id and orgversion_id
MATERIAL_NBR CYC_ID orgversion_id reg_ID CARRYOVERFLAG
136353-010 101 1 3 Y
136353-010 101 1 6 Y
136353-010 101 1 7 N
137508-050 202 1 3 Y
137508-050 202 1 6 N
137508-050 202 1 7
137617-050 205 1 3
137617-050 205 1 6
185204-402 181 1 8
185204-402 182 1 8 nsc_prod_cimg - key is material_nbr
MATERIAL_NBR SUBLABEL SUBLABELNAME
136353-010
137508-050 GD Good
137617-050
185204-402
185204-402
185204-402 BE Better
185204-402
185204-402
185204-402 CO Core
185204-402 BS BestWhat I intend to do, is to create one view by joining these four tables. The columns key_material, plan_ctry, division and MKT_TYP_ID come from RPT_APRL_PRODUCT. I need to join these tables in such a way that I bring in the other 1 or 2 columns each from the 3 tables as described above. The result should have a unique key_material and have the other column data in the view as well.
Result should be all the columns described above, something like this below...
KEY_MATERIAL PLAN_CTRY DIVISION MKT_TYP_ID MATERIAL SUBLABELNAME CARRYover_FL
10PART1136353-010 PART 10 1 136353-010
10AMER1136353-010 AMER 10 1 136353-010 -
Help with joining one table to several
I have the following table
MSELECT
Res_ID
Res_type
34
501
56
501
72
501
81
502
90
502
100
502
47
503
48
503
The RES_ID will link to different tables such as tablea, tableb or tablec based on the RES_Type value .g. RES_Type ID 501 will link to tableA and 502 will link to TableB and 503 will link to TableC.
I have created the following query:
Select * from MSSELECT MSEL
Inner join tablea ta on
Ta.id = MSEL.ID and
Res_type = 501
Inner join tableb tb on
Tb.id = MSEL.ID and
Res_type = 501
If I run the following query then results are returned.
Select * from MSSELECT MSEL
Inner join tablea ta on
Ta.id = MSEL.ID and
Res_type = 501
However if I run the following query it is returning no results:
Select * from MSSELECT MSEL
Inner join tablea ta on
Ta.id = MSEL.ID and
Res_type = 501
Inner join tableb tb on
Tb.id = MSEL.ID and
Res_type = 501Try:
Select * from MSSELECT MSEL
LEFT OUTER join tablea ta on
Ta.id = MSEL.ID and
Res_type = 501
LEFT OUTER join tableb tb on
Tb.id = MSEL.ID and
Res_type = 501
Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered. -
Need some help with the Table Function Operator
I'm on OWB 10gR2 for Sun/Solaris 10 going against some 10gR2 DB's...
I've been searching up and down trying to figure out how to make OWB use a Table Function (TF) which will JOIN with another table; allowing a column of the joined table to be a parameter in to the TF. I can't seem to get it to work. I'm able to get this to work in regular SQL, though. Here's the setup:
-- Source Table:
DROP TABLE "ZZZ_ROOM_MASTER_EX";
CREATE TABLE "ZZZ_ROOM_MASTER_EX"
( "ID" NUMBER(8,0),
"ROOM_NUMBER" VARCHAR2(200),
"FEATURES" VARCHAR2(4000)
-- Example Data:
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (1,'Room 1',null);
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (2,'Room 2',null);
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (3,'Room 3','1,1;2,3;');
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (4,'Room 4','5,2;5,4;');
Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (5,'Room 5',' ');
-- Destination Table:
DROP TABLE "ZZZ_ROOM_FEATURES_EX";
CREATE TABLE "ZZZ_ROOM_FEATURES_EX"
( "ROOM_NUMBER" VARCHAR2(200),
"FEATUREID" NUMBER(8,0),
"QUANTITY" NUMBER(8,0)
-- Types for output table:
CREATE OR REPLACE TYPE FK_Row_EX AS OBJECT
ID NUMBER(8,0),
QUANTITY NUMBER(8,0)
CREATE OR REPLACE TYPE FK_Table_EX AS TABLE OF FK_Row_EX;
-- Package Dec:
CREATE OR REPLACE
PACKAGE ZZZ_SANDBOX_EX IS
FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX;
END ZZZ_SANDBOX_EX;
-- Package Body:
CREATE OR REPLACE
PACKAGE BODY ZZZ_SANDBOX_EX IS
FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX
AS
RETURN_VALUE FK_Table_EX := FK_Table_EX();
i NUMBER(8,0) := 0;
BEGIN
-- TODO: Put some real code in here that will actually read the
-- input string, parse it out, and put data in to RETURN_VALUE
WHILE(i < 3) LOOP
RETURN_VALUE.EXTEND;
RETURN_VALUE(RETURN_VALUE.LAST) := FK_Row_EX(4, 5);
i := i + 1;
END LOOP;
RETURN RETURN_VALUE;
END UNFK;
END ZZZ_SANDBOX_EX;
I've got a source system built by lazy DBA's and app developers who decided to store foreign keys for many-to-many relationships as delimited structures in driving tables. I need to build a generic table function to parse this data and return it as an actual table. In my example code, I don't actually have the parsing part written yet (I need to see how many different formats the source system uses first) so I just threw in some stub code to generate a few rows of 4's and 5's to return.
I can get the data from my source table to my destination table using the following SQL statement:
-- from source table joined with table function
INSERT INTO ZZZ_ROOM_FEATURES_EX(
ROOM_NUMBER,
FEATUREID,
QUANTITY)
SELECT
ZZZ_ROOM_MASTER_EX.ROOM_NUMBER,
UNFK.ID,
UNFK.QUANTITY
FROM
ZZZ_ROOM_MASTER_EX,
TABLE(ZZZ_SANDBOX_EX.UNFK(ZZZ_ROOM_MASTER_EX.FEATURES)) UNFK
Now, the big question is--how do I do this from OWB? I've tried several different variations of my function and settings in OWB to see if I can build a single SELECT statement which joins a regular table with a table function--but none of them seem to work, I end up getting SQL generated that won't compile because it doesn't see the source table right:
INSERT
/*+ APPEND PARALLEL("ZZZ_ROOM_FEATURES_EX") */
INTO
"ZZZ_ROOM_FEATURES_EX"
("ROOM_NUMBER",
"FEATUREID",
"QUANTITY")
(SELECT
"ZZZ_ROOM_MASTER_EX"."ROOM_NUMBER" "ROOM_NUMBER",
"INGRP2"."ID" "ID_1",
"INGRP2"."QUANTITY" "QUANTITY"
FROM
(SELECT
"UNFK"."ID" "ID",
"UNFK"."QUANTITY" "QUANTITY"
FROM
TABLE ( "ZZZ_SANDBOX_EX"."UNFK2" ("ZZZ_ROOM_MASTER_EX"."FEATURES")) "UNFK") "INGRP2",
"ZZZ_ROOM_MASTER_EX" "ZZZ_ROOM_MASTER_EX"
As you can see, it's trying to create a sub-query in the FROM clause--causing it to just ask for "ZZZ_ROOM_MASTER_EX"."FEATURES" as an input--which isn't available because it's outside of the sub-query!
Is this some kind of bug with the code generator or am I doing something seriously wrong here? Any help will be greatly appreciated!Hello Everybody!
Thank you for all your response!
I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table
select vkorg abgru from ZADS into it_rej.
Earlier :
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
Now :
DATA : BEGIN OF IT_REJ occurs 0,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
I guess this will fix the issue correct?
PLease suggest!
Regards,
Developer. -
Newbie: help with join in a select query
Hi: I need some help with creating a select statement.
I have two tables t1 (fields: id, time, cost, t2id) and t2 (fields: id, time, cost). t2id from t1 is the primary key in t2. I want a single select statement to list all time and cost from both t1 and t2. I think I need to use join but can't seem to figure it out even after going through some tutorials.
Thanks in advance.
Rayt1 has following records
pkid, time, cost,product
1,123456,34,801
2,123457,20,802
3,345678,40,801
t2 has the following records
id,productid,time,cost
1,801,4356789,12
2,801,4356790,1
3,802,9845679,100
4,801,9345614,12
I want a query that will print following from t1 (time and cost for records that have product=801)
123456,34
345678,40
followed by following from t2 (time and cost for records that have productid=801)
4356789,12
4356790,1
9345614,12
Is this possible?
Thanks
ray -
I have two tables
- Process_Master (EVENT_ID, EVENT_TYP, STATUS)
- Rel_Event( EVENT_ID, USERID, EVENT_DATE, RMKS)
They have one-to-one relationship linked by EVENT_ID.
I would like to create a named query like below joining 2 tables together.
Do I need to create any class descriptor first and how? I want this query to be available from the ADF data control so I can drag and drop this to my JSP page as a ADF table. I have no problem in working with single table. I have read thru the developer guide and try out many things like multitable info, aggregate mapping and couldn't figure out how this can be done. Please help!!!
SELECT A.EVENT_ID,B.EVENT_DATE, A.STATUS, B.RMKS
FROM PROCESS_MASTER A, REL_EVENT B
WHERE A.EVENT_ID = B.EVENT_ID
AND A.STATUS = 'P';
********/I have tried the below but fail to retrieve any rows. Please help!
Expression aid = new ExpressionBuilder(ProcEventMaster.class).get("event_id");
Expression bid = new ExpressionBuilder(RelEvent.class).get("event_id");
ReportQuery reportQuery = new ReportQuery(ProcEventMaster.class,aid.equal(bid));
reportQuery.addAttribute("a_id", aid);
reportQuery.addAttribute("b_id", bid);
reportQuery.addAttribute("eventDate",bid.get("event_date"));
reportQuery.addAttribute("remarks",bid.get("rmks"));
reportQuery.setSelectionCriteria(aid.get("status").equal("P"));
List<RelEvent> results =
(List<RelEvent>)session.executeQuery(reportQuery);session.release();
return results; -
Help with pivot tables in excel
Hello,
I need some help with a very specific issue I am getting in excel.
So, I have this pivot table that gets data from an external source (a huge database) and everything is working fine.
The problem comes with some lines in our database that are written in asian letters (the thai alphabet). Every thai entry that we import appears like ????????.
I can look into the DB (via MySQL Workbench) and everything is alright in there. I can also just copy some of the content into excel and the letters shows up normally.
Is there something I can do to fix it?
Thank you very much
Daniel AyresI can see it is working fine for roman/latin characteres, and it is not working for thai or japanese characteres. Since I dont have data written using the russian or the arabic alphabet, there is no way I can tell you if it would or not work..
-
[SOLVED :)] Need help with adf table row selection
Hi,
In my application I am displaying results in a table. The DisplayRow property of table is set to Selected
There are Next and Back buttons which help user to view details associated to the next/previous rows.
I am using ADF 11g
When user clicks Next or Previous button, then the selection of the row should also gets updated
To achieve this i wrote below piece of code:
this.tblS.getSelectedRowKeys().clear();+
this.tblS.setRowIndex(count);+
RowKeySet rks = tblS.getSelectedRowKeys();+
rks.add(tblS.getRowKey());+
rks = tblS.getSelectedRowKeys();+
ISSUE:_
When i run application and click Next/Previous Button, all functionalities do take place properly, but a null pointer exception is also thrown._+
If i remove DisplayRow property of table from Selected to Default, every thing works good and no Exception is thrown_+
But as records in my table are going to be around 50-60 everytime, i need to set DisplayRow property of table to Selected.
Is there any way to achieve this? Solve this problem?
Some more details:_
I am using a POJO class to create DataController. This DataController is having a view Object which is used to create results table.
I have defined Primary key for my POJO Data Controller.
Here is code of xml file:*
+<?xml version="1.0" encoding="UTF-8" ?>+
+<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="11.1.1.52.5"+
id="ProductListBean" Package="xxadf.mm.resources"
BeanClass="xxadf.mm.resources.ProductListBean"
isJavaBased="true">
+<Attribute Name="Product" Type="java.lang.String" PrimaryKey="true"/>+
+<Attribute Name="Stock" Type="java.lang.String"/>+
+<Attribute Name="Rate" Type="java.lang.String"/>+
+<Attribute Name="Accuracy" Type="java.lang.String"/>+
+<Attribute Name="Details" Type="java.lang.String"/>+
+<ConstructorMethod IsCollection="true"+
Type="xxadf.mm.resources.ProductListBean"
BeanClass="xxadf.mm.resources.ProductListBean"
id="ProductListBean"/>
+</JavaBean>+
Error Log:*
SEVERE: Server Exception during PPR, #1
java.lang.NullPointerException
at oracle.adfinternal.view.faces.model.binding.RowDataManager.getRowIndex(RowDataManager.java:200)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.getRowIndex(FacesCtrlHierBinding.java:506)
at org.apache.myfaces.trinidad.component.UIXIterator._fixupFirst(UIXIterator.java:414)
at org.apache.myfaces.trinidad.component.UIXIterator.__encodeBegin(UIXIterator.java:392)
at org.apache.myfaces.trinidad.component.UIXTable.__encodeBegin(UIXTable.java:168)
at org.apache.myfaces.trinidad.component.UIXCollection.encodeBegin(UIXCollection.java:517)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeHorizontalChild(PanelGroupLayoutRenderer.java:458)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$100(PanelGroupLayoutRenderer.java:30)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:618)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:560)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:125)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:201)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:167)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:317)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:392)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$300(PanelGroupLayoutRenderer.java:30)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:641)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:560)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:125)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:201)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:167)
at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:317)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer.access$100(ShowDetailItemRenderer.java:31)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer$ChildEncoderCallback.processComponent(ShowDetailItemRenderer.java:491)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer$ChildEncoderCallback.processComponent(ShowDetailItemRenderer.java:464)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:125)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:201)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:167)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer._encodeChildren(ShowDetailItemRenderer.java:406)
at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer.encodeAll(ShowDetailItemRenderer.java:114)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:1523)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer.access$500(PanelTabbedRenderer.java:38)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer$BodyEncoderCallback.processComponent(PanelTabbedRenderer.java:969)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer$BodyEncoderCallback.processComponent(PanelTabbedRenderer.java:920)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:125)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:201)
at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:167)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer._renderTabBody(PanelTabbedRenderer.java:519)
at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer.encodeAll(PanelTabbedRenderer.java:233)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:221)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:820)
at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
at org.apache.myfaces.trinidad.component.UIXComponentBase.__encodeRecursive(UIXComponentBase.java:1494)
at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeAll(UIXComponentBase.java:771)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:202)
at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:685)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:261)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:193)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:159)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Please Help I have been struggling with this issue for long.
Thanks and Regards
Manav Ratra
Edited by: user11255144 on Feb 8, 2010 5:33 AMHi Arun,
Thanks for replying.
Actually in my application there is one result table and a section that is displaying complete details of the product selectd in result table.
The next/previous buttons are not binded with result table.
What I am doing is, I am puuliing data from VO and displaying it on form, whenever any of these buttons is clicked.
As soon as these buttons are clicked data is coming up, but selection state of table is not getting updated.
So to update selection state i wrote piece of code described in my previous post.
Everything works fine if displayRow property of table is not set to selected.
If i set display row property of table to selected, then i get a null pointer exception with message log defined in previous post.
Although NPE is thrown, yet all data is properly fetched and table selection is also updated. But am not able to get how this NPE is coming and hpw to fix it .
(I need to keep displayRow = selected, for all other cases NPE is not thrown)
Please help..
Thanks and Regards
Manav Ratra -
Problem with joining tables in cmp bean
This is for an informix database. when i specify to join tables in CMP beans i get a sql error.. this is what the SQL join statement looks like when the server spits it out:
SELECT t0.id, t0.name, t0.available, t0.available_date FROM drs_product t0, outer drs_category t1 ON t0.style=t1.style WHERE t0.available = 'T'
it puts the "ON" string into the join?? this gives me a SQL error, it's supposed to be like this:
SELECT t0.id, t0.name, t0.available, t0.available_date FROM drs_product t0, outer join drs_category t1 WHERE t0.style=t1.style AND t0.available = 'T'
how can i fix thisnevermind..i figured it out again.. in the INFORMIX DYNAMIC SERVER.properties file replace the left join attribute with this:
LEFT_JOIN= left join
make sure there is a space before the "l" in left and a space after the "n" in join, otherwise it will be a sql error:
the previously LEFT_JOIN=, outer statement is clearly wrong for this database. -
Help with Oracle Table Audit Trigger
Hi Guys,
Need some help with the design of a trigger please. I have created one standard audit table where all sensitive data will be audited/inserted. The idea is to insert the column name and the old and new values here, dont want to maintain an audit table for each and every table there is, reporting would be a nightmare.
Trying to fetch all the column names from sys objects then looping through each and inserting the new and old values for them into the audit table. Everything else is fine apart from the actual :old and :new value inserts. The column name is coming from a variable in a cursor and this is where I seem to be failing.
Can anyone help please? What is the correct syntax to use?
CREATE OR REPLACE TRIGGER commission_update
AFTER UPDATE
ON commission
FOR EACH ROW
DECLARE
v_username varchar2(10);
v_column varchar2(20);
-- Get Table Columns
cursor table_column is
select c.name
from sys.col$ c, sys.obj$ t
where t.obj# = c.obj#
and t.type# in (2, 3, 4)
and bitand(c.property, 32) = 0 /* not hidden column */
and t.name = 'COMMISSION';
BEGIN
-- Find username of person performing UPDATE into table
SELECT user
INTO v_username
FROM dual;
open table_column;
loop
fetch table_column
into v_column;
EXIT WHEN table_column%NOTFOUND;
-- Insert record into audit_record
INSERT INTO audit_record
( aud_code,
aud_ban_code,
aud_user,
aud_table,
aud_column,
aud_old_val,
aud_new_val,
aud_date )
VALUES
( xaudit_record.nextval,
:old.com_ban_code,
v_username,
'COMMISSION',
v_column,
:old.v_column, /* problem here!!!!!!! */
:new.v_column, /* problem here!!!!!!! */
sysdate );
end loop;
close table_column;
END;
/What does auditing mean in the financial environment? "An audit is a professional, independent examination of a company's financial statements and accounting documents according to generally accepted accounting principles."
What does it mean in database terms? Surely, the basic definition would be the same, ito of a proper independent examination of changes in the database according to accepted principles?
And just how does a trigger live up to that? When it is fully dependent on being enabled for that transaction in order to examine it? It is trivial to disable a trigger, make changes, and re-enable it.
So what happens to your "auditing" then?
Do you really think that a trigger suffices as a means to audit changes in a table? And if so, what logic and reasoning do you use to discard Oracle's auditing features that are built into the core of the database? -
Help with Times Table GUI applet
Hello,
I need help with an applet which inputs an integer from the user and displays the appropiate times table up to times 10 eg; user input 5 - display shows
5 time 1 is 5
5 times 2 is 10
5 times 10 is 50.
I have only managedt o get the display to show one statement eg 5 times 1 - I have tried using a for loop to show the whole table - but unlike a print statement each time the loop goes round it overwrites the data in the display box with the new data - any help would be much appreciated.
Note: it is for a programming course year 1 exercise - so I can only use basic constructs or loops to achieve this. Thanks in advance! Heres what I have so far:
import java.applet.* ;
import java.awt.* ;
import java.awt.event.* ;
public class TimesTableApplet extends Applet implements ActionListener
// Declare the GUI components globally
Label titleLabel, whichTableLabel ;
TextField whichTableBox, resultBox ;
Button showTableButton, clearButton ;
// Declare integer variables for holdind the number input by the user,
// the times number, and the result number
int whichTable, times=1, result ;
// Declare variables to hold string versions of the three integer variables
// above, for placing in the TextFields
String whichTableString, timesString, resultString ;
public void init ()
// Create the Labels
titleLabel = new Label ( "Times Table" ) ;
whichTableLabel = new Label ( "Which Table?" ) ;
// Create the TextFields
whichTableBox = new TextField ( 5 ) ;
resultBox = new TextField ( 30 ) ;
// Create the Buttons
showTableButton = new Button ( "Show Table" ) ;
clearButton = new Button ( "Clear" ) ;
// Add the components to the applet window
add ( titleLabel ) ;
add ( whichTableLabel ) ;
add ( whichTableBox ) ;
whichTableBox.addActionListener ( this ) ;
add ( resultBox ) ;
resultBox.setEditable ( false ) ;
add ( showTableButton ) ;
showTableButton.addActionListener ( this ) ;
add ( clearButton ) ;
clearButton.addActionListener ( this ) ;
} // End of init method
public void actionPerformed ( ActionEvent event )
// Find out which button generated the event
String arg = event.getActionCommand () ;
// If the user clicks the clear button, clear the whichTableBox and
// resultBox
if ( arg.equals ( "Clear" ) )
whichTableBox.setText ( "" ) ;
resultBox.setText ( "" ) ;
else
try
// Try extracting a string from the whichTableBox ( the users input )
// and converting it to an integer
whichTableString = whichTableBox.getText () ;
whichTable = Integer.parseInt ( whichTableString ) ;
// Clear status box
showStatus ( "" ) ;
// If the user clicks the showTableButton, display the appropiate
// times table up to times 10
if ( arg.equals ( "Show Table" ) ) ;
result = whichTable * times ;
timesString = Integer.toString ( times ) ;
resultString = Integer.toString ( result ) ;
resultBox.setText ( whichTableString + " times " + timesString + " is " + resultString ) ;
} // End of try block
catch ( NumberFormatException entry )
// Display error message and clear whichTableBox
showStatus ( "Error: Invalid Input - not an integer!" ) ;
whichTableBox.setText ( "" ) ;
} // End of catch block
} // End of else statement
} // End of actionPerformed method
} // End of classuse this code, please arrange your User interface correctly.
* TimesTableApplet.java
* Created on March 12, 2007, 12:08 PM
* @author cc.woon
import java.applet.* ;
import java.awt.* ;
import java.awt.event.* ;
public class TimesTableApplet extends Applet implements ActionListener
// Declare the GUI components globally
Label titleLabel, whichTableLabel ;
TextField whichTableBox ;
TextArea resultBox;
Button showTableButton, clearButton ;
// Declare integer variables for holdind the number input by the user,
// the times number, and the result number
int whichTable, times=1, result ;
// Declare variables to hold string versions of the three integer variables
// above, for placing in the TextFields
String whichTableString, timesString, resultString ;
public void init ()
// Create the Labels
titleLabel = new Label ( "Times Table" ) ;
whichTableLabel = new Label ( "Which Table?" ) ;
// Create the TextFields
whichTableBox = new TextField ( 5 ) ;
resultBox = new TextArea() ;
// Create the Buttons
showTableButton = new Button ( "Show Table" ) ;
clearButton = new Button ( "Clear" ) ;
// Add the components to the applet window
add ( titleLabel ) ;
add ( whichTableLabel ) ;
add ( whichTableBox ) ;
whichTableBox.addActionListener ( this ) ;
add ( resultBox ) ;
resultBox.setEditable ( false ) ;
add ( showTableButton ) ;
showTableButton.addActionListener ( this ) ;
add ( clearButton ) ;
clearButton.addActionListener ( this ) ;
} // End of init method
public void actionPerformed ( ActionEvent event )
// Find out which button generated the event
String arg = event.getActionCommand () ;
// If the user clicks the clear button, clear the whichTableBox and
// resultBox
if ( arg.equals ( "Clear" ) )
whichTableBox.setText ( "" ) ;
resultBox.setText ( "" ) ;
else
try
// Try extracting a string from the whichTableBox ( the users input )
// and converting it to an integer
whichTableString = whichTableBox.getText () ;
whichTable = Integer.parseInt ( whichTableString ) ;
// Clear status box
showStatus ( "" ) ;
// If the user clicks the showTableButton, display the appropiate
// times table up to times 10
if ( arg.equals ( "Show Table" ) ) ;
result = whichTable * times ;
timesString = Integer.toString ( times ) ;
String output = "";
for(int i =1;i<=10;i++){
output += whichTable +" times "+i + ": "+(i*whichTable)+"\n";
resultString = Integer.toString ( result ) ;
//resultBox.setText ( whichTableString + " times " + timesString + " is " + resultString ) ;
resultBox.setText ( output) ;
} // End of try block
catch ( NumberFormatException entry )
// Display error message and clear whichTableBox
showStatus ( "Error: Invalid Input - not an integer!" ) ;
whichTableBox.setText ( "" ) ;
} // End of catch block
} // End of else statement
} // End of actionPerformed method
} // End of class -
Help with UPDATE table and database RELATIONSHIPS
HI there, I have been trying to create an update table for
weeks now and keep getting error messages.
The database has a table named:
"books" in the table cells are "idbook" and "book".
"suppliers" in the table cells are "idsupplier" and
"supplierName".
"category" in the table cells are "idcategory" and
categoryName"
They all have a relationships with this table:
"results" in the cells are "idbook", "idsupplier" and
"idcategory".
This "results" table brings all of the above tables together.
When I try to do an update, i am doing one to the results
table. Is this correct?
The updates have problems because when drawing the text to
the update table to view it comes in text form.
When trying to update, it wont becuase all of the cells in
the results table are numeric. This is because of the
relationships.
Can anyone suggest where i may be going wrong.
Ask anything you need to.
TAMM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Session("MM_UserName") <> "") Then
Recordset1__MMColParam = Session("MM_UserName")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_connSeek_STRING
Recordset1.Source = "SELECT * FROM Query1 WHERE UserName = '"
+ Replace(Recordset1__MMColParam, "'", "''") + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
Dim rsUpdate
Dim rsUpdate_numRows
Set rsUpdate = Server.CreateObject("ADODB.Recordset")
rsUpdate.ActiveConnection = MM_connSeek_STRING
rsUpdate.Source = "SELECT * FROM tblSpecies"
rsUpdate.CursorType = 0
rsUpdate.CursorLocation = 2
rsUpdate.LockType = 1
rsUpdate.Open()
rsUpdate_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<html>
<head>
<link href="css%20files/paragraph.css" rel="stylesheet"
type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new
Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0;
i<a.length; i++)
if (a
.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0"
marginwidth="0" marginheight="0"
onLoad="MM_preloadImages('images/Publicationb.gif','images/Factsheetsb.gif')">
<table width="100%" height="100%" border="1"
cellpadding="0" cellspacing="0" bordercolor="#5D5D5D">
<tr>
<td colspan="2">
<div align="right"></div>
<div align="left"></div>
</td>
</tr>
<tr>
<td colspan="2"><table width="100%" height="100%"
border="0" cellpadding="0" cellspacing="0"
bordercolor="#5D5D5D">
<tr>
<td valign="top"><form
ACTION="<%=MM_editAction%>" METHOD="POST" name="form1">
<table width="90%" border="0" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><div
align="center"></div> <table border="1" align="center"
cellpadding="2" cellspacing="0" bordercolor="#FFFFFF">
<tr bgcolor="ECECD7">
<td colspan="2"><div align="center">
<p><strong><font size="3">Update Key Word
& Category</font></strong></p>
</div>
</td>
</tr>
<tr>
<td><div align="center">
<p><font size="1">Enter Up to 10 Species /
Product
Name</font></p>
</div>
</td>
<td><div align="center">
<p><font size="1">Select a
Category</font></p>
</div>
</td>
</tr>
<tr>
<td colspan="2" bordercolor="#D0D09D">
<%
While ((Repeat1__numRows <> 0) AND (NOT
Recordset1.EOF))
%>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr><td width="50%"><div align="center">
<input name="f1" type="text" id="f13"
value="<%=(Recordset1.Fields.Item("TimberSpecies").Value)%>"
size="33">
</div></td>
<td width="45%"><div
align="center"></div></td></tr></table>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend %>
<div align="center"> </div> <div
align="center">
</div></td></tr><tr>td
colspan="2"> </td></tr><tr><td
colspan="2"><div align="right"><p><font
size="1">To Finalise Your Changes Please Press the Update
Button
<input name="update2" type="submit" id="update"
value="Update">
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%=
rsUpdate.Fields.Item("TimberSpecies").Value %>">
Maybe you are looking for
-
Installation issues on Windows 2003, Xeon processor and Oracle 9.2 (64 bit)
Hi all, I am using a xeon 4 CPU machine with Windows 2003 (64 bit). I just downloaded Oracle 9.2 (64 bit) and found that it needs Itanium processor. Is this an absolute requirement? Can I still run it on xeon? What are the problems? Mahendra
-
Profit Centre substitution on the line items
Hi Guys I am replicating a contract from CRM to R/3 , the CRM contract will replicate as debit memo request / contract in r/3 with u201Cnu201D line items and these line items are populated with profit centers based on plant and prod
-
Use of APIs to update Absence info in Oracle HR/SSHR 11i
Dear all, Use of APIs and Absences 1. Can you please let me know which are the relevant APIs to update Absences Information into Oracle Human Resources Application? 2. Where can I find relevant documentation on how to deploy these APIs? Thanking you
-
Deleting specific scanned pages?
After doing a text search on a large document, I have 230 pages that were pulled out. How can I delete these pages from the original document?
-
How do you overlap images on Adobe Photoshop Elements 8.0 please