DB Table construction
Would anyone be willing to give me tips on how to best setup
my tables in
MyPHPAdmin?
Here is the general mockup of what I am trying to accomplish
http://www.yogagoyoga.com/dbformat.html
At the top of each column the bold text is how I want the
information to be
searchable.
Under quadrants, there could be 100's of classes in any given
quadrant.
But, obviously after
the user search is complete, it should spit out any or all
relevant classes
to include Name, address, etc.
BUT, also, somehow I want to format the resulting address
fields to hotlink
to a prescribe map.
Also, I do not want to mandate a minimum sort...meaning, if
someone just hit
search without toggling any or all of the
criteria it would still pump out a list. I anticipate about
1000 classes.
I just cannot get my head around tables and recordset
creation though. I
have not problem setting
up a db on the server and logging into myPHPadmin.
TIA.
Would anyone be willing to give me tips on how to best setup
my tables in
MyPHPAdmin?
Here is the general mockup of what I am trying to accomplish
http://www.yogagoyoga.com/dbformat.html
At the top of each column the bold text is how I want the
information to be
searchable.
Under quadrants, there could be 100's of classes in any given
quadrant.
But, obviously after
the user search is complete, it should spit out any or all
relevant classes
to include Name, address, etc.
BUT, also, somehow I want to format the resulting address
fields to hotlink
to a prescribe map.
Also, I do not want to mandate a minimum sort...meaning, if
someone just hit
search without toggling any or all of the
criteria it would still pump out a list. I anticipate about
1000 classes.
I just cannot get my head around tables and recordset
creation though. I
have not problem setting
up a db on the server and logging into myPHPadmin.
TIA.
Similar Messages
-
ESS Record Working Time Table construction
Hello,
I am trying to modify the ESS Cats webdynpro for java application and cannot figure out how the table for time entry is constructed after the first 2 header rows ....as for the first 2 rows I found the method addFixHeaderLines() in the VcCatRecordEntry Component which has 2 separate view controllers for Weekly and Daily tables construction in the respective tabs...
If anybody has any idea about the above ...please help..It was not in the Detail view...but in a separate .java file...ListViewerSlim.java ..if anybody has worked on it then please let me know...
Thanks -
Partitioned IOT of Object Type - mapping table not allowed for bitmap index
Hi,
looks like a feature available for standard Partitioned IOTs is not supported for object based tables, namely the MAPPING TABLE construct to support secondary local bitmap indexes.
Can you confirm behaviour is as expected/documented?
If so, is a fix/enhancement to support mapping table for object-based Partitioned IOTs in the pipeline?
Results for partition-wise load using pipelined table function are very good, look-ups across tens of millions of rows are excellent.
Environment = Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
OS = Oracle Enterprise Linux Server release 5.2 (Carthage) 2.6.18 92.el5 (32-bit)
Here's the potted test-case...
1) First the non object based Partitioned IOT - data is range-partitioned across the alphabet
CREATE TABLE IOT_Table (
textData VARCHAR2(10),
numberData NUMBER(10,0),
CONSTRAINT IOT_Table_PK PRIMARY KEY(textData))
ORGANIZATION INDEX MAPPING TABLE PCTFREE 0 TABLESPACE Firewire
PARTITION BY RANGE (textData)
(PARTITION Text_Part_A VALUES LESS THAN ('B') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_B VALUES LESS THAN ('C') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_C VALUES LESS THAN ('D') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_D VALUES LESS THAN ('E') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_E VALUES LESS THAN ('F') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_F VALUES LESS THAN ('G') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_G VALUES LESS THAN ('H') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_H VALUES LESS THAN ('I') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_I VALUES LESS THAN ('J') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_J VALUES LESS THAN ('K') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_K VALUES LESS THAN ('L') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_L VALUES LESS THAN ('M') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_M VALUES LESS THAN ('N') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_N VALUES LESS THAN ('O') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_O VALUES LESS THAN ('P') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_P VALUES LESS THAN ('Q') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_Q VALUES LESS THAN ('R') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_R VALUES LESS THAN ('S') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_S VALUES LESS THAN ('T') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_T VALUES LESS THAN ('U') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_U VALUES LESS THAN ('V') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_V VALUES LESS THAN ('W') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_W VALUES LESS THAN ('X') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_X VALUES LESS THAN ('Y') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_Y VALUES LESS THAN ('Z') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_Z VALUES LESS THAN (MAXVALUE) PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0))
NOLOGGING PARALLEL -- FLASHBACK ARCHIVE IOT_Flashback_Data
SQL> table IOT_TABLE created.
2) Create the local secondary bitmap index utilising the underlying mapping table
CREATE BITMAP INDEX IOT_Table_BMI1 ON IOT_Table (numberData)
LOCAL STORAGE (INITIAL 1M PCTINCREASE 0 NEXT 512K) NOLOGGING PARALLEL;
SQL> bitmap index IOT_TABLE_BMI1 created.
3) Quick test to confirm all ok
SQL> INSERT INTO IOT_Table VALUES ('ABC123',100);
SQL> 1 rows inserted.
SQL> SELECT * FROM IOT_Table;
TEXTDATA NUMBERDATA
ABC123 100
4) Now create a minimal object type to use as the template for object table
CREATE TYPE IOT_type AS OBJECT
textData VARCHAR2(10 CHAR),
numberData NUMBER(10,0)
) FINAL
SQL> TYPE IOT_type compiled
5) Attempt to create an object-based range partitioned IOT, including MAPPING TABLE clause as per step (1)
CREATE TABLE IOTObj_Table OF IOT_type (textData PRIMARY KEY)
OBJECT IDENTIFIER IS PRIMARY KEY ORGANIZATION INDEX
MAPPING TABLE -- we'd like to use this feature to enable use of Bitmap Indexes...
PCTFREE 0 TABLESPACE Firewire
PARTITION BY RANGE (textData)
(PARTITION Text_Part_A VALUES LESS THAN ('B') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_B VALUES LESS THAN ('C') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_C VALUES LESS THAN ('D') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_D VALUES LESS THAN ('E') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_E VALUES LESS THAN ('F') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_F VALUES LESS THAN ('G') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_G VALUES LESS THAN ('H') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_H VALUES LESS THAN ('I') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_I VALUES LESS THAN ('J') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_J VALUES LESS THAN ('K') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_K VALUES LESS THAN ('L') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_L VALUES LESS THAN ('M') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_M VALUES LESS THAN ('N') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_N VALUES LESS THAN ('O') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_O VALUES LESS THAN ('P') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_P VALUES LESS THAN ('Q') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_Q VALUES LESS THAN ('R') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_R VALUES LESS THAN ('S') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_S VALUES LESS THAN ('T') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_T VALUES LESS THAN ('U') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_U VALUES LESS THAN ('V') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_V VALUES LESS THAN ('W') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_W VALUES LESS THAN ('X') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_X VALUES LESS THAN ('Y') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_Y VALUES LESS THAN ('Z') PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0),
PARTITION Text_Part_Z VALUES LESS THAN (MAXVALUE) PCTFREE 0 TABLESPACE Firewire Storage (Initial 10M Next 1M PCTIncrease 0))
NOLOGGING PARALLEL -- FLASHBACK ARCHIVE IOT_Flashback_Data
This errors out with the following...
SQL Error: ORA-25182: feature not currently available for index-organized tables
25182. 00000 - "feature not currently available for index-organized tables"
*Cause: An attempt was made to use one or more of the following feature(s) not
currently supported for index-organized tables:
CREATE TABLE with LOB/BFILE/VARRAY columns,
partitioning/PARALLEL/CREATE TABLE AS SELECT options,
ALTER TABLE with ADD/MODIFY column options, CREATE INDEX
*Action: Do not use the disallowed feature(s) in this release.
6) Re-running the create table statement in step 5 without the MAPPING TABLE clause works fine. Not surprisingly an attempt to create a secondary local bitmap index on this table fails as there's no mapping table, like so...
CREATE BITMAP INDEX IOTObj_Table_BMI1 ON IOTObj_Table (numberData)
LOCAL STORAGE (INITIAL 1M PCTINCREASE 0 NEXT 512K) NOLOGGING PARALLEL;
CREATE TABLE with LOB/BFILE/VARRAY columns,
partitioning/PARALLEL/CREATE TABLE AS SELECT options,
ALTER TABLE with ADD/MODIFY column options, CREATE INDEX
*Action: Do not use the disallowed feature(s) in this release.
CREATE BITMAP INDEX IOTObj_Table_BMI1 ON IOTObj_Table (numberData)
LOCAL STORAGE (INITIAL 1M PCTINCREASE 0 NEXT 512K) NOLOGGING PARALLEL
Error at Command Line:99 Column:13
Error report:
SQL Error: ORA-00903: invalid table name
00903. 00000 - "invalid table name"
7) Creating a secondary local b-tree index is fine, like so...
SQL> CREATE INDEX IOTObj_Table_I1 ON IOTObj_Table (numberData)
LOCAL STORAGE (INITIAL 1M PCTINCREASE 0 NEXT 512K) NOLOGGING PARALLEL;
index IOTOBJ_TABLE_I1 created.
8) A quick test to ensure object table ok...
SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('DEF456',500));
SQL> 1 rows inserted.
SQL> SELECT * FROM IOTObj_Table;
TEXTDATA NUMBERDATA
DEF456 500Thanks Dan,
the intention is to range partition based on the initial character, so A* -> Text_Part_A, B* -> Text_Part_B, and so on.
Here's an example, using an empty IOTObj_Table as created previously.
1) Set up & confirm some test data (two 'D's, one 'N', and two 'Z's)
SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('DEF456',500));
SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('DDD111',510));
SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('N3000',515));
SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('ZZ1212',520));
SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('Z111X',530));
SQL> COMMIT;
SQL> SELECT * FROM IOTObj_Table;
TEXTDATA NUMBERDATA
DDD111 510
DEF456 500
N3000 515
Z111X 530
ZZ1212 520
2) Just to prove our IOT is enforcing the Primary Key based on the TextData attribute, try to insert a duplicate
SQL> INSERT INTO IOTObj_Table VALUES (IOT_Type('Z111X',530));
Error starting at line 141 in command:
INSERT INTO IOTObj_Table VALUES (IOT_Type('Z111X',530))
Error report:
SQL Error: ORA-00001: unique constraint (OCDataSystems.SYS_IOT_TOP_84235) violated
00001. 00000 - "unique constraint (%s.%s) violated"
*Cause: An UPDATE or INSERT statement attempted to insert a duplicate key.
For Trusted Oracle configured in DBMS MAC mode, you may see
this message if a duplicate entry exists at a different level.
*Action: Either remove the unique restriction or do not insert the key.
3) Now confirm that our data has been slotted into the range-based partition we expect using the PARTITION clause of SELECT...
- The two 'D's...
SQL> SELECT * FROM IOTObj_Table PARTITION (Text_Part_D);
TEXTDATA NUMBERDATA
DDD111 510
DEF456 500
- The single 'N'...
SQL> SELECT * FROM IOTObj_Table PARTITION (Text_Part_N);
TEXTDATA NUMBERDATA
N3000 515
- The two 'Z's...
SQL> SELECT * FROM IOTObj_Table PARTITION (Text_Part_Z);
TEXTDATA NUMBERDATA
Z111X 530
ZZ1212 520
4) And to wrap up confirm an empty partition
SELECT * FROM IOTObj_Table PARTITION (Text_Part_W); -
Is there a way to make a "table header" a column instead of a row?
I am making a 508 compliant pdf from a predesigned indesign document that has many tables in it. The table that I am having problems with doesn't have it's table header as a Row at the top of the table but instead a Column that runs down the left side like this example:
To be read correctly in the pdf by screen readers the header needs to be included in the table but I don't know how to make a column a header, I have only found the option of making a row a header. Is there a way to do this or will I just have to retag and reorder the tags in the pdf after?
Thanks!@Joel – ah, now I begin to understand.
Slapbet wants to change the reading order in a two column table from:
Usually:
1 2
3 4
5 6
to:
1 4
2 5
3 6
If so, you need two separate tables:
One for column 1, one for column 2.
Grouped together, anchored in a text frame with the flowing text.
Could the every column is a single table construct work for you?
Or is it necessary for what ever reason (besides editing) to work with a single table?
A script could help to split every column to a single table, making a group and anchor it to the text flow.
Or did I misunderstand what the problem here is?
Uwe -
How to cross two tables?
Greetings community,
This is totally beginner’s question, so accept my apology for bothering you with such a basic thing. At first I blamed Microsoft for giving us LINQ that was so easy to use and on the other side much slower intellisense in SSMS when typing
queries, but it was my laziness to learn T-SQL properly at the end.
I have two tables that I have to cross. First is simple lookup table named LUItems that is consisted of these columns:
ItemID int – auto incremented key
Name nvarchar(50)
ULoA int (user’s level of authorization: 1 is lowest)
Second table is document details – for the simplicity of this question let’s say it’s consisted of only these columns:
DetailID int – auto incremented key
DocumentID int
ItemID int
DocDate date
So I have some user logged in, who wants to see a document. I want to let him/her see only those document details that are at his/hers ULoA.
At first phase I create small lookup table from LUItems where I pull only those items whose ULoA is smaller or equal than particular user’s authority level. That table is attached on one binding source, so I could use item’s names in order
to show them in data grid view that is dedicated to show document details.
At second phase I need to pull document’s details, but if I pull them all, data grid view would throw the exception if document contains some items that particular user is not supposed to see, because attached lookup in previously created
binding source simply does not contain them.
What I need is stored procedure with entry parameters DocumentID and ULoA, which would result of only those document details for the particular document whose items’ ULoA are smaller or equal than entered.
Thanks for any help.Hi SaravanaC,
Thanks for the reply.
I’m trying but I simply don’t get how it really works. Don’t get me wrong; using your part of code, with some lucky-guessing I came up with this:
CREATE PROCEDURE GetDetailsByULoA (@DocID int,@ULoA int)
AS
BEGIN
select DetailID,DocumentID,a.ItemID,DocDate from dbo.DocumentDetails a
inner join dbo.Items b
on a.ItemID=b.ItemID where b.ULoA<=@ULoA and a.DocumentID=@DocID
END
And that did the particular job, but I don’t get it. At first glance, I was wondering how you could select ULoA from document_details, considering that this table does not contain column named so. Then I realized that “select” actually
works on some table-construction that was previously made by joining the tables.
My problem actually is that SSMS’s intellisense comes up with too many red underlining while typing. All the time I have feeling that I mistyped or made some other error. For example ItemID was ambiguous until I typed “a.” in front of
it, and I couldn’t have typed it before I typed “from” part. It’s expected because intellisense can work fine only if things are previously declared, and that’s what I was doing all my life, first declare-compute after. That’s why I’m comfort with LINQ, and
confused with T-SQL.
So for example you “nicknamed” tables “a” and “b”, but you did it inline, causing the intellisense to go crazy. Is there any way to nickname them previously in some kind of declare that nickname, and do join later?
If I declare empty table like Patrick suggested in previous post, is it variable or that table becomes another table in database? If it is a variable as I hope, how do I assign it some values, and by that I mean I want to pull some existing
data from some table, not make up something and insert.
Does every variable in T-SQL have to start with @?
What is the difference between “join”, “inner join”, “outer join” that I found in documentation? Don’t get me wrong because I ask those probably basic things. I find it hard to read the documentation because I’m not used to this way of
thinking. When you talk T-SQL it’s like you talk human language; for example:
SELECT this FROM that. I’m sure that machine translates this to: FROM that SELECT this, and that’s how I do it all my life. In order to learn T-SQL I need to learn how to declare things first and avoid red underlining.
Thanks for any advice.
<<Is there any way to nickname them previously in some kind of declare that nickname, and do join later?>>
Nop , you need to specifically aliases for per statement(select,update or delete)
better you can type below order in SSMS
1)select * from
2) give the table name and alias (if join specify it)
3)where clause
4) then provide the column name in select clause
in that way you can avoid some red mark
<<If I declare empty table like Patrick suggested in previous post, is it variable or that table becomes another table in database? If it is a variable as I hope, how do I assign it some values, and by that I mean I want to pull
some existing data from some table, not make up something and insert.>>
Patrick has declare and use table variable, yes you can declare the table variable and use them later by inserting, updating, deleting records just like normal table
table variable is like temporary table that get created and deleted on fly, and scope is with in the batch or SP, SQL server doesn't maintain any stats for this
http://www.sqlteam.com/article/using-table-variables
<<Does every variable in T-SQL have to start with @?>>
Yes all variable start with @ http://technet.microsoft.com/en-us/library/ms187455%28v=sql.105%29.aspx
<<What is the difference between “join”, “inner join”, “outer join” that I found in documentation? >>
join and inner join are same, default join in SQL Server is INNER JOIN
difference between INNER & OUTER JOIN is
inner join will return only the matched records specified on ON clause
outer join will return all records from both left and right table
even if not match with nulls on the records that was not present.
http://stackoverflow.com/questions/38549/difference-between-inner-and-outer-joins
http://stackoverflow.com/questions/19267238/what-is-difference-between-inner-join-and-outer-join
Please mark this as answer if it helps you -
Question About Table Style Terminology
I am curious about what other people might call the following two styles of table construction.
Style 1:
create table cust_trans_a (
cust_nbr varchar2(6),
trans_date date,
sales number(11, 2)
Style 2:
create table cust_trans_2 (
cust_nbr varchar2(6),
sales_in_2004,
sales_in_2005,
sales_in_2006,
sales_in_2007
);I have been using the terms vertical and horizontal respectively for these two construction styles, but I would like to know if other DB professionals have another, more descriptive set of terms for them.
Thanks,
GregoryHow about normalized and denormalized?
Generally, denormalized data models (Style 2) are a pain to deal with because you're constantly having to add columns (i.e. you'll eventually want to store 2008 sales) and because you have to maintain the same information in both summary and detail tables. In Oracle, if you think you need a denormalized table, you're generally better off creating a materialized view instead.
Justin -
How can i send an auto reply with form content to sender?
Hai!
I'm new to website building, but i already came a long way
i made a form and i like to send a auto reply with the form content (if that isnt too difficult) to the person who filled it in.
The form i made is in PHP (coding i copied partly from someone from the internet .)
You can see the from at: http://vinddit.nl/vindditnu%20php%20version.php
My PHP coding so far
<?php
// Set email variables
$email_to = '[email protected]';
$email_subject = 'Aanvraag - VINDDIT NU!';
// Set required fields
$required_fields = array('Voornaam','email','Achternaam','Plaats');
// set error messages
$error_messages = array(
'Voornaam' => 'Vul hier uw voornaam in a.u.b.',
'email' => 'Vul hier een geldig email adres in a.u.b.',
'Achternaam' => 'Vul hier uw achternaam in a.u.b.',
'Plaats' => 'Vul hier uw woonplaats in a.u.b.'
// Set form status
$form_complete = FALSE;
// configure validation array
$validation = array();
// check form submittal
if(!empty($_POST)) {
// Sanitise POST array
foreach($_POST as $key => $value) $_POST[$key] = remove_email_injection(trim($value));
// Loop into required fields and make sure they match our needs
foreach($required_fields as $field) {
// the field has been submitted?
if(!array_key_exists($field, $_POST)) array_push($validation, $field);
// check there is information in the field?
if($_POST[$field] == '') array_push($validation, $field);
// validate the email address supplied
if($field == 'email') if(!validate_email_address($_POST[$field])) array_push($validation, $field);
// basic validation result
if(count($validation) == 0) {
// Prepare our content string
$email_content = 'New Website Comment: ' . "\n\n";
// simple email content
foreach($_POST as $key => $value) {
if($key != 'submit') $email_content .= $key . ': ' . $value . "\n";
// if validation passed ok then send the email
mail($email_to, $email_subject, $email_content);
// Update form switch
$form_complete = TRUE;
function validate_email_address($email = FALSE) {
return (preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email))? TRUE : FALSE;
function remove_email_injection($field = FALSE) {
return (str_ireplace(array("\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:","to:","cc:"), '', $field));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Aanvraag formulier</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js"></script>
<script type="text/javascript" src="validation/validation.js"></script>
<script type="text/javascript">
var nameError = '<?php echo $error_messages['fullname']; ?>';
var emailError = '<?php echo $error_messages['email']; ?>';
var commentError = '<?php echo $error_messages['comment']; ?>';
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[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
</script>
<style type="text/css">
</style>
</head>
<body onload="MM_preloadImages('icons/x.png')">
<p> </p>
<p>
<?php if($form_complete === FALSE): ?>
</p>
<form action="vindditnu php version.php" method="post" enctype="application/x-www-form-urlencoded" name="Form" id="commentsform">
<h1><img src="icons/vinddit3.gif" width="220" height="80" alt="logo" /></h1>
<h1>Wat zoekt u?:</h1>
<table width="690" border="0">
<tr>
<td>In welke categorie zoekt u?*</td>
<td colspan="3"><select name="Ophalen_verzenden" id="Ophalen_verzenden">
<option selected="selected">Meubels </option>
<option>Witgoed </option>
<option>Woon accesoires </option>
<option>Kleding </option>
<option>Schoenen </option>
<option>Mode accesoires </option>
<option>Speelgoed </option>
<option>Boeken, tijdschriften, papierwaren </option>
<option>Overig </option>
</select></td>
</tr>
<tr>
<td>Kleur:* </td>
<td colspan="3"><select name="kleuren" id="kleuren">
<option>Blauw</option>
<option>Rood</option>
<option>WIt</option>
<option>Zwart</option>
<option>Beige</option>
<option>Bruin</option>
<option>Geel</option>
<option>Oranje</option>
<option>Rood</option>
<option>Metallic (Bijv. Zilver/Goud/Brons/Koper</option>
<option>Meerkleurig</option>
<option selected="selected">Overig/ N.v.t</option>
</select></td>
</tr>
<tr>
<td>Merk: </td>
<td colspan="3"><input name="Merk" type="text" id="Merk5" value="<?php echo isset($_POST['Merk'])? $_POST['Merk'] : ''; ?>" />
<?php if(in_array('Merk', $validation)): ?>
<span class="error"><?php echo $error_messages['Merk']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td>Type/Model:</td>
<td colspan="3"><input type="text" name="type" id="type" value="<?php echo isset($_POST['type'])? $_POST['type'] : ''; ?>" />
<?php if(in_array('type', $validation)): ?>
<span class="error"><?php echo $error_messages['type']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td>Materiaal: </td>
<td colspan="3"><input name="Materiaal" type="text" id="Materiaal" value="<?php echo isset($_POST['Materiaal'])? $_POST['Materiaal'] : ''; ?>" />
<?php if(in_array('Materiaal', $validation)): ?>
<span class="error"><?php echo $error_messages['Materiaal']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td>Maat: </td>
<td colspan="3"><input type="text" name="Maat" id="Maat" value="<?php echo isset($_POST['Maat'])? $_POST['Maat'] : ''; ?>" />
<?php if(in_array('Maat', $validation)): ?>
<span class="error"><?php echo $error_messages['Maat']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td>Conditie*:</td>
<td colspan="3"><select name="conditie" id="conditie" >
<option>Zo goed als nieuw</option>
<option>Nieuw</option>
<option>Bebruikt</option>
<option selected="selected">Geen voorkeur </option>
</select></td>
</tr>
<tr>
<td>Ophalen/Verzenden:*</td>
<td colspan="3"><select name="ophalen" id="ophalen">
<option>Ophalen</option>
<option>Verzenden</option>
<option>N.v.t</option>
<option>Geen voorkeur </option>
</select></td>
</tr>
<tr>
<td>Prijs Min:</td>
<td><input name="prijsmin" type="text" id="prijsmin" size="10" value="<?php echo isset($_POST['prijsmin'])? $_POST['prijsmin'] : ''; ?>" />
<?php if(in_array('prijsmin', $validation)): ?>
<span class="error"><?php echo $error_messages['prijsmin']; ?></span>
<?php endif; ?></td>
<td>Prijs Max:</td>
<td><input name="Prijs" type="text" id="Prijs" size="10" value="<?php echo isset($_POST['Prijs'])? $_POST['Prijs'] : ''; ?>" />
<?php if(in_array('Prijs', $validation)): ?>
<span class="error"><?php echo $error_messages['Prijs']; ?></span>
<?php endif; ?></td>
</tr>
</table>
<h1>Opmerkingen:</h1>
<table width="690" border="0">
<tr>
<td height="25">Opmerkingen:</td>
<td rowspan="2"><textarea name="Opmerkingen" cols="67" rows="10" id="Opmerkingen"><?php echo isset($_POST['Opmerkingen'])? $_POST['Opmerkingen'] : ''; ?></textarea>
<?php if(in_array('Opmerkingen', $validation)): ?>
<span class="error"><?php echo $error_messages['Opmerkingen']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td height="78"> </td>
</tr>
</table>
<h1>Uw Gegevens:</h1>
<table width="690" border="0">
<tr>
<td>Voornaam/Voorletters*:</td>
<td><input type="text" name="Voornaam" id="Voornaam" class='invul' value="<?php echo isset($_POST['Voornaam'])? $_POST['Voornaam'] : ''; ?>" />
<?php if(in_array('Voornaam', $validation)): ?>
<span class="error"><?php echo $error_messages['Voornaam']; ?></span>
<?php endif; ?></td>
<td>Achternaam:* </td>
<td><input type="text" name="Achternaam" id="Achternaam" class='invul' value="<?php echo isset($_POST['Achternaam'])? $_POST['Achternaam'] : ''; ?>" />
<?php if(in_array('Achternaam', $validation)): ?>
<span class="error"><?php echo $error_messages['Achternaam']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td>Straatnaam:</td>
<td><input type="text" name="Straat" id="Straat" class='invul' value="<?php echo isset($_POST['Straat'])? $_POST['Straat'] : ''; ?>" />
<?php if(in_array('Straat', $validation)): ?>
<span class="error"><?php echo $error_messages['Straat']; ?></span>
<?php endif; ?></td>
<td>Huisnummer:</td>
<td><input name="Huisnummer" type="text" id="Huisnummer" class='invul' size="10" value="<?php echo isset($_POST['Huisnummer'])? $_POST['Huisnummer'] : ''; ?>" />
<?php if(in_array('Huisnummer', $validation)): ?>
<span class="error"><?php echo $error_messages['Huisnummer']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td>Postcode:</td>
<td><input type="text" name="Postcode" id="Postcode" class='invul' value="<?php echo isset($_POST['Postcode'])? $_POST['Postcode'] : ''; ?>" />
<?php if(in_array('Postcode', $validation)): ?>
<span class="error"><?php echo $error_messages['Postcode']; ?></span>
<?php endif; ?></td>
<td>Plaats:* </td>
<td><input type="text" name="Plaats" id="Plaats" class='invul' value="<?php echo isset($_POST['Plaats'])? $_POST['Plaats'] : ''; ?>" />
<?php if(in_array('Plaats', $validation)): ?>
<span class="error"><?php echo $error_messages['Plaats']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td>Email Adres:*</td>
<td colspan="3"><input type="text" name="email" id="email" class='invul' value="<?php echo isset($_POST['email'])? $_POST['email'] : ''; ?>" />
<?php if(in_array('email', $validation)): ?>
<span class="error"><?php echo $error_messages['email']; ?></span>
<?php endif; ?></td>
</tr>
<tr>
<td>Telefoonnummer:</td>
<td colspan="3"><input name="Telefoon" type="text" id="Telefoon" class='invul' value="<?php echo isset($_POST['Telefoon'])? $_POST['Telefoon'] : ''; ?>" />
<?php if(in_array('Telefoon', $validation)): ?>
<span class="error"><?php echo $error_messages['Telefoon']; ?></span>
<?php endif; ?></td>
</tr>
</table>
<p>
<label for="Straat"></label>
<label for="Huisnummer"><br />
</label>
<input type="submit" name="Submit" id="Submit" value="Verstuur" />
<input type="reset" name="Reset" id="Reset" value="Wissen" />
</p>
</form>
<?php else: ?>
<div class="bedankt">
<p>Bedankt voor uw aanvraag!</p>
<p>Wij zullen uw aanvraag zo spoedig mogelijk behandelen. Meestal duurt dit 2 a 3 werkdagen.</p>
<p><img src="icons/vinddit3.gif" width="220" height="80" alt="logo" /></p>
</div>
<p>
<script type='text/javascript'>
setTimeout("ourRedirect()", 5000)
function ourRedirect() {
</script>
<?php endif; ?>
</body>
</html>
and .JS
window.addEvent('domready', function() {
// Get the form
var form = $('comments_form');
// if the form is found...
if (form) {
// obtain error fields
var name = $('fullname');
var email = $('email');
var comment = $('comment');
// Set the default status
var isValid = true;
// input error function for the error messages
var addError = function (field, msg) {
field.addClass('error'); // Add error class to field
var error = field.getParent().getElement('span') || new Element('span', {'class': 'error'}); // add error message if not already placed
error.set('text', msg); // error text msg
error.inject(field, 'after'); // Insert error message after field
// detach error function used to delete any error messages and remove the error class
var removeError = function (field) {
field.removeClass('error'); // Remove error class from form fields
var error = field.getParent().getElement('span'); // find any existing error messages
// destroy if error message
if (error) {
error.destroy();
// insert submit form event
form.addEvent('submit', function (e) {
// Test name length
if (name.get('value').length === 0) {
isValid = false;
addError(name, nameError);
} else {
isValid = true;
removeError(name);
// check email length
if (email.get('value').length === 0) {
isValid = false;
addError(email, emailError);
// check email validity
} else if (!email.get('value').test(/^([a-zA-Z0-9\+_\-]+)(\.[a-zA-Z0-9\+_\-]+)*@([a-zA-Z0-9\-]+\.)+ [a-zA-Z]{2,6}$/)) {
isValid = false;
addError(email, emailError);
} else {
isValid = true;
removeError(email);
// check comment length
if (comment.get('value').length === 0) {
isValid = false;
addError(comment, commentError);
} else {
isValid = true;
removeError(comment);
// If form invalid then stop event happening
if (!isValid) {
e.stop();lisavs12686 wrote:
Whould it also be possible to send the sender the submited data (looking like the filled in form or so)?
not really nessecary but whould be a nice jextra
You can but you would need to send it as an html email which is much more complicated.
What you would do is build a page/table construction like below. You would need to use the php variables to echo out the information in the <td></td> cells (example below).
$reply = $_POST['email'];
$from = '[email protected]';
$replysubject = "Auto-Reply: Website Name";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: $from\r\nReply-to: $reply";
$replymessage = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Comments from Website</title>
</head>
<body>
<table>
<tr>
<td bgcolor="#ffffff" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; padding: 10px 15px;">Name: </strong>'.$name.'
</td>
</tr>
</table>
</body>
</html>';
mail($reply, $replysubject, $replymessage, $headers); -
FrameMaker10 - Windows 7 - How to get background color for a paragraph tag?
I am trying to create my heading1 with a background like the picture above.
I have put the blue background on a master page, but the body frame goes into the blue background and subsequently the blue background does not show through.
Any ideas?
Thanks,
CindyI can't test this right now, but I remember that when extracting a TOC, table title paragraphs appear out of order when mixed with main-text-flow paragraphs, because of the way that FM keeps track of table information. I'm not sure if the problem also affects paragraphs in table cells.
Colors behind text is a frequent request. It's always a good idea to post a formal feature request here: Wishform. Eventually user requested features have been known to appear in future FM releases.
HTH
Regards,
Peter
Peter Gold
KnowHow ProServices
Arnis Gubins wrote:
Cindy, I missed the fact that you're title is centred in the block. You could use a single-cell table construct to hold the contents for the title and have the title paratag set to be in the middle of the cell. (you could also colour the cell and skip colouring on the Master page).
There are always multiple ways to do things in FM, that's why it sometimes seem so hard to use... -
I am stuck on a query and hope someone can help me out with
it. Basically I am trying to get the average score by team who has
competed in four or more events.
So far I have my query doing a join to pull in the teams name
and their category. What I want to do is be able to count the
unique locations and do an average of the four highest scores on a
field called overall.
I have tried putting a couple different COUNT in my query's
WHERE statement but it errors out.
Any ideas? Some how I have a feeling I need to create a new
table.
Thankschieffan wrote:
> I am stuck on a query and hope someone can help me out
with it. Basically I am
> trying to get the average score by team who has competed
in four or more events.
>
> So far I have my query doing a join to pull in the teams
name and their
> category. What I want to do is be able to count the
unique locations and do an
> average of the four highest scores on a field called
overall.
>
> I have tried putting a couple different COUNT in my
query's WHERE statement
> but it errors out.
>
> Any ideas? Some how I have a feeling I need to create a
new table.
>
> Thanks
You need to use GROUP BY. Will need to know more specifics
about the
table construction along with sample data, and an example of
the
expected results.
Dooza -
How to keep images fixed?
I have a website I created http://thesplitendsalons.com. I have attached a cms to it so the client can edit the left side where the editable information is contained. The right side holds the logo, links and general main info. The problem is when you go in and add more text to the part on the left so that it extends the page down, it makes the link images on the right have space between them. Is there a way to keep those images in the correct spot even when the page is extended?
Long time since I've since a table used to construct a website.
However if you are using this method as Ken says you need to house the navigation items in a seperate table vertically aligned top.
So you need to simplify the table construction - A table with 1 row and 2 columns. All the navigation/logo graphic items go in the right column (in a seperate nested table if necessary) and the all the information in the left column. Since the two columns are not 'joined at the hip like twins', they have freedom to move without affecting one another. -
Website display problems in IE and FF
hi all,
Really need some help with this website. Orginally it were
created using tables (not by me), and I have been asked to make
changes. I didnt want to redo the thing in CSS so I just added to
the tables. So far so good, I have an issue effecting the layout in
Firefox and Internet Explorer. If you check the link
http://www.acengineering.no/new_site/acc_employer.html
in both IE and FF, FF displays the layout exactly as I want it to
however IE displays the text and image blocks inwards eg, not
measuring correctly to the menu.
Does anyone have any idea how I can get IE to display the
website correctly like FF? Really really need some help here...
If this is not possible, would placing a div instead of the
main table menu suffice, and if so how would it be best to go about
this?
NB. Please excuse the inline CSS as I havent sorted this into
an external file yet. Also casually look away from the asortment
.styles; again havent got round to changing and correcting these.
1000 thx
SThe problem you have is whoever set up the tables should be
shot.
It's a very bad construction. The tables inside of the main
table
obviously add up to more than the 784px that they are
supposed to and so
IE has issue knowing what it is you want.
The easiest solution is to remove the middle nested table
(the one which
contains the iframe and image) and insert a new 1 row x 2
cols table at
840px wide in its place. Set the right cell to align right
via the
properties inspector if you're not good with code.
Then put back in the ifarme in the left cell and the image in
the right
cell.
That way it will work ok in IE.
It's a 'sticking plaster' solution. The table construction is
horrendously hideous for such a simple project.
Personally I would re-work the structure for peace of mind.
Stagtime wrote:
> hi all,
>
> Really need some help with this website. Orginally it
were created using
> tables (not by me), and I have been asked to make
changes. I didnt want to redo
> the thing in CSS so I just added to the tables. So far
so good, I have an issue
> effecting the layout in Firefox and Internet Explorer.
If you check the link
>
http://www.acengineering.no/new_site/acc_employer.html
in both IE and FF, FF
> displays the layout exactly as I want it to however IE
displays the text and
> image blocks inwards eg, not measuring correctly to the
menu.
>
> Does anyone have any idea how I can get IE to display
the website correctly
> like FF? Really really need some help here...
>
> If this is not possible, would placing a div instead of
the main table menu
> suffice, and if so how would it be best to go about
this?
>
> NB. Please excuse the inline CSS as I havent sorted this
into an external file
> yet. Also casually look away from the asortment .styles;
again havent got round
> to changing and correcting these.
>
> 1000 thx
> S
> -
Header div not displaying correctly in Explorer
Can someone help me with this IE browser problem?I have a
header div inside the container div. The container is displaying
correctly - center of page. The header div is not! It is off to the
right and half the header is off the page. All other browser tests,
Mac and PC display correctly. The header div should be centered as
it is within the container, right? The header is suppose to stay at
the top of the screen as viewer scrolls - which it does correctly.
I started with the Dreamweaver code and made some changes. Here is
my code:I can't see anything wrong with the table but I assume it has
some css
associated with it?
You might try a simple test. Create another include file with
just a
single table at 762px and one cell, with nothing apart from a
background
color.
Bring that into the original document and see what happens.
If it shows
correctly then it must be the other tables construction/css
taht is
causing the problem.
aacjp wrote:
> here is the include code:
>
> <table width="762" border="0" cellspacing="0"
cellpadding="0">
> <tr>
> <td width="114" align="left" valign="top"
bgcolor="#333333"><img
> src="/images/main/cover_masthead.jpg" alt="current
issue" width="113"
> height="150" /></td>
> <td align="center" valign="middle"
bgcolor="#C7581B"><img
> src="/images/main/masthead.gif" alt="Fabric Trends
Magazine" width="309"
> height="145" /></td>
> <td width="159" align="center" valign="middle"
bgcolor="#C7581B"><table
> width="120" border="0" cellspacing="0"
cellpadding="0">
> <tr>
> <td align="right"><a
href="/information/subscribe.shtml"
> class="nav">Subscribe</a></td>
> </tr>
> <tr>
> <td align="right"><a
href="/issues/current.shtml" class="nav">Current
> Issue</a></td>
> </tr>
> <tr>
> <td align="right"><a href="/issues/back.shtml"
class="nav">Back
> Issues</a></td>
> </tr>
> <tr>
> <td align="right"><a href="/kits/index.shtml"
class="nav">Quilt
> Kits</a></td>
> </tr>
> <tr>
> <td align="right"><a
href="/information/shops.shtml" class="nav">Quilt
> Shops</a></td>
> </tr>
> <tr>
> <td align="right"><a
href="/onlineproject/index.shtml"
> class="nav">Online Projects</a></td>
> </tr>
>
> </table></td>
> </tr>
> </table>
>
>
>
> -
Urgent: not all variable bounds in forms 6i
hi all
I am using forms 6i
I am having problem in this cursor query
SELECT distinct main_item, des_l FROM table(TECH_BOM_TOT_SRNO(:model0,'X','X','X','X','X')) a,item_master b
where a.main_item = b.ITEM_CODE
and LOCATION_cD = :line0;
it does not fetch any records.
but if i hardcode the values of bind variables as follows
SELECT distinct main_item, des_l FROM table(TECH_BOM_TOT_SRNO('MDL0000016','X','X','X','X','X')) a,item_master b
where a.main_item = b.ITEM_CODE
and LOCATION_cD = 'FRP';
it works fine
i have check the following query
SELECT count(*) fROM table(TECH_BOM_TOT_SRNO(:model0,'X','X','X','X','X')) a,item_master b
where a.main_item = b.ITEM_CODE ;
then it gives an error at runtime
ora-1008: not all variables bound..
any help to overcome this problem will be highly appriciated.
thanks......Kritika,
Oracle Forms 6i is TOO old and does not support Pipelined Functions. You will need to create a view on the database and then select from your view in order to use the Pipelined TABLE() construct.
SELECT distinct main_item, des_l
FROM table(TECH_BOM_TOT_SRNO(:model0,'X','X','X','X','X')) a, item_master b
where a.main_item = b.ITEM_CODE
and LOCATION_cD = :line0;Additionally, I don't believe you can pass a string reference to an object in place of the object name in the TABLE() function.
Do us all a favor and take a look at Oracle Forums FAQ! It is extremly helpful if you format your post to make it easier to read!
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Problem in JTable,Kindly help very urgent
I am trying to add /remove rows from JTable whose first column is JButton and others are JComboBox's.If no rows are selected,new row is added at the end.If user selects some row & then presses insert button,new row is added below it.Rows can only be deleted if user has made some selection.I am also using Icon for the button of currently active row.But i am getting exception(ArrayIndexBounds)when i try to add/delete.May be proper refreshing is not taking place.Kindly help me,where i am making mistake.If any function is to be used.My code is as follows....It is running code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import javax.swing.border.*;
import java.util.*;
public class JButtonTableExample extends JFrame implements ActionListener,TableModelListener
JComboBox mComboLHSType = new JComboBox();
JComboBox mComboRHSType = new JComboBox();
JLabel mLabelLHSType = new JLabel("LHS Type");
JLabel mLabelRHSType = new JLabel("RHS Type");
JButton mButtonDelete = new JButton("Delete");
JButton mButtonInsert = new JButton("Insert");
JButton check = new JButton("check");
JPanel mPanelButton = new JPanel();
JPanel mPanelScroll = new JPanel();
JPanel mPanelCombo = new JPanel();
DefaultTableModel dm ;
TableColumnModel modelCol;
JTable table;
JScrollPane scroll;
int currentRow = -1;
static int mSelectedRow = -1;
EachRowEditor rowEditor;
public JButtonTableExample()
super( "JButtonTable Example" );
makeForm();
setSize( 410, 222 );
setVisible(true);
private void makeForm()
this.getContentPane().setLayout(null);
mLabelLHSType.setBounds(new Rectangle(26,5,71,22));
mComboLHSType.setBounds(new Rectangle(83,5,100,22));
mLabelRHSType.setBounds(new Rectangle(232,5,71,22));
mComboRHSType.setBounds(new Rectangle(292,5,100,22));
mPanelCombo.setLayout(null);
mPanelCombo.setBorder(new LineBorder(Color.red));
mPanelCombo.setBounds(new Rectangle(1,1,400,30));
mComboRHSType.addItem("Constant");
mComboRHSType.addItem("Variable");
mComboRHSType.setSelectedIndex(0);
mComboRHSType.addActionListener(this);
mPanelCombo.add(mLabelLHSType,null);
mPanelCombo.add(mComboLHSType,null);
mPanelCombo.add(mLabelRHSType,null);
mPanelCombo.add(mComboRHSType,null);
mPanelButton.setLayout(null);
mPanelButton.setBorder(new LineBorder(Color.green));
mPanelButton.setBounds(new Rectangle(1,165,400,30));
mButtonInsert.setBounds(new Rectangle(120,5,71,22));
mButtonDelete.setBounds(new Rectangle(202,5,71,22));
mButtonDelete.addActionListener(this);
mButtonInsert.addActionListener(this);
check.setBounds(new Rectangle(3,3,71,22));
check.addActionListener(this);
mPanelButton.add(mButtonDelete,null);
mPanelButton.add(mButtonInsert,null);
mPanelButton.add(check,null);
dm = new DefaultTableModel()
public boolean isCellEditable(int row, int col)
if(row == 0 && col ==1)
return false;
return true;
dm.addTableModelListener(this);
//dm.setDataVector(null,
//new Object[]{"Button","Join","LHS","Operator","RHS"});
dm.setDataVector(new Object[][]{{"","","","",""}},
new Object[]{"","Join","LHS","Operator","RHS"});
table = new JTable(dm);
table.getTableHeader().setReorderingAllowed(false);
table.setRowHeight(25);
table.setRowSelectionInterval(0,0);
rowEditor = new EachRowEditor(table);
int columnWidth[] = {20,45,95,95,95};
mPanelScroll.setLayout(null);
mPanelScroll.setBorder(new LineBorder(Color.blue));
mPanelScroll.setBounds(new Rectangle(1,28,400,135));
scroll = new JScrollPane(table);
scroll.setBounds(new Rectangle(1,1,400,133));
mPanelScroll.add(scroll,null);
modelCol = table.getColumnModel();
for (int i=0;i<5;i++)
modelCol.getColumn(i).setPreferredWidth(columnWidth);
setCellTypes();
this.getContentPane().add(mPanelCombo,null);
this.getContentPane().add(mPanelScroll,null);
this.getContentPane().add(mPanelButton,null);
}//end of makeForm()
private void setCellTypes()
modelCol.getColumn(0).setCellRenderer(new ButtonCR());
modelCol.getColumn(0).setCellEditor(new ButtonCE(new JCheckBox()));
modelCol.getColumn(0).setResizable(false);
setUpJoinColumn(modelCol.getColumn(1));
setUpLHSColumn(modelCol.getColumn(2));
setUpOperColumn(modelCol.getColumn(3));
setUpRHSColumn(modelCol.getColumn(4));//By Default contains JTextField
public void actionPerformed(ActionEvent ae)
if (ae.getSource() == mButtonInsert)
int currentRow = table.getSelectedRow();
if(currentRow == -1)
int rowCount = dm.getRowCount();
if(rowCount == 0)
table.clearSelection();
dm.insertRow(0,new Object[]{"","","","",""});
mComboRHSType.setEnabled(true);
mButtonDelete.setEnabled(true);
dm.fireTableDataChanged();
table.setRowSelectionInterval(0,0);
else
table.clearSelection();
dm.insertRow(rowCount,new Object[]{"","","","",""});
dm.fireTableDataChanged();
table.setRowSelectionInterval(rowCount,rowCount);
else
table.clearSelection();
dm.insertRow(currentRow+1,new Object[]{"","","","",""});
dm.fireTableDataChanged();
table.setRowSelectionInterval(currentRow+1,currentRow+1);
if(table.getRowCount()>0)
table.setValueAt(new String(""),0,1);
if(ae.getSource() == mButtonDelete)
int currentRow = table.getSelectedRow();
if(currentRow != -1)
table.clearSelection();
dm.removeRow(currentRow);
if(dm.getRowCount() == 0)
mComboRHSType.setEnabled(false);
mButtonDelete.setEnabled(false);
dm.fireTableDataChanged();
else
JOptionPane.showMessageDialog(null, "Select row first", "alert", JOptionPane.ERROR_MESSAGE);
//always the first cell is empty and disabled
if(table.getRowCount()>0)
table.setValueAt(new String(""),0,1);
if(ae.getSource() == check)
int r = table.getSelectedRow();
for(int i=1;i<5;i++)
Object obj = table.getValueAt(r,i);
System.out.println("Value is"+obj.toString());
if(ae.getSource()==mComboRHSType)
System.out.println(mComboRHSType.getSelectedItem().toString());
if(table.getSelectedRow() == -1)
JOptionPane.showMessageDialog(null, "Select row first", "alert", JOptionPane.ERROR_MESSAGE);
mComboRHSType.setSelectedIndex(0);
else
if((mComboRHSType.getSelectedItem().toString()).equalsIgnoreCase("Constant"))
rowEditor.stopCellEditing();
table.setValueAt("",table.getSelectedRow(),4);
rowEditor.setEditorAt(table.getSelectedRow(), new DefaultCellEditor(new JTextField()));
table.getColumn("RHS").setCellEditor(rowEditor);
else if((mComboRHSType.getSelectedItem().toString()).equalsIgnoreCase("Variable"))
JComboBox comboBox = new JComboBox();
comboBox.addItem("Variable1");
comboBox.addItem("Constant1");
comboBox.addItem("Constant2");
rowEditor.stopCellEditing();
table.setValueAt("",table.getSelectedRow(),4);
rowEditor.setEditorAt(table.getSelectedRow(), new DefaultCellEditor(comboBox));
table.getColumn("RHS").setCellEditor(rowEditor);
}//end of actionPerformed()
public void tableChanged(TableModelEvent e)
if(e.getType()==e.DELETE)
System.out.println("DELETE CALEED called##################)");
if(e.getType()==e.INSERT)
System.out.println("INSERT CALEED called##################)");
public void setUpJoinColumn(TableColumn joinColumn)
JComboBox comboBox = new JComboBox();
comboBox.addItem("AND");
comboBox.addItem("OR");
comboBox.addItem("NOT");
joinColumn.setCellEditor(new DefaultCellEditor(comboBox));
//Set up tool tips
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setToolTipText("Click for combo box");
joinColumn.setCellRenderer(renderer);
//Set up tool tip for the header.
TableCellRenderer headerRenderer = joinColumn.getHeaderRenderer();
if (headerRenderer instanceof DefaultTableCellRenderer)
((DefaultTableCellRenderer)headerRenderer).setToolTipText("Click to see list of Join Conditions");
public void setUpLHSColumn(TableColumn LHSColumn)
JComboBox comboBox = new JComboBox();
comboBox.addItem("Participant1");
comboBox.addItem("Participant2");
comboBox.addItem("Variable1");
LHSColumn.setCellEditor(new DefaultCellEditor(comboBox));
//Set up tool tips
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setToolTipText("Click for combo box");
LHSColumn.setCellRenderer(renderer);
//Set up tool tip for the header.
TableCellRenderer headerRenderer = LHSColumn.getHeaderRenderer();
if (headerRenderer instanceof DefaultTableCellRenderer)
((DefaultTableCellRenderer)headerRenderer).setToolTipText("Click the sport to see Participants or Variables");
public void setUpOperColumn(TableColumn operColumn)
JComboBox comboBox = new JComboBox();
comboBox.addItem("=");
comboBox.addItem("!=");
comboBox.addItem("Contains");
operColumn.setCellEditor(new DefaultCellEditor(comboBox));
//Set up tool tips
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setToolTipText("Click for combo box");
operColumn.setCellRenderer(renderer);
//Set up tool tip for header.
TableCellRenderer headerRenderer = operColumn.getHeaderRenderer();
if (headerRenderer instanceof DefaultTableCellRenderer)
((DefaultTableCellRenderer)headerRenderer).setToolTipText(
"Click to see a list of operators");
public void setUpRHSColumn(TableColumn rhsColumn)
rowEditor.setEditorAt(table.getSelectedRow(), new DefaultCellEditor(new JTextField()));
rhsColumn.setCellEditor(rowEditor);
//Set up tool tips
DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
renderer.setToolTipText("Click for combo box");
rhsColumn.setCellRenderer(renderer);
public static void main(String[] args)
JButtonTableExample frame = new JButtonTableExample();
frame.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0);
}//end of program
//Button as a renderer for the table cells
class ButtonCR implements TableCellRenderer
JButton btnSelect;
public ButtonCR()
btnSelect = new JButton();
btnSelect.setMargin(new Insets(0,0,0,0));
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column)
if (column != 0) return null; //meany !!!
return btnSelect;
}//end fo ButtonCR
//Default Editor for table
class ButtonCE extends DefaultCellEditor implements ActionListener
JButton btnSelect;
JTable table;
static int selectedRow = -1;
public ButtonCE(JCheckBox whoCares)
super(whoCares);
btnSelect = new JButton();
btnSelect.setMargin(new Insets(0,0,0,0));
btnSelect.addActionListener(this);
setClickCountToStart(1);
public Component getTableCellEditorComponent(JTable table,Object value,boolean isSelected,int row,int column)
if (column != 0) return null; //meany !!!
this.selectedRow = row;
this.table = table;
System.out.println("Inside getTableCellEditorComponent");
return btnSelect;
//public Object getCellEditorValue()
//return val;
public void actionPerformed(ActionEvent e)
// Your Code Here...
System.out.println("Inside actionPerformed");
System.out.println("Action performed Row selected "+selectedRow);
btnSelect.setIcon(new ImageIcon("capsigma.gif"));
}//end of ButtonCE
class EachRowEditor implements TableCellEditor
protected Hashtable editors;
protected TableCellEditor editor, defaultEditor;
JTable table;
* Constructs a EachRowEditor.
* create default editor
* @see TableCellEditor
* @see DefaultCellEditor
public EachRowEditor(JTable table)
this.table = table;
editors = new Hashtable();
defaultEditor = new DefaultCellEditor(new JTextField());
editor = defaultEditor;
* @param row table row
* @param editor table cell editor
public void setEditorAt(int row, TableCellEditor editor)
editors.put(new Integer(row),editor);
public Component getTableCellEditorComponent(JTable table,Object value, boolean isSelected, int row, int column)
//editor = (TableCellEditor)editors.get(new Integer(row));
//if (editor == null)
// editor = defaultEditor;
return editor.getTableCellEditorComponent(table,value, isSelected, row, column);
public Object getCellEditorValue()
System.out.println("getCellEditoeValue");
return editor.getCellEditorValue();
public boolean stopCellEditing()
System.out.println("stopCellEditing");
return editor.stopCellEditing();
public void cancelCellEditing()
System.out.println("cancelCellEditing");
editor.cancelCellEditing();
public boolean isCellEditable(EventObject anEvent)
System.out.println("isCellEditable");
selectEditor((MouseEvent)anEvent);
return editor.isCellEditable(anEvent);
public void addCellEditorListener(CellEditorListener l)
System.out.println("addCellEditorListener");
editor.addCellEditorListener(l);
public void removeCellEditorListener(CellEditorListener l)
System.out.println("removeCellEditorListener");
editor.removeCellEditorListener(l);
public boolean shouldSelectCell(EventObject anEvent)
System.out.println("shouldSelect");
selectEditor((MouseEvent)anEvent);
return editor.shouldSelectCell(anEvent);
protected void selectEditor(MouseEvent e) {
int row;
if (e == null) {
row = table.getSelectionModel().getAnchorSelectionIndex();
} else {
row = table.rowAtPoint(e.getPoint());
editor = (TableCellEditor)editors.get(new Integer(row));
if (editor == null) {
editor = defaultEditor;
}//end of EachRowEditorHello!
Catch the exception in your event handler:
try {
} catch(Exception ex) { ex.printStackTrace(); }
You can now isolate the wrong line ^;
Next time if you post such a large code please use code and /code
enclosed in brackets : []; (See http://forum.java.sun.com/faq.jsp#format)
class A extends B {
public void niceCode() { -
The mechanism of DBCascade Delete is controlled by Application server or
Application server use
Database "DBCascade Delete" mechanism to do this action.
Because I use WLS6.1 "Create Default DBMSTables" mechanism to create two
tables which the
relationship is many-one. But in my MSSQL database , I find two tables
created by WLS6.1 have no any
constraint or foregin key setting for corresponding column.
And then the mechanism of DBCascade Delete do not work.
So I add the db constraint and cascade delete in MSSQL database by hand ,
and then all is fine.
In the BEA EJB20 Sample "cascadeDelete", there is the table.ddl to let us
test the sample with ORACLE.
And I find the table construction has the foregin key constraint.
If I don't set the "DBCascade Delete" option in WLS6.1 console but DB
Schema has the foregin key constraint
, so the mechanism "DBCascade Delete" does still work ??
Anyone can explain how it work in WLS 6.1 ??
Thank in advance.
Alan Chang.Alan,
This option is really only a 'convenience' feature for development and prototyping.
It really is a 'best approximation[ - - for more control, you really need to
define the schema definition 'by hand' (as you did as a prior step that worked)
Chuck Nelson
Developer Relations Engineer
BEA Support
Maybe you are looking for
-
Implementing SAP GRC CC 5.2 - Help with RTAs for SAP 4.0B & 4.6B Needed
We are in the process of implementing the SAP GRC Compliance Calibrator 5.2 across multiple environments including SAP legacy systems. Our key issue is that we cannot find any RTAs for SAP 4.0B and 4.6B. I am positive that someone has done this some
-
Oracle Portal, OWA_UTIL.redirect_url and Max Length URL
I have a question relating to the max length of a URL that can be used within Internet Explorer 5.5 and Oracle Portal (3.0.9.8.5) On IAS 9i version 1.0.2.2.2 My portal page submits to a procedure that carries out some basic DML and then uses the OWA_
-
40EA1: Transaction handling for mySQL
Hello out there, it seems that I cannot handle transactions with mySQL connections anymore. In older versions I could do something like this: /*sqldev:stmt*/begin; select * from dt_log; delete from dt_log where log_tsn=13068; /*sqldev:stmt*/rollback;
-
Using FlexNativeMenu in AIR desktop app
Hello, I am having trouble using the FlexNativeMenu component in an AIR desktop app... It seems the syntax has changed since previous versions of Flex, so I'm not sure how to get this to work. I have my menu items / data provider as: [Bindable] priva
-
Cannot use Music Store! Cannot download the problematic iTunes 7 either!
Ok. So, now there are instructions to downgrade because of all the problems because of iTunes 7.0. BUT- we cannot use the music store! I have iTunes 6.4 I think nd it will not let me use the store to buy anything. But, I cannot get iTunes 7.0 to inst