How can we use IF ELSE statement in Header Section
Hi All
I have requirement to display a bill address in header section based on a particular status ,would some body please share that is it possible to use if else in header section .
Thanks in advance
Thanks
Pratap
you cannot place your if conditions within form fields in the Word header. But you can directly type the tags instead.
Regards
Nishka
Similar Messages
-
How can i use one SQL statement to solve problem?
How can i use one SQL statement to solve the question below?
For a Table named A, there is a column named F(char type).
Now select all the records where F like '%00' and update their F value to '%01'
Just one SQL statement.Do not use PL/SQL block.
How to do that?
Thanks.What is the data volume for this table?
Do you expect lots of rows to have '%00' as their value?
Following two statements come to mind. Other experts would be able to provide better alternatives:
If you have index on SUBSTR(f, 2):
UPDATE A
SET f = SUBSTR(f,
1,
length(f) - 2) || '01'
WHERE substr(f,
-2) = '00';If most of the rows have pattern '%00':
UPDATE A
SET f = SUBSTR(f,
1,
length(f) - 2) ||
DECODE(SUBSTR(f,
-2),
'00',
'01',
SUBSTR(f,
-2)); -
How can I use a READ statement for the checking date =sydatum?
Hello,
I need use a READ statement on an internal table ITAB (with feild var1) and check whether feild var1<= sydatum(i.e. var1 greater than or equal to sy-datum)....how can I implement this??
Regards,
Shashank.Hi,
try this short example.
DATA: BEGIN OF ITAB OCCURS 0,
DATE LIKE SY-DATUM,
END OF ITAB.
ITAB-DATE = '20000101'. APPEND ITAB.
ITAB-DATE = '20010101'. APPEND ITAB.
ITAB-DATE = '20020101'. APPEND ITAB.
ITAB-DATE = '20030101'. APPEND ITAB.
ITAB-DATE = '20040101'. APPEND ITAB.
ITAB-DATE = '20050101'. APPEND ITAB.
ITAB-DATE = '20060101'. APPEND ITAB.
ITAB-DATE = '20070101'. APPEND ITAB.
ITAB-DATE = SY-DATUM. APPEND ITAB.
ITAB-DATE = '20080101'. APPEND ITAB.
LOOP AT ITAB WHERE DATE < SY-DATUM.
WRITE: / 'before', ITAB-DATE.
ENDLOOP.
LOOP AT ITAB WHERE DATE = SY-DATUM.
WRITE: / 'equal ', ITAB-DATE.
ENDLOOP.
LOOP AT ITAB WHERE DATE > SY-DATUM.
WRITE: / 'after ', ITAB-DATE.
ENDLOOP.
Regards, Dieter -
How can I use an IF statement in the SELECT
Hi People,
I have a procedure called ENQUEUE_PROC which takes 3 parameters.
and I am trying to use an if statement in the select. I appreciate the help with this task.
here is my code.
Please have a look at my Select statement. What I have does not compile, however it might give you an idea of what i need.
PROCEDURE ENQUEUE_PROC(P_SUBMISSION_ID NUMBER,
P_EVENT VARCHAR2,
CASE_TYPE_CODE NUMBER;
) AS
XMLDATA XMLTYPE;
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
message SYS.AQ$_JMS_TEXT_MESSAGE;
BEGIN
SELECT
XMLELEMENT("caseFileEvent", XMLATTRIBUTES('http://www.ussc.gov/soa/casefile/event/types' AS "xmlns",
'http://www.ussc.gov/soa/casefile/event/types' AS "xmlns:ns0"),
XMLELEMENT("caseFileUploadEvent", XMLATTRIBUTES('http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi",
'http://www.ussc.gov/soa/casefile/event/types ../xsd/Case_META.xsd' AS "xsi:schemaLocation",
'http://www.ussc.gov/soa/casefile/event/types' AS "xmlns"),
XMLELEMENT("taskEvent", P_EVENT), --eg - 'SUBMIT', 'REJECT', 'RESUBMIT'
XMLELEMENT("defendentDetails",
XMLELEMENT("sentensingDate", SMD.SENT_VIO_DATE),
XMLELEMENT("personDetails",
// Here is where I want my IF statement, *********************************
IF CASE_TYPE_CODE = 10 THEN
XMLELEMENT("personNameDetails",
XMLELEMENT("firstName", SMD.FIRST_NAME),
XMLELEMENT("middleName", SMD.MIDDLE_NAME),
XMLELEMENT("lastName", SMD.LAST_NAME)
), -- personNameDetails
ELSE
XMLELEMENT("personNameDetails",
XMLELEMENT("corpname", SMD.CORPNAME),
), -- personNameDetails
XMLELEMENT("dateOfBirth", SMD.BIRTH_DATE)
) -- personDetails
), -- defendentDetails
XMLELEMENT("documentStatusDetails",
XMLELEMENT("otherStatus",
XMLELEMENT("intCode", NULL),
XMLELEMENT("description", NULL)
) -- otherStatus
), -- documentStatusDetails
XMLELEMENT("uploadOtherDetails",
XMLELEMENT("submissionId", SUB.SUBMISSION_ID),
XMLELEMENT("submissionSessionId", SUB.SUB_SESSION_ID),
XMLELEMENT("submissionMethod",
XMLELEMENT("intCode", SUB.SUB_MTHD_CODE),
XMLELEMENT("description", SM.DESCRIP)
), -- submissionMethod
XMLELEMENT("submissionReason",
XMLELEMENT("intCode", SUB.SUB_TYPE_CODE),
XMLELEMENT("description", SR.DESCRIP)
), -- submissionReason
XMLELEMENT("district",
XMLELEMENT("intCode", SMD.DIST_ID),
XMLELEMENT("description", D.DISTRICT_NAME)
), -- district
XMLELEMENT("caseFileType",
XMLELEMENT("intCode", SUB.CASE_TYPE_CODE),
XMLELEMENT("description", C.DESCRIP)
), -- caseFileType
XMLELEMENT("primaryDocketInfo",
XMLELEMENT("yearYY", SUBSTR(SMD.DOCKET, 1, 2)),
XMLELEMENT("id", SUBSTR(SMD.DOCKET, 3, 7)),
XMLELEMENT("defendentNumber", SMD.DEF_NUM)
), -- primaryDocketInfo
XMLELEMENT("PACTSId", SMD.PACTS_ID), -- PACTSId
XMLELEMENT("AOJudgeId",
XMLELEMENT("intCode", SMD.AO_JUDGE_ID),
XMLELEMENT("description", J.LAST_NAME || ', ' || J.FIRST_NAME || ', ' || J.MIDDLE_NAME)
), -- AOJudgeId
XMLELEMENT("missingCasefile", SUB.MISSING_CASE), -- missingCasefile
XMLELEMENT("creator",
XMLELEMENT("firstName", NULL),
XMLELEMENT("lastName", NULL),
XMLELEMENT("email", SUB.CREATOR_ID),
XMLELEMENT("actionDate", REGEXP_REPLACE( TO_CHAR(SUB.CREATE_TIME, 'YYYY-MM-DD"T"HH24:MI:SS.FFTZR'), '...(......)$', '\1'))
), -- creator
XMLELEMENT("lastModifier",
XMLELEMENT("firstName", NULL),
XMLELEMENT("lastName", NULL),
XMLELEMENT("email", H.USER_ID),
XMLELEMENT("actionDate", TO_CHAR(H.ACTION_DATE, 'YYYY-MM-DD"T"HH24:MI:SS".000-05:00"'))
) -- lastModifier
) -- uploadOtherDetails
) -- caseFileUploadEvent
) -- caseFileEvent
INTO XMLDATA
FROM USSC_CASES.SUBMISSION SUB,
USSC_CASES.SUBMISSION_METADATA SMD,
USSC_CASES.CASE_HISTORY H,
LOOKUP.CASE_SUB_MTHD SM,
LOOKUP.CASE_SUB_TYPE SR,
LOOKUP.DISTRICTS D,
LOOKUP.JUDGES J,
LOOKUP.CASE_TYPES C
WHERE SUB.SUBMISSION_ID = SMD.SUBMISSION_ID
AND SUB.SUBMISSION_ID = H.SUBMISSION_ID
AND SUB.SUB_MTHD_CODE = SM.SUBMTHD_CODE
AND SUB.SUB_TYPE_CODE = SR.SUBTYPE_CODE
AND SUB.CASE_TYPE_CODE = C.CASE_TYPE_CODE
AND SMD.DIST_ID = D.USSC_DISTRICT_ID
AND SMD.AO_JUDGE_ID = J.AO_JUDGE_ID
AND H.ACTION_DATE IN (SELECT MAX(A.ACTION_DATE)
FROM USSC_CASES.CASE_HISTORY A
WHERE A.SUBMISSION_ID = P_SUBMISSION_ID)
AND SUB.SUBMISSION_ID = P_SUBMISSION_ID;
--dbms_output.put_line('queue start '|| xmldata.getclobval());
--insert into test1 values(xmldata);
message := SYS.AQ$_JMS_TEXT_MESSAGE.construct;
message.set_text(xmldata.getStringVal());
DBMS_AQ.ENQUEUE(queue_name => 'case_file_queue', -- aqadm.cases_queue
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
COMMIT;
END ENQUEUE_PROC;thanks for the help,
I believe I almost got it to compilw, however I am getting Error(29,19): PL/SQL: ORA-00918: column ambiguously defined.
Of course CASE_TYPE_CODE is ambiguously because its passed in, is there a way around this.
Here is what i have so far.
PROCEDURE ENQUEUE_PROC(P_SUBMISSION_ID NUMBER,
P_EVENT VARCHAR2,
CASE_TYPE_CODE NUMBER // passed in field
) AS
XMLDATA XMLTYPE;
enqueue_options dbms_aq.enqueue_options_t;
message_properties dbms_aq.message_properties_t;
message_handle RAW(16);
message SYS.AQ$_JMS_TEXT_MESSAGE;
BEGIN
SELECT
XMLELEMENT("caseFileEvent", XMLATTRIBUTES('http://www.ussc.gov/soa/casefile/event/types' AS "xmlns",
'http://www.ussc.gov/soa/casefile/event/types' AS "xmlns:ns0"),
XMLELEMENT("caseFileUploadEvent", XMLATTRIBUTES('http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi",
'http://www.ussc.gov/soa/casefile/event/types ../xsd/Case_META.xsd' AS "xsi:schemaLocation",
'http://www.ussc.gov/soa/casefile/event/types' AS "xmlns"),
XMLELEMENT("taskEvent", P_EVENT), --eg - 'SUBMIT', 'REJECT', 'RESUBMIT'
XMLELEMENT("defendentDetails",
XMLELEMENT("sentensingDate", SMD.SENT_VIO_DATE),
CASE
WHEN CASE_TYPE_CODE = 10 THEN
XMLELEMENT("personDetails",
XMLELEMENT("personNameDetails",
XMLELEMENT("firstName", SMD.FIRST_NAME),
XMLELEMENT("middleName", SMD.MIDDLE_NAME),
XMLELEMENT("lastName", SMD.LAST_NAME)
), -- personNameDetails
XMLELEMENT("dateOfBirth", SMD.BIRTH_DATE)
) -- personDetails
ELSE
XMLELEMENT("corporationDetails",
XMLELEMENT("organizationName", SMD.CORP_NAME)
) -- corporationDetails
END
), -- defendentDetails
XMLELEMENT("documentStatusDetails",
XMLELEMENT("otherStatus",
XMLELEMENT("intCode", NULL),
XMLELEMENT("description", NULL)
) -- otherStatus
), -- documentStatusDetails
XMLELEMENT("uploadOtherDetails",
XMLELEMENT("submissionId", SUB.SUBMISSION_ID),
XMLELEMENT("submissionSessionId", SUB.SUB_SESSION_ID),
XMLELEMENT("submissionMethod",
XMLELEMENT("intCode", SUB.SUB_MTHD_CODE),
XMLELEMENT("description", SM.DESCRIP)
), -- submissionMethod
XMLELEMENT("submissionReason",
XMLELEMENT("intCode", SUB.SUB_TYPE_CODE),
XMLELEMENT("description", SR.DESCRIP)
), -- submissionReason
XMLELEMENT("district",
XMLELEMENT("intCode", SMD.DIST_ID),
XMLELEMENT("description", D.DISTRICT_NAME)
), -- district
XMLELEMENT("caseFileType",
XMLELEMENT("intCode", SUB.CASE_TYPE_CODE),
XMLELEMENT("description", C.DESCRIP)
), -- caseFileType
XMLELEMENT("primaryDocketInfo",
XMLELEMENT("yearYY", SUBSTR(SMD.DOCKET, 1, 2)),
XMLELEMENT("id", SUBSTR(SMD.DOCKET, 3, 7)),
XMLELEMENT("defendentNumber", SMD.DEF_NUM)
), -- primaryDocketInfo
XMLELEMENT("PACTSId", SMD.PACTS_ID), -- PACTSId
XMLELEMENT("AOJudgeId",
XMLELEMENT("intCode", SMD.AO_JUDGE_ID),
XMLELEMENT("description", J.LAST_NAME || ', ' || J.FIRST_NAME || ', ' || J.MIDDLE_NAME)
), -- AOJudgeId
XMLELEMENT("missingCasefile", SUB.MISSING_CASE), -- missingCasefile
XMLELEMENT("creator",
XMLELEMENT("firstName", NULL),
XMLELEMENT("lastName", NULL),
XMLELEMENT("email", SUB.CREATOR_ID),
XMLELEMENT("actionDate", REGEXP_REPLACE( TO_CHAR(SUB.CREATE_TIME, 'YYYY-MM-DD"T"HH24:MI:SS.FFTZR'), '...(......)$', '\1'))
), -- creator
XMLELEMENT("lastModifier",
XMLELEMENT("firstName", NULL),
XMLELEMENT("lastName", NULL),
XMLELEMENT("email", H.USER_ID),
XMLELEMENT("actionDate", TO_CHAR(H.ACTION_DATE, 'YYYY-MM-DD"T"HH24:MI:SS".000-05:00"'))
) -- lastModifier
) -- uploadOtherDetails
) -- caseFileUploadEvent
) -- caseFileEvent
INTO XMLDATA
FROM USSC_CASES.SUBMISSION SUB,
USSC_CASES.SUBMISSION_METADATA SMD,
USSC_CASES.CASE_HISTORY H,
LOOKUP.CASE_SUB_MTHD SM,
LOOKUP.CASE_SUB_TYPE SR,
LOOKUP.DISTRICTS D,
LOOKUP.JUDGES J,
LOOKUP.CASE_TYPES C
WHERE SUB.SUBMISSION_ID = SMD.SUBMISSION_ID
AND SUB.SUBMISSION_ID = H.SUBMISSION_ID
AND SUB.SUB_MTHD_CODE = SM.SUBMTHD_CODE
AND SUB.SUB_TYPE_CODE = SR.SUBTYPE_CODE
AND SUB.CASE_TYPE_CODE = C.CASE_TYPE_CODE
AND SMD.DIST_ID = D.USSC_DISTRICT_ID
AND SMD.AO_JUDGE_ID = J.AO_JUDGE_ID
AND H.ACTION_DATE IN (SELECT MAX(A.ACTION_DATE)
FROM USSC_CASES.CASE_HISTORY A
WHERE A.SUBMISSION_ID = P_SUBMISSION_ID)
AND SUB.SUBMISSION_ID = P_SUBMISSION_ID;
--dbms_output.put_line('queue start '|| xmldata.getclobval());
--insert into test1 values(xmldata);
message := SYS.AQ$_JMS_TEXT_MESSAGE.construct;
message.set_text(xmldata.getStringVal());
DBMS_AQ.ENQUEUE(queue_name => 'case_file_queue', -- aqadm.cases_queue
enqueue_options => enqueue_options,
message_properties => message_properties,
payload => message,
msgid => message_handle);
COMMIT;
END ENQUEUE_PROC;Edited by: Rooney on Jan 31, 2012 1:55 PM -
How can I use control break statement in my requirement
Hi ABAPers,
In my requirement, I have 4 fields in sorted internal table, (audat, prdha, ipnum, netwr). In that i need to do summation of netwr field falling under same prdha(BU) for the same month
internal table fields :
audat prdha ipnum netwr
02 abc 1 100
02 abc 2 200
02 xyz 3 300
03 abc 4 100
03 xyz 5 300
03 xyz 6 200
i need output like this:
audat prdha ipnum netwr
02 abc 1,2 300
02 xyz 3 300
03 abc 4 100
03 xyz 5,6 500
Can anyone suggest me logic for this by using control break statements
Thanks in advance,
Ankita
Moderator Message: Duplciate Post.
Edited by: kishan P on Apr 14, 2011 3:03 PMHi ABAPers,
In my requirement, I have 4 fields in sorted internal table, (audat, prdha, ipnum, netwr). In that i need to do summation of netwr field falling under same prdha(BU) for the same month
internal table fields :
audat prdha ipnum netwr
02 abc 1 100
02 abc 2 200
02 xyz 3 300
03 abc 4 100
03 xyz 5 300
03 xyz 6 200
i need output like this:
audat prdha ipnum netwr
02 abc 1,2 300
02 xyz 3 300
03 abc 4 100
03 xyz 5,6 500
Can anyone suggest me logic for this by using control break statements
Thanks in advance,
Ankita
Moderator Message: Duplciate Post.
Edited by: kishan P on Apr 14, 2011 3:03 PM -
How can i use multiple row subquery in update statement
Hai All
I using group function in my update statement.. and i need to update more rows so i need to use multiple row
subquery pls tell me how to use multiple row subquery in update statement
For example
while i am using this like this i got an error
update dail_att set outtime in (select max(r2.ptime) from temp_att where empcode=r2.enpno and
barcode=r2.cardn and attend_date=r2.pdate group by enpno,pdate,cardn);
Pls tell me how to use with example
Thanks & regards
Srikkanth.MHai Man
Thanks for ur response Let me clear what i need
First step Fetch the records as text file and stores into table T1
and the next step is i have seperated the text using substring and stores in different columns of a table
There are two shifts 0815 to 1645 and 1200 and 2000
Here I rep IN and O rep OUT
Empno date time inout
001 01-01-10 0815 I
002 01-01-10 0815 I
003 01-01-10 0818 I
001 01-01-10 1100 0
001 01-01-10 1130 I
002 01-01-10 1145 0
002 01-01-10 1215 I
004 01-01-10 1200 I
005 01-01-10 1215 I
004 01-01-10 1315 O
004 01-01-10 1345 I
001 01-01-10 1645 0
002 01-01-10 1715 0
003 01-01-10 1718 0
004 01-01-10 2010 0
005 01-01-10 2015 0
This is my T1 table i have taken data from text file and stored in this table from this table i need to move data to another table T2
T2 contains like this
Empno Intime Intrin Introut Outtime Date
001 0815 1100 1130 1645 01-01-10
002 0815 1145 1215 1715 01-01-10
003 0818 1718 01-01-10
004 1200 1315 1345 2010 01-01-10
005 1215 2015 01-01-10
This what i am trying to do man but i have little bit problems Pls give some solution with good example
And my coding is
declare
emp_code varchar2(25);
in_time varchar2(25);
out_time varchar2(25);
Cursor P1 is
Select REASON,ECODE,READMODE,EMPD,ENPNO,FILL,PDATE,PTIME,INOUT,CARDN,READERN
From temp_att
group by REASON,ECODE,READMODE,EMPD,ENPNO,FILL,PDATE,PTIME,INOUT,CARDN,READERN
ORDER BY enpno,pdate,ptime;
begin
for r2 in p1 loop
declare
bar_code varchar2(25);
begin
select barcode into bar_code from dail_att where empcode=r2.enpno and attend_date=r2.pdate;
For r3 in (select empcode,empname,barcode,intime,intrin,introut,addin,addout,outtime,attend_date from dail_att)loop
if r2.inout ='O' then
update dail_att set outtime =(select max(r2.ptime) from temp_att where empcode=r2.enpno and barcode=r2.cardn and attend_date=r2.pdate group by r2.cardn,r2.enpno,r2.pdate );
end if;
end loop;
exception
when no_data_found then
if r2.inout ='I' then
insert into dail_att(barcode,empcode,intime,attend_date)(select r2.cardn,r2.enpno,min(r2.ptime),r2.pdate from temp_att group by r2.cardn,r2.enpno,r2.pdate );
end if;
end;
end loop;
commit;
end;
Pls tell me what correction i need to do i the update statement i have used a subquery with group function but when i used it will return only one row but my need is to return many rows and i need to use multiple row subquery
and how can i use it in the update statement
Thanks In Advance
Srikkanth.M -
Hi:
Can I use a solid state drive (SSD) with a G4 1 GHz powerbook? If so, how do I do it? Thanks.
fromx001fromx001 I believe you can use a SSD as internal drive, of course make sure to buy an ide/ata. There are all sorts of sizes up to 480 GB also in the ide/ata standard. You should however research carefully your purchase, as the performances of your SSD are going to have to rely on firmware "garbage collection", as the older operating systems haven't been written with SSD in mind.
Mac Man JW: some people depend on Classic as a brody said, other people need a phone modem from time to time, other people use the laptop in harsh environments, and at -15C and below, LCD screens easily crack and break; NOT the powerbook which has hot air towards the screen (and it's a machine that heats quite a lot). My alu Powerbook 12", which was *not* treated with velvet gloves, only once had a cracked screen: a cleaning lady had stepped over it (!!!!) no joke. And in normal / light use today, it is still pretty decent and usable. -
I was using an iPhone 4 while I was living in Japan. How can I use it in the states now that I live here? It is a perfectly good phone and I don't want to use it only as an iPod and camera.
That's one option. The other is to sell it (you can probably get close to what you paid for it) or trade it in and get a new unlocked phone directly from an Apple store. That way you can use it in the US, and also in Japan when you return there.
-
dumb question i know, can i use someone else's computer to upgrade to OS6? i dont have vista.
If you currently have iOS 5, you don't neet a computer. Settings>General>Software Update
-
How can I use XStream to persist complicated Java Object to XML & backward
Dear Sir:
I met a problem as demo in my code below when i use XTream to persist my Java Object;
How can I use XStream to persist complicated Java Object to XML & backward??
See
[1] main code
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
public class PhoneList {
ArrayList<PhoneNumber> phones;
ArrayList<Person> person;
private PhoneList myphonelist ;
private LocationTest location;
private PhoneList(String name) {
phones = new ArrayList<PhoneNumber>();
person = new ArrayList<Person>();
public ArrayList<PhoneNumber> getphones() {
return phones;
public ArrayList<Person> getperson() {
return person;
public void addPhoneNumber(PhoneNumber b1) {
this.phones.add(b1);
public void removePhoneNumber(PhoneNumber b1) {
this.phones.remove(b1);
public void addPerson(Person p1) {
this.person.add(p1);
public void removePerson(Person p1) {
this.person.remove(p1);
public void BuildList(){
location = new LocationTest();
XStream xstream = new XStream();
myphonelist = new PhoneList("PhoneList");
Person joe = new Person("Joe, Wallace");
joe.setPhone(new PhoneNumber(123, "1234-456"));
joe.setFax(new PhoneNumber(123, "9999-999"));
Person geo= new Person("George Nixson");
geo.setPhone(new PhoneNumber(925, "228-9999"));
geo.getPhone().setLocationTest(location);
myphonelist.addPerson(joe);
myphonelist.addPerson(geo);
public PhoneList(){
XStream xstream = new XStream();
BuildList();
saveStringToFile("C:\\temp\\test\\PhoneList.xml",convertToXML(myphonelist));
public void saveStringToFile(String fileName, String saveString) {
BufferedWriter bw = null;
try {
bw = new BufferedWriter(
new FileWriter(fileName));
try {
bw.write(saveString);
finally {
bw.close();
catch (IOException ex) {
ex.printStackTrace();
//return saved;
public String getStringFromFile(String fileName) {
BufferedReader br = null;
StringBuilder sb = new StringBuilder();
try {
br = new BufferedReader(
new FileReader(fileName));
try {
String s;
while ((s = br.readLine()) != null) {
// add linefeed (\n) back since stripped by readline()
sb.append(s + "\n");
finally {
br.close();
catch (Exception ex) {
ex.printStackTrace();
return sb.toString();
public String convertToXML(PhoneList phonelist) {
XStream xstream = new XStream(new DomDriver());
xstream.setMode(xstream.ID_REFERENCES) ;
return xstream.toXML(phonelist);
public static void main(String[] args) {
new PhoneList();
}[2].
import java.io.Serializable;
import javax.swing.JFrame;
public class PhoneNumber implements Serializable{
private String phone;
private String fax;
private int code;
private String number;
private String address;
private String school;
private LocationTest location;
public PhoneNumber(int i, String str) {
setCode(i);
setNumber(str);
address = "4256, Washington DC, USA";
school = "Washington State University";
public Object getPerson() {
return null;
public void setPhone(String phone) {
this.phone = phone;
public String getPhone() {
return phone;
public void setFax(String fax) {
this.fax = fax;
public String getFax() {
return fax;
public void setCode(int code) {
this.code = code;
public int getCode() {
return code;
public void setNumber(String number) {
this.number = number;
public String getNumber() {
return number;
public void setLocationTest(LocationTest bd) {
this.location = bd;
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(location);
f.getContentPane().add(location.getControls(), "Last");
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
public LocationTest getLocationTest() {
return location;
}[3].
package test.temp;
import java.io.Serializable;
public class Person implements Serializable{
private String fullname;
@SuppressWarnings("unused")
private PhoneNumber phone;
@SuppressWarnings("unused")
private PhoneNumber fax;
public Person(){
public Person(String fname){
fullname=fname;
public void setPhone(PhoneNumber phoneNumber) {
phone = phoneNumber;
public void setFax(PhoneNumber phoneNumber) {
fax = phoneNumber;
public PhoneNumber getPhone() {
return phone ;
public PhoneNumber getFax() {
return fax;
public String getName() {
return fullname ;
public void setName(String name) {
this.fullname = name;
public String toString() {
return getName();
}[4]. LocationTest.java
package test.temp;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.event.*;
public class LocationTest extends JPanel implements ChangeListener
Ellipse2D.Double ball;
Line2D.Double line;
JSlider translate;
double lastTheta = 0;
public void stateChanged(ChangeEvent e)
JSlider slider = (JSlider)e.getSource();
String name = slider.getName();
int value = slider.getValue();
if(name.equals("rotation"))
tilt(Math.toRadians(value));
else if(name.equals("translate"))
moveBall(value);
repaint();
protected void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
if(ball == null)
initGeom();
g2.setPaint(Color.green.darker());
g2.draw(line);
g2.setPaint(Color.red);
g2.fill(ball);
private void initGeom()
int w = getWidth();
int h = getHeight();
int DIA = 30;
int padFromEnd = 5;
line = new Line2D.Double(w/4, h*15/16, w*3/4, h*15/16);
double x = line.x2 - padFromEnd - DIA;
double y = line.y2 - DIA;
ball = new Ellipse2D.Double(x, y, DIA, DIA);
// update translate slider values
int max = (int)line.getP1().distance(line.getP2());
translate.setMaximum(max);
translate.setValue(max-padFromEnd);
private void tilt(double theta)
// rotate line from left end
Point2D pivot = line.getP1();
double lineLength = pivot.distance(line.getP2());
Point2D.Double p2 = new Point2D.Double();
p2.x = pivot.getX() + lineLength*Math.cos(theta);
p2.y = pivot.getY() + lineLength*Math.sin(theta);
line.setLine(pivot, p2);
// find angle from pivot to ball center relative to line
// ie, ball center -> pivot -> line end
double cx = ball.getCenterX();
double cy = ball.getCenterY();
double pivotToCenter = pivot.distance(cx, cy);
// angle of ball to horizon
double dy = cy - pivot.getY();
double dx = cx - pivot.getX();
// relative angle phi = ball_to_horizon - last line_to_horizon
double phi = Math.atan2(dy, dx) - lastTheta;
// rotate ball from pivot
double x = pivot.getX() + pivotToCenter*Math.cos(theta+phi);
double y = pivot.getY() + pivotToCenter*Math.sin(theta+phi);
ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
lastTheta = theta; // save theta for next time
private void moveBall(int distance)
Point2D pivot = line.getP1();
// ball touches line at distance from pivot
double contactX = pivot.getX() + distance*Math.cos(lastTheta);
double contactY = pivot.getY() + distance*Math.sin(lastTheta);
// find new center location of ball
// angle lambda = lastTheta - 90 degrees (anti-clockwise)
double lambda = lastTheta - Math.PI/2;
double x = contactX + (ball.width/2)*Math.cos(lambda);
double y = contactY + (ball.height/2)*Math.sin(lambda);
ball.setFrameFromCenter(x, y, x+ball.width/2, y+ball.height/2);
JPanel getControls()
JSlider rotate = getSlider("rotation angle", "rotation", -90, 0, 0, 5, 15);
translate = getSlider("distance from end", "translate", 0, 100, 100,25, 50);
JPanel panel = new JPanel(new GridLayout(0,1));
panel.add(rotate);
panel.add(translate);
return panel;
private JSlider getSlider(String title, String name, int min, int max,
int value, int minorSpace, int majorSpace)
JSlider slider = new JSlider(JSlider.HORIZONTAL, min, max, value);
slider.setBorder(BorderFactory.createTitledBorder(title));
slider.setName(name);
slider.setPaintTicks(true);
slider.setMinorTickSpacing(minorSpace);
slider.setMajorTickSpacing(majorSpace);
slider.setPaintLabels(true);
slider.addChangeListener(this);
return slider;
}OK, My questions are:
[1]. what I generated XML by XSTream is very complicated, especially for object LocationTest, Can we make it as simple as others such as Person object??
[2]. after I run it, LocationTest will popup and a red ball in a panel will dsiplay, after I change red ball's position, I hope to persist it to xml, then when I read it back, I hope to get same picture, ie, red ball stiil in old position, How to do that??
Thanks a lot!!Positive feedback? Then please take this in a positive way: if you want to work on persisting Java objects into XML, then GUI programming is irrelevant to that goal. The 1,000 lines of code you posted there appeared to me to have a whole lot of GUI code in it. You should produce a smaller (much smaller) example of what you want to do. Calling the working code from your GUI program should come later.
-
How can I use a 3rd party XML parser such as xerces with OC4J ?
Hi all tech experts,
I am using Oracle Application Server 10g Release 2 (10.1.2) and i have
installed Portal and Wireless and OracleAS Infrastructure on the same
computer.
i tried all the solutions on this thread
Use of Xerces Parser in out application with Oracle App Server 9.0.4
but still fighting.
I have also posted this query on OTN on following thread
How can I use a 3rd party XML parser such as xerces with OC4J?
but no reply....
Please help me on this issue.
Since OC4J is preconfigured to use the Oracle XML parser which is xmlparserv2.jar.
i have read the following article which states that
OC4J is preconfigured to use the Oracle XML parser. The Oracle XML parser is fully JAXP 1.1 compatible and will serve the needs of applications which require JAXP functionality. This approach does not require the download, installation, and configuration of additional XML parsers.
The Oracle XML parser (xmlparserv2.jar) is configured to load as a system level library of OC4J through it's inclusion as an entry in the Class-Path entry of the oc4j.jar Manifest.mf file. This results in the Oracle XML parser being used for all common deployment and packaging situations. You are not permitted to modify the Manifest.mf file of oc4j.jar.
It must be noted that configuring OC4J to run with any additional XML parser or JDBC library is not a supported configuration. We do know customers who have managed to successfully replace the system level XML parser and the Oracle JDBC drivers that ship with the product, but we do not support this type of configuration due to the possibility of unexpected system behavior and system errors that might occur from replacing the tested and certified libraries.
If you absolutely must use an additional XML parser such as xerces, then you have to start OC4J such that the xerces.jar file is loaded at a level above the OC4J system classpath. This can be accomplished using the -Xbootclasspath flag of the JRE.
i have also run the following command
java -Xbootclasspath/a:d:\xerces\xerces.jar -jar oc4j.jar
but no success.
How could i utilize my jar's like xerces.jar and xalan.jar for parsing instead of OC4J in-built parser ?
All reply will be highly appreciated.
Thnx in advance to all.
Neeraj Sidhaye
try_catch_finally @ Y !Hi Neeraj Sidhaye,
I am trying to deploy a sample xform application to the Oracle Application Server (10.1.3). However, I encountered the class loader issue that is similar to your stuation. I tried all the three solutions but the application is still use the Oracle xml paser class. I am wondering if you have any insight about this?
Thanks for your help.
Xingsheng Qian
iPass Inc.
Here is the error message I got.
Message:
java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
Stack Trace:
org.chiba.xml.xforms.exception.XFormsException: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
at org.chiba.xml.xforms.Container.dispatch(Unknown Source)
at org.chiba.xml.xforms.Container.initModels(Unknown Source)
at org.chiba.xml.xforms.Container.init(Unknown Source)
at org.chiba.xml.xforms.ChibaBean.init(Unknown Source)
at org.chiba.adapter.servlet.ServletAdapter.init(ServletAdapter.java:153)
at org.chiba.adapter.servlet.ChibaServlet.doGet(ChibaServlet.java:303)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement
at org.chiba.xml.xforms.Instance.iterateModelItems(Unknown Source)
at org.chiba.xml.xforms.Bind.initializeModelItems(Unknown Source)
at org.chiba.xml.xforms.Bind.init(Unknown Source)
at org.chiba.xml.xforms.Initializer.initializeBindElements(Unknown Source)
at org.chiba.xml.xforms.Model.modelConstruct(Unknown Source)
at org.chiba.xml.xforms.Model.performDefault(Unknown Source)
at org.chiba.xml.xforms.XFormsDocument.performDefault(Unknown Source)
at org.chiba.xml.xforms.XFormsDocument.dispatchEvent(Unknown Source)
at org.apache.xerces.dom.NodeImpl.dispatchEvent(Unknown Source)
... 18 more -
How can I use multiple row insert or update into DB in JSP?
Hi all,
pls help for my question.
"How can I use multiple rows insert or update into DB in JSP?"
I mean I will insert or update the multiple records like grid component. All the data I enter will go into the DB.
With thanks,That isn't true. Different SQL databases have
different capabilities and use different syntax, That's true - every database has its own quirks and extensions. No disagreement there. But they all follow ANSI SQL for CRUD operations. Since the OP said they wanted to do INSERTs and UPDATEs in batches, I assumed that ANSI SQL was sufficient.
I'd argue that it's best to use ANSI SQL as much as possible, especially if you want your JDBC code to be portable between databases.
and there are also a lot of different ways of talking to
SQL databases that are possible in JSP, from using
plain old java.sql.* in scriptlets to using the
jstlsql taglib. I've done maintenance on both, and
they are as different as night and day.Right, because you don't maintain JSP and Java classes the same way. No news there. Both java.sql and JSTL sql taglib are both based on SQL and JDBC. Same difference, except that one uses tags and the other doesn't. Both are Java JDBC code in the end.
Well, sure. As long as you only want to update rows
with the same value in column 2. I had the impression
he wanted to update a whole table. If he only meant
update all rows with the same value in a given column
with the same value, that's trivial. All updates do
that. But as far as I know there's know way to update
more than one row where the values are different.I used this as an example to demonstrate that it's possible to UPDATE more than one row at a time. If I have 1,000 rows, and each one is a separate UPDATE statement that's unique from all the others, I guess I'd have to write 1,000 UPDATE statements. It's possible to have them all either succeed or fail as a single unit of work. I'm pointing out transaction, because they weren't coming up in the discussion.
Unless you're using MySQL, for instance. I only have
experience with MySQL and M$ SQL Server, so I don't
know what PostgreSQL, Oracle, Sybase, DB2 and all the
rest are capable of, but I know for sure that MySQL
can insert multiple rows while SQL Server can't (or at
least I've never seen the syntax for doing it if it
does).Right, but this syntax seems to be specific to MySQL The moment you use it, you're locked into MySQL. There are other ways to accomplish the same thing with ANSI SQL.
Don't assume that all SQL databases are the same.
They're not, and it can really screw you up badly if
you assume you can deploy a project you've developed
with one database in an environment where you have to
use a different one. Even different versions of the
same database can have huge differences. I recommend
you get a copy of the O'Reilly book, SQL in a
Nutshell. It covers the most common DBMSes and does a
good job of pointing out the differences.Yes, I understand that.
It's funny that you're telling me not to assume that all SQL databases are the same. You're the one who's proposing that the OP use a MySQL-specific extension.
I haven't looked at the MySQL docs to find out how the syntax you're suggesting works. What if one value set INSERT succeeds and the next one fails? Does MySQL roll back the successful INSERT? Is the unit of work under the JDBC driver's control with autoCommit?
The OP is free to follow your suggestion. I'm pointing out that there are transactions for units of work and ANSI SQL ways to accomplish the same thing. -
Bought a new Ipod for daughter for Xmas. How can I use ICLOUD to sync Itunes only to her IPOD
Bought a new Ipod for daughter for Xmas. How can I use ICLOUD to sync Itunes only to her IPOD and not everything else on my iphone etc?
On the iPod turn off iCloud for calender, contacts and other things (Settings>iCloud) and turn off automatic downloading for apps and books (Settings>Store).
Aldso go to Settings Messages and Facetime and add her own email calling/messaging address and delete the Apple ID calling/messaging address. -
How can i use the same cursor in a loop fro multipletimes.
I am using two cursors.One to fetch sites and the other to fetch participants under each site.I am performing some job with that participants data.Now the problem is i am using the 2nd cursor in a loop.So it fetches the data of participants falling under one state.But when it comes to the second state,as the second cursor is already open it is unable to fetch the records.Please help me .How can i use the same cursor in a loop fro multipletimes.
I am sending the code which i have written in When-Button-Pressed-Trigger...
declare
sid number;
pid number;
cursor csid is select distinct(site_id) from cyber_ppt;
cursor cpid is select pc_id,st_dt,ed_dt from cyber_ppt where site_id = sid;
stdt varchar2(10);
eddt varchar2(10);
nom number;
stmonth varchar2(10);
edmonth varchar2(10);
cjan number:=0;
cfeb number:=0;
cmar number:=0;
capr number:=0;
cmay number:=0;
cjun number:=0;
cjul number:=0;
caug number:=0;
csep number:=0;
coct number:=0;
cnov number:=0;
cdec number:=0;
i number:=1;
begin
open csid ;
loop
fetch csid into sid;
exit when csid %notfound;
message(sid);
open cpid;
loop
fetch cpid into pid,stdt,eddt ;
exit when cpid %notfound;
message(sid||'-'||pid);
stmonth:=substr(stdt,4,3);
edmonth:=substr(eddt,4,3);
nom:= months_between(eddt,stdt);
while i <= round(nom)
loop
stmonth:=substr(stdt,4,3);
if stmonth='JAN' then
cjan:=cjan+1;
elsif stmonth='FEB' then
cfeb:=cfeb+1;
elsif stmonth='MAR' then
cmar:=cmar+1;
elsif stmonth='APR' then
capr:=capr+1;
elsif stmonth='MAY' then
cmay:=cmay+1;
elsif stmonth='JUN' then
cjun:=cjun+1;
elsif stmonth ='JUL' then
cjul:=cjul+1;
elsif stmonth ='AUG' then
caug:=caug+1;
elsif stmonth ='SEP' then
csep:=csep+1;
elsif stmonth ='OCT' then
coct:=coct+1;
elsif stmonth ='NOV' then
cnov:=cnov+1;
elsif stmonth ='DEC' then
cdec:=cdec+1;
end if;
stdt:=add_months(stdt,1);
i:=i+1;
end loop;
end loop;
end loop;
end;
try this /* untested */
DECLARE
sid NUMBER;
pid NUMBER;
CURSOR csid IS SELECT DISTINCT(site_id) FROM cyber_ppt;
CURSOR cpid(nSid NUMBER) is SELECT pc_id,st_dt,ed_dt FROM cyber_ppt WHERE site_id = nSid;
stdt VARCHAR2(10);
eddt VARCHAR2(10);
nom NUMBER;
stmonth VARCHAR2(10);
edmonth VARCHAR2(10);
cjan NUMBER:=0;
cfeb NUMBER:=0;
cmar NUMBER:=0;
capr NUMBER:=0;
cmay NUMBER:=0;
cjun NUMBER:=0;
cjul NUMBER:=0;
caug NUMBER:=0;
csep NUMBER:=0;
coct NUMBER:=0;
cnov NUMBER:=0;
cdec NUMBER:=0;
i NUMBER:=1;
BEGIN
FOR rec IN csid
LOOP
sid := rec.csid;
FOR cRec IN cpid(sid)
LOOP
pid := cRec.pc_id;
stdt := cRec.st_dt;
eddt := cRec.ed_dt;
stmonth:= SUBSTR(stdt,4,3);
edmonth:= SUBSTR(eddt,4,3);
nom:= months_between(eddt,stdt);
WHILE i <= round(nom)
LOOP
stmonth := SUBSTR(stdt,4,3);
IF stmonth='JAN'
THEN
cjan:=cjan+1;
ELSIF stmonth='FEB' THEN
cfeb:=cfeb+1;
ELSIF stmonth='MAR' THEN
cmar:=cmar+1;
ELSIF stmonth='APR' THEN
capr:=capr+1;
ELSIF stmonth='MAY' THEN
cmay:=cmay+1;
ELSIF stmonth='JUN' THEN
cjun:=cjun+1;
ELSIF stmonth ='JUL' THEN
cjul:=cjul+1;
ELSIF stmonth ='AUG' THEN
caug:=caug+1;
ELSIF stmonth ='SEP' THEN
csep:=csep+1;
ELSIF stmonth ='OCT' THEN
coct:=coct+1;
ELSIF stmonth ='NOV' THEN
cnov:=cnov+1;
ELSIF stmonth ='DEC' THEN
cdec:=cdec+1;
END IF;
stdt:=add_months(stdt,1);
i:=i+1;
END LOOP;
END LOOP;
END LOOP;
END; -
How can i use a second router to replace verizon fios router?
Okay so just as the title says how do i use a second router? I got a cisco valet router... I don't know how to use it because the verizon router/modem is wierd i know how to use a router if i only had a modem but fios gives router/modem so how can i use my 2nd router? The current verizon fios router/modem is b/g mode and i wanna change to b/g/n so i can get a better speed from my internet... SO how can i use my 2nd router? I tried this http://www.dslreports.com/faq/verizonfios/3.0_Networking#12506 but i don't get it can someone guide me better or make a video explaination on how to use a 2nd router? I have it connected with see as in pic i connect from my router Internet port to wan port and the ethernet lan port to the ethernet lan port on verizon fios and no work please help...
OK, so with this, we have a few options. You appear to have a MoCa connection to the ONT, hence the coaxial cable being present.
1: The ActionTec can be bridged to the Valet router. This will not require any additional cabling, however it will require a small amount of work to have working. You will also require the ActionTec still in the mix, even though it will not be acting as a router anymore with this configuration.
Visit http://www.dslreports.com/faq/16077 and look at Option 4. There is a thread linked that will allow you to set up the ActionTec as just a MoCa bridge, and will pass the Public IP to your router. You will, in order for this to work once the ActionTec is bridged, need to connect the cable from your Valet router's Internet port, to the ActionTec's LAN port and nothing else goes to the ActionTec. From this point, your Valet should run as your primary and everything should connect through your Valet. If you are adding another router, a Netgear N300, you should perform the LAN to LAN setup, which we will talk about once you've got the Valet working correctly. LAN to LAN configs require a custom setup, so do not set up the Netgear for now.
2: This is my preferred method, which would be to run an Ethernet cable to the ONT. Option 6 in the FAQ. This will require spaking to Verizon to have them move your ONT to Ethernet, but once they do this, you can disconnect the Coaxial Cable from your ActionTec router, and plug in your CAT5/CAT6 cable from the ONT to the ActionTec's Internet/WAN port. Use the ActionTec to ensure everything is working after the switchover, and once off the phone, log into the ActionTec, perform a DHCP Release, and then prompty power off the ActionTec. Once this is done, plug the CAT6 cable into your Valet router's Internet port. You should from this point, be able to connect to the Cisco, and if the DHCP Lease was broken successfully, the Cisco should begin serving up your Internet connection. If it does not, leave the Cisco powered off for a few hours to break the DHCP lease, and then power it up. If the Valet does not work, still, give the Valet a factory reset and set up this router again, with the Ethernet cable from the ONT connected to it.
I would just take a good luck at the FAQ linked above again, and see what would work the best. Easiest thing to do is to get the ONT moved to Ethernet, which allows you to eliminate the ActionTec unless you need it in the future for TV service, and also allows you to use any router with ease.
Once the Valet is up and running and holds your Public IP address from Verizon (use http://whatismyip.com/ to determine this) , and also serves up IPs to devices on your network, post back and we can help you set up the Netgear. If you have any issues while setting this up, fall back to the ActionTec. It's factory reset will work without configuration needed, regardless of you being on Coax or Ethernet.
========
The first to bring me 1Gbps Fiber for $30/m wins!
Maybe you are looking for
-
Multi-month, year, and date-range views
My apologies for wasting everyone's time if I've missed something really obvious here, but am I correct in concluding that there is no way to generate anything beyond a static one-month view in iCal? No multi-month view? No year view? No "view date r
-
My iMAC had the 'twirling circle' and I had to restart my Mac. After that, when I went to FireFox, (Preference -> show cookies), the show cookies (with the delete cookies option) comes up - but had no cookies listed. I KNOW hotmail won't work with ou
-
Display number of contacts in Group
In the new Mountain Lion Contacts, how can you see the number of contacts in any group? This used to be visible in older versions. Thank you
-
I want to use the Lightroom CC version. I have LR 5 installed as a stand alone program and I have Photoshop CC as a single app. Now Adobe is offering LR as part of the Photoshop CC package. What do I need to do to get LR CC and not lose all of my
-
What happens to my photos in iphoto 09 when I upgrade from snow leopard to mountain lion?