Help for this output

ename          sal
a 100
b 200
c 300
output should be
ename      sal
a 300
b 200
c 100

I'm guessing a bit at what your requirements are, and what I've implemented doesn't seem reasonable for any real business purpose, but
SQL> ed
Wrote file afiedt.buf
  1  with x as (
  2    select 'a' col1, 1 col2 from dual
  3    union all
  4    select 'b', 2 from dual
  5    union all
  6    select 'c', 3 from dual
  7  )
  8  select b.col1, a.col2
  9    from (select col2, rank() over( order by col2 desc ) rn from x) a,
10         (select col1, rank() over( order by col1 asc ) rn from x) b
11*  where a.rn = b.rn
SQL> /
C       COL2
a          3
b          2
c          1Justin

Similar Messages

  • Reason for this output

    i need to know that why this code is giving the following output..what's the flow of control.......
    public class ThreadPrint {
    static synchronized Thread makeT(final String id,boolean d)
    {Thread t=new Thread(id) {
             public void run() {System.out.println(id);
    //      System.out.println("hi" + ":" + id);
    //t.setDaemon(d) ;
    t.start();return t;
    public static void main(String s[])
    Thread a=makeT("A",false);
    Thread b=makeT("B",false);
    System.out.println("End");
    output:
    End
    A
    B

A: reason for this output

liz,
Try to explain this one...
package forums;
public class ThreadPrinter {
  static synchronized Thread makeThread(final String id,boolean d) {
    Thread t = new Thread(id) {
      public void run() {
        for(int i=0; i<10; i++) {
          System.out.println(id+" "+i);
    t.start();
    return t;
  public static void main(String s[]) {
    Thread a=makeThread("A",false);
    Thread b=makeThread("B",false);
    System.out.println("End");
}produces
Test 1
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
End
B 0
B 1
B 2
B 3
B 4
B 5
B 6
B 7
B 8
B 9Test 2
End
B 0
B 1
B 2
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
B 3
B 4
B 5
B 6
B 7
B 8
B 9Hmmm... vely intarasting :-)
Keith.

liz,
Try to explain this one...
package forums;
public class ThreadPrinter {
  static synchronized Thread makeThread(final String id,boolean d) {
    Thread t = new Thread(id) {
      public void run() {
        for(int i=0; i<10; i++) {
          System.out.println(id+" "+i);
    t.start();
    return t;
  public static void main(String s[]) {
    Thread a=makeThread("A",false);
    Thread b=makeThread("B",false);
    System.out.println("End");
}produces
Test 1
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
End
B 0
B 1
B 2
B 3
B 4
B 5
B 6
B 7
B 8
B 9Test 2
End
B 0
B 1
B 2
A 0
A 1
A 2
A 3
A 4
A 5
A 6
A 7
A 8
A 9
B 3
B 4
B 5
B 6
B 7
B 8
B 9Hmmm... vely intarasting :-)
Keith.

  • My itunes radio rebuffers every 8 seconds - is there any fix or help for this problem.  I am running the latest itunes on a new Mac  with 4MB download speed.

    My itunes radio rebuffers every 8 seconds - is there any fix or help for this problem.  I am running the latest itunes on a new Mac  with 4MB download speed.

    You need to update your Mac OS to at least 10.5.8.
    Itunes 10+ requires Mac OS 10.5.8+

  • TS3694 I have not updated my iphone in two years, and error -43 occured. i cannot find any help for this

    I have not updated my iphone in two years, and error -43 occured. i cannot find any help for this on the apple site

    If the phone has been hacked, we can not offer advice on Apple's support site.
    Error 1015: This error is typically caused by attempts to downgrade the iPhone, iPad, or iPod touch's software. This can occur when you attempt to restore using an older .ipsw file. Downgrading to a previous version is not supported. To resolve this issue, attempt to restore with the latest iPhone, iPad, or iPod touch software available from Apple. This error can also occur when an unauthorized modification of the iOS has occurred and you are now trying to restore to an authorized, default state.

  • Pls i need help for this simple problem. i appreciate if somebody would share thier ideas..

    pls i need help for this simple problem of my palm os zire 72. pls share your ideas with me.... i tried to connect my palm os zire72 in my  desktop computer using my usb cable but i can't see it in my computer.. my palm has no problem and it works well. the only problem is that, my  desktop computer can't find my palm when i tried to connect it using usb cable. is thier any certain driver or installer needed for it so that i can view my files in my palm using the computer. where i can download its driver? is there somebody can help me for this problem? just email me pls at [email protected] i really accept any suggestions for this problem. thanks for your help...

    If you are using Windows Vista go to All Programs/Palm and click on the folder and select Hot Sync Manager and then try to sync with the USB cable. If you are using the Windows XP go to Start/Programs/Palm/Hot Sync Manager and then try to sync. If you don’t have the palm folder at all on your PC you have to install it. Here is the link http://kb.palm.com/wps/portal/kb/common/article/33219_en.html that version 4.2.1 will be working for your device Zire 72.

  • In itunes I am recieving a message that says "Accessing itunes Store..." Can anyone help for this message to go away?? It happens whenever I click anywhere in Itunes.

    In itunes I am recieving a message that says "Accessing Itunes Store..." Can anyone help for this message to go away??? It happens whenever I click anywhere in Itunes.

    Your shift key may be stuck in the down position.

  • I need to clear old iPhone, I went to the reset option in setting. It it's asking for a password... I don't recall setting a password up and help for this?  Thanks

    I need to clear old iPhone, I went to the reset option in setting. It it's asking for a password... I don't recall setting a password up and help for this?  Thanks

    Are you sure it doesn't have iOS 7 installed? It sounds like Activation Lock is on and if that is the case, when you do Settings > General > Reset > Erase all Content & Settings, you need to enter the password for the Apple ID.

  • I want sql query for this output

    hi guys
    could u tell how can i write sql query for this out put
    i have one table like this
    ID ACCOUTID TAX
    1 1 A
    2 1 B
    3 2 C
    4 2 D
    5 3 E
    7 NULL F
    8 NULL G
    MY OUT PUT MUST BE LIKE THIS
    ID AID TAX
    2 1 A
    4 2 D
    7 NULL F
    8 NULL G
    HERE IN THIS OUTPUT I SHOULD HAVE
    MAXIMAM ID VALUE FOR A REPEATED AID VALUES
    AND
    THE ROWS AID VALUES IS NULL ALSO MUST PAPULATED IN THE OUTPUT.
    I KNOW ONE SOLUTION LIKE THIS
    SELECT MAX(ID),AID,TAX
    FROM TABLE T
    GROUP BY AID,TAX
    UNION ALL
    SELECT ID, AIC,TAX
    FROM TABLE T
    WHERE AID IS NULL;
    BUT I WANT SAME RESULT WITH OUT USING LOGICAL OPERATORS.
    COULD U PLZ TELL A SOL.

    Will this help:
    SQL> with t as
      2    (
      3      select 1 ID, 1 ACCOUTID, 'A' TAX from dual union all
      4      select 2, 1, 'B' from dual union all
      5      select 3, 2, 'C' from dual union all
      6      select 4, 2, 'D' from dual union all
      7      select 5, 3, 'E' from dual union all
      8      select 7, NULL, 'F' from dual union all
      9      select 8, NULL, 'G' from dual
    10    )
    11  --
    12  select id, ACCOUTID AID, Tax
    13  from
    14  (
    15    select t.*
    16          ,count(1)       over (partition by t.ACCOUTID) cn
    17          ,row_number()   over (partition by t.ACCOUTID order by id desc) rn
    18    from t
    19  )
    20  where cn > 1
    21  and (rn = 1 or ACCOUTID is null)
    22  /
            ID        AID T
             2          1 B
             4          2 D
             8            G
             7            F
    -- If I leave out the OR condition then you'll get this:
    SQL> ed
    Wrote file afiedt.buf
      1  with t as
      2    (
      3      select 1 ID, 1 ACCOUTID, 'A' TAX from dual union all
      4      select 2, 1, 'B' from dual union all
      5      select 3, 2, 'C' from dual union all
      6      select 4, 2, 'D' from dual union all
      7      select 5, 3, 'E' from dual union all
      8      select 7, NULL, 'F' from dual union all
      9      select 8, NULL, 'G' from dual
    10    )
    11  --
    12  select id, ACCOUTID AID, Tax
    13  from
    14  (
    15    select t.*
    16          ,count(1)       over (partition by t.ACCOUTID) cn
    17          ,row_number()   over (partition by t.ACCOUTID order by id desc) rn
    18    from t
    19  )
    20  where cn > 1
    21* and rn = 1
    SQL> /
            ID        AID T
             2          1 B
             4          2 D
             8            G
    --which follows the description you've given, but not the output

  • I have a charge on my itunes account that I did not authorize.  Finding help for this type of problem from Apple or itunes is impossible.  Who do I contact to get this charge taken off my account?

    My checking account was debited by itunes for a subscription i did not order.  How do I go about having it taken off?  The entire Apple website and the itunes website is competely non-helpful for resolving problems.  They should make their site equally as unfriendly when it comes to enticing you to buy their products.

    You could simply type "Contact itunes support" into the google search bar.  This would give you the link to contact itunes support.
    Or you could just click the word Support at the top of this page, then click the link under Contact Apple Support.

  • Need alot of help for this huge probl

    I purchased my zen 3 months ago, during that time I've listened to music on it, sometimes I'd even put files on it for storage. But now, all of a sudden I connect it to my USB port and it gives me an error stating that there was an I/O device error. Help on this will be much appreciated.

    Please remove the battery and connect the unit to a PC.
    Note that music and data on the unit is to be considered lost. Do not proceed unless you can accept that the player will be emptied.
    Download the following firmware file:
    http://uk.europe.creative.com/support/downloads/download2.asp?MainCategory=23&Product=2720&dlcentr ic=9639&Product_Name=ZEN+Nano+Plus&OSName=Windows+ XP
    Be sure to select "Format Data Area" before you start the upgrade process. Once the Close button becomes acti've, click it. Now, go into My Computer, right click on the MuVo 'removable dri've' and select Format.
    Format the dri've in the FAT32 file system.
    You can now write your backup back to the MuVo. Use the safe hardware removal icon (green arrow near the clock). Once unplugged, you can replace the battery. The player should now operate normally.
    If this is not the case, please contact customer support and request an RMA. Note that this only applies if the player is under 2 months old.

  • RV110W - trying to set up 2 VLANS - are there docs / help for this?

    I am trying to set up an RV110W router with 2 VLANs - 1 for guests to the office to just have internet access via wireless and another for employees to be able to access the LAN and internet wirelessly. I have not done anything with VLANs before, so please bear with me.
    I thought this would be simple, but banging my head against the wall with all the terms in the docs:
    http://www.cisco.com/en/US/docs/routers/csbr/rv110w/administration/guide/rv110w_admin.pdf
    port 1 is connected to a wired LAN / unmanaged switch with office PCs. So these machines / nothing on this subnet tag the packets before they get to the router.  This subnet is using 10.10.1.0/24
    Port 2 is connected to an Engenius EAP 300, a wireless access point that can broadcast SSIDs and tie each SSID to a different VLAN.
    SSID1 is called Private and is set to be VLAN 1. There's encryption on this SSID - only office staff would be able to log on.
    SSID2 is called public and is set to be VLAN 10.  There's no encryption on this SSID.
    I know - the router also does this, but where the router is vs. where the wireless is needed, we need to have the Engenius at that remote location.
    I have the RV110W set to give out 10.10.1.0/24 IPs when you connect to the SSID1 / VLAN1
    And it gives out 10.10.10.0/24 IPs when you connect to the public SSID / VLAN10.
    Both get on the internet fine.  The only issue is how to set the VLAN membership for each port / and any other settings so that the wireless devices on VLAN 1 can get to the LAN devices on Port 1.  (and the public / vlan 10 devices on the wireless network to NOT get to the devices on port 1, but i think that's working.
    I played with tagged / untagged / excluded, for the port membership, but either the wireless VLAN 1 devices get blocked from even the web (when port 2 is set to untagged, since they ARE tagged VLAN1) or they can't get to port 1 when set to tagged, since the port 1 devices are all untagged and the reply packets get blocked?
    the doc for this unit talks about inter-vlan routing but doesn't explain what that is.  THe wireless isolation should be turned on for vlan 10, right? We don't want guests to be able to access other guest's machines?
    I saw on page 71 on how to set up the guest network, but that's using the wireless built into the box, not a wireless access point.
    Overall, what I want is:
    VLAN 1: port 2 (with tagged VLAN1 packets) and port 1 (with untagged packets) can pass data between each other and access the internet
    VLAN10: port 2 with tagged VLAN10 packets can only get to the internet.
    Is that doable?
    How?

    thanks.  Still not working
    For the vlan membership page
    when set like this:
               port1         port 2
    vlan1     untagged    untagged
    vlan10  excluded     tagged
    connecting to the vlan1 wireless SSID on port 2, I can't even get an IP address from the router (the dhcp request can't even come through port 2 because it's saying vlan1 packets have to be untagged?
    connecting to the vlan 10 wireless SSID on port 2 gets a DHCP address and can only get to the web, so that's good.
    If I change the membership to:
                      port1 port 2
    vlan1 untagged  tagged
    vlan10 excluded tagged
    connecting to both SSIDs on port 2 will get you a dhcp address, and vlan1 devices can get into port 1, but trying to admin the wireless access device on port 2 or even pinging it, now fails -  'cause the router gatekeeper says if you want to come through port 2, your packets have to be tagged? and the packets from port 1 to port 2 are untagged?
    If I change the membership to:
                port1 port 2
    vlan1   tagged tagged
    vlan10 excluded tagged
    connecting to both SSIDs on port 2 will get you a dhcp address, but replies from the wired PC on port 1 / vlan1  vlan1 can't get back out of port 1 'cause the router gatekeeper says if you want to leave  through port 1, your packets have to be tagged? and the ping reply is coming form a device with untagged packets?  although the devices on vlan1 / port 1 CAN get on the web with their untagged packets.
    the wireless device says it supports 802.1q
    http://www.engeniustech.com/resources/EAP300_DataSheet_v2.1.pdf
    when they say port 2 / vlan 1 tagged, is it saying packets coming in FROM devices on that port have to be tagged? Or packets going TO devices on that port have to be tagged?  or both directions?
    Any advice?

  • Need Help for -  JTextField outputs

    Hello everyone im back =P
    Just finished a code...and now i'd like to print the output using the JTextField , but it seems im having some problems :) ....don't know how to print the String.
    for JOptionPane its easy , we use JOptionPane.showMessag....etc
    we have also System.out...but i want to print this string with the JTextField, does anyone can help with that? thnks
                double m = complexo.module(r,i);
                double a = complexo.angle(r,i);
         String text = "Module: "+ Double.toString(m) + "\nAngle: " + Double.toString(a); 
    // I want to print  that String -> text
         JTextField  output = new JTextField(100);
         JPanel p = new JPanel();
         p.add(output);
         output.setText(text);
         output.setEditable(false);
    /** Is that ok ? do i have to use the JPanel or the JFrame ?  , well i just 
    *   want to print  that string  (text)  using the JTextField */ thnks

    In the future, Swing related questions should be posted in the Swing forum.
    and now i'd like to print the output using the JTextFieldLets get some terminoligy correct first. "Print" means you want to send the text to a printer so it can be printed on paper. I don't think thats what you want to do.
    You want to display the text on your monitor using a GUI. In that case you need to create a GUI container that contains a JTextField that will display the text.
    Start by read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/toplevel.html]How to Use Top Level Containers. The tutorial also has a section on using text components which shows you how to use a text field.

  • How  to write  a  query  for this output

    I have a string ' if i know good acting , I am a hero '
    now if 'hero' is present in the string it will return ' i am hero' else
    'you are hero'
    How to write a sql query to return the same .

    SQL> select (case
    2 when '&a' like '%hero%' then 'I am hero'
    3 ELSE 'u r hero'
    4 end) output from dual;
    Enter value for a: if i know good acting , I am a hero
    old 2: when '&a' like '%hero%' then 'I am hero'
    new 2: when 'if i know good acting , I am a hero ' like '%hero%' then 'I am hero'
    OUTPUT
    I am hero
    SQL> /
    Enter value for a: jkhkh
    old 2: when '&a' like '%hero%' then 'I am hero'
    new 2: when 'jkhkh' like '%hero%' then 'I am hero'
    OUTPUT
    u r hero
    Hope this helps.

  • Hi there, need help for this program...thx!

    Hi there guys,
    I have created this applet program that requires a user to login with a user no, and a password. I am using arrays as to store the defined variables,(as required by my project supervisor). My problem here is that when the arrays are declared in class validateUser(), the program would run fine, but i cant login and i get a NullPointerException error. if the arrays are located in actionPerformed, i get a 'cannot resolve symbol' error for the method 'get' and 'if (Admin.equals(admins.get(i).toString())) ' as well as 'if (Password.equals(passwordsget(i).toString())) '. I am not very effecient in java, hence the untidy program (and i have to admit, it isnt any good), so sorry for any inconvenience caused. Once agani thx in advance ;)
    here are my codings :
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.URL;
    import java.net.*;
    import javax.swing.*;
    import java.lang.*;
    import java.util.Vector;
    public class eg31662 extends Applet implements ActionListener
         Panel panel1, panel2, panel3, panel4, panel5;
         Button login, enter;
         Label inst, top, admin, pass, fieldlabel;
    TextField adminF, passF, field;
    String Admin, Password;
    Vector admins, passwords;
         Thread thread = null;
         boolean status = false;
              public class validateUser extends Applet
                   String[] admins = {"User1", "User2", "User3"};
                   String[] passwords = {"P1", "P2", "P2"};
         public void init()
              setLayout (new BorderLayout());
              panel1 = new Panel(new FlowLayout());
              panel2 = new Panel(new FlowLayout());
              //login button
              login = new Button("Login");
              //instruction
              inst = new Label("Please type in your User no. and the given password in order to proceed");
              //label
              top = new Label("Login login");
              admin = new Label("Admin No :");
              pass = new Label("Password :");
              //input textfields
              adminF = new TextField(8);
              passF = new TextField(10);
              passF.setEchoChar('*');
              panel1.setBackground(Color.gray);
              panel2.setBackground(Color.orange);
              panel2.add(admin);
              panel2.add(adminF);
              panel2.add(pass);
              panel2.add(passF);
              panel2.add(login);
              panel2.add(inst);
              panel1.add(top);
              add(panel1, BorderLayout.NORTH);
              add(panel2, BorderLayout.CENTER);
              login.addActionListener(this);
              setSize(500,400);
         void mainpage()
              boolean flag = true;
              setLayout (new BorderLayout());
              panel1 = new Panel(new FlowLayout());
              panel2 = new Panel(new FlowLayout());
              top = new Label("Welcome");
              enter = new Button("Enter");
              panel2.setBackground(Color.orange);
              panel1.setBackground(Color.gray);
              fieldlabel = new Label("Type something here :");
              field = new TextField(20);
              add(panel1, BorderLayout.NORTH);
              add(panel2, BorderLayout.CENTER);
              panel2.add(fieldlabel);
              panel2.add(field);
              enter.addActionListener(this);
         public void start() {
              if(thread == null) {
                   status = true;
         public void stop() {
              status = false;
         public void run() {
              while(status == true) {
                   try {
                        thread.sleep(50);
                   catch(InterruptedException ie) {
                   repaint();
              thread = null;
         public void actionPerformed(ActionEvent ev)
                   //String[] admins = {"User1", "User2", "User3"};
                   //String[] passwords = {"P1", "P2", "P3"};
              if(ev.getSource() == login)
                   Admin = adminF.getText();
                   Password = passF.getText();
              boolean ok = true;
              for (int i = 0; i < admins.size(); i++) {
              if (Admin.equals(admins.get(i).toString())) {
              if (Password.equals(passwords.get(i).toString())) {
              ok = true;
              this.setVisible(false);
              //break;
                             JOptionPane.showMessageDialog(null, "Welcome, u have successfully logged in");
                             mainpage();
              else {
              ok = false;
              else {
              ok = false;
              if (ok == false) {
                             JOptionPane.showMessageDialog(null,
                        "Incorrect Password or Admin No, Please Try Again",
                        "Access Denied",
                        JOptionPane.ERROR_MESSAGE);
              else {
              this.setVisible(false);
    }

    Hi, sorry to bring this thread up again, but this is actually a continuation from my previous posted program. Hope u guys can help me again!
    Right now i'm supposed to come up with a simple quiz program, which consists of the center panel displayin the question (in a pic format), and a textfield to enter the answer at the lower panel. this goes on for a couple of pages and once it is completed, the final page would display the total correct answers out of the number of questions, as well as the score in percentage form.
    The few(or many) problems taht i'm facing are :
    1)How do i save the answers that are typed in each textfieldAnd later on checked for the correct answer based on the array given?
    2)How do i go about doing the final score in percentage form and total of correct answers?
    3)I previously tried out using canvas, but it didnt seem to work. my questions(pictures) that are supposed to displayed in the center(canvas) produce nothing. How do i rectify that?
    i'm really sorry for the mess in the codings, hope this wouldnt be a hassle for any of u out there. Once again thanks in advance!
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.URL;
    import java.net.*;
    import java.util.Vector;
    import javax.swing.*;
    import java.awt.image.*;
    import java.lang.*;
    import java.awt.Graphics;
    public class eg31662 extends Applet implements ActionListener
        Panel panel1, panel2, panel3, panel4, panel5;
        Button login, enter;
        Label inst, top, admin, pass, startLabel;
        TextField adminF, passF, field;
        String Admin, Password;
        Vector admins, passwords;
         //Quiz declarations
         TextField ansF1,ansF2,ansF3;
         Button startBut, next0, next1, finishB, previous1;
         Image q1, q2, q3;
         Image ques[] = new Image[2];
         boolean text = false;
         boolean checked = false;
         int correct = 0;
         String [] answer = new String [2];
         String [] solution = {"11", "22", "33"};
         boolean text = false;
         boolean sound = true;
         int red,green,blue;
         int question =0;
         int good = 0;
         boolean pause= false;
         boolean start = true;*/
        Thread thread = null;
        boolean status = false;
        public void init()
            validateUser();
            setLayout (new BorderLayout());
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
            panel3 = new Panel(new FlowLayout());
            //login button
            login = new Button("Login");
            //instruction
            inst = new Label("Please type in your UserName and the given " +
                             "password in order to proceed");
            //label
            top = new Label("Top Label");
            admin = new Label("User Name :");
            pass = new Label("Password :");
            //input textfields
            adminF = new TextField(8);
            passF = new TextField(10);
            passF.setEchoChar('*');
            panel1.setBackground(Color.gray);
            panel2.setBackground(Color.orange);
              panel3.setBackground(Color.gray);
            panel2.add(admin);
            panel2.add(adminF);
            panel2.add(pass);
            panel2.add(passF);
            panel2.add(login);
            panel3.add(inst);
            panel1.add(top);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
            login.addActionListener(this);
            setSize(500,400);
        private void validateUser()
            String[] adminData    = {"t", "User1", "User2", "User3"};
            String[] passwordData = {"t", "P1", "P2", "P3"};
            admins = new Vector();
            passwords = new Vector();
            for(int j = 0; j < adminData.length; j++)
                admins.add(adminData[j]);
                passwords.add(passwordData[j]);
        private void Mainpage()
            boolean flag = true;
            removeAll();  // remove all components from container
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
              panel3 = new Panel(new FlowLayout());
            top = new Label("Welcome");
            enter = new Button("Enter");
            panel2.setBackground(Color.orange);
            panel1.setBackground(Color.gray);
            panel3.setBackground(Color.gray);
            startLabel = new Label("Welcome! " +
                                          "Please click on the 'Start' button to begin the quiz ");
              startBut = new Button("Start");
              startBut.requestFocus();
              Dimension dim = getSize();
              startBut.setSize(50,20);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
            panel2.add(startLabel);
            panel2.add(startBut);
            startBut.addActionListener(this);
            validate();
            repaint();
        private void Quiz1()
              //quizCanvas = new Canvas();
            boolean flag = true;
            removeAll();  // remove all components from container
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
            panel3 = new Panel(new FlowLayout());
            panel1.setBackground(Color.gray);
            panel2.setBackground(Color.orange);
            panel3.setBackground(Color.gray);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
              q1 = getImage(getDocumentBase(), "1.gif");
              ques[0] = q1;
              //ques[1] = q2;
              //previous = new Button("<");
              next0 = new Button("Done");
            ansF1 = new TextField(25);
              next0.addActionListener(this);
              //quizCanvas.insert(ques1);
            //panel3.add(previous);
            panel3.add(next0);
            panel3.add(ansF1);
            //panel2.add("1.gif");
              ansF1.requestFocus();
              ansF1.setText("focussing");
            validate();
            repaint();
         public void Quiz2(){
            boolean flag = true;
            removeAll();  // remove all components from container
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
            panel3 = new Panel(new FlowLayout());
            panel1.setBackground(Color.gray);
            panel2.setBackground(Color.orange);
            panel3.setBackground(Color.gray);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
              q2 = getImage(getDocumentBase(), "2.gif");
              ques[1] = q2;
              next1 = new Button("Done");
            ansF2 = new TextField(25);
              next1.addActionListener(this);
            panel3.add(next1);
            panel3.add(ansF2);
              ansF2.requestFocus();
              ansF2.setText("focussing");
            validate();
            repaint();
         public void Quiz3(){
            boolean flag = true;
            removeAll();  // remove all components from container
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
            panel3 = new Panel(new FlowLayout());
            panel1.setBackground(Color.gray);
            panel2.setBackground(Color.orange);
            panel3.setBackground(Color.gray);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
              q3 = getImage(getDocumentBase(), "3.gif");
              ques[2] = q3;
              finishB = new Button("Finish");
            ansF3 = new TextField(25);
              finishB.addActionListener(this);
            panel3.add(finishB);
            panel3.add(ansF3);
              ansF3.requestFocus();
              ansF3.setText("focussing");
            validate();
            repaint();
        public void start() {
            if(thread == null) {
                status = true;
        public void stop() {
            status = false;
        public void actionPerformed(ActionEvent ev)
            boolean ok = true;
            if(ev.getSource() == login)
                Admin = adminF.getText();
                Password = passF.getText();
                for (int i = 0; i < admins.size(); i++) {
                    if (Admin.equals(admins.get(i).toString())) {
                        if (Password.equals(passwords.get(i).toString())) {
                            ok = true;
                            JOptionPane.showMessageDialog(null,
                                        "Welcome, u have successfully logged in");
                            Mainpage();
                            break;
                        else {
                            ok = false;
                    else {
                        ok = false;
                if (!ok) {
                    JOptionPane.showMessageDialog(null,
                                  "Incorrect Password or Admin No, Please Try Again",
                                  "Access Denied",
                                   JOptionPane.ERROR_MESSAGE);
            if(ev.getSource() == startBut)
                   Quiz1();
              if (ev.getSource () == next0) {
                   saveanswer();
                   Quiz2();
              if (ev.getSource () == next1) {
                   //saveanswer();
                   Quiz3();
              if (ev.getSource () == finishB) {
                   //saveanswer();
                   //checkanswer();
         /*class quizCanvas extends Canvas {
              private Image quest;
              public quizCanvas() {
                   this.quest = null;
              public quizCanvas(Image quest) {
                   this.quest = quest;
              public void insert(Image quest) {
                   this.quest=quest;
                   repaint();
              public void paint(Graphics g) {
         public void checkanswer() {
              if (!checked) {
              /*question = 0;
                   for (int a=1;a<16;a++) {
                        question++;*/
                        if (ansF1) {
                             if (answer[1].toUpperCase().equals(solution[1])) {
                                  correct++;
                        if (ansF2) {
                             if (answer[2].toUpperCase().equals(solution[2])) {
                                  correct++;
                        if (ansF3) {
                             if (answer[3].toUpperCase().equals(solution[3])) {
                                  correct++;
              checked = true;     }
         public void saveanswer() {
              if (text) {
                   if (!ansF1.getText().equals("")) {
                        answer [Quiz1] = ansF1.getText();
                   //answer2[question] = tf2.getText();
                   if (!ansF2.getText().equals("")) {
                        answer [] = ansF2.getText();
                   if (!ansF3.getText().equals("")) {
                        answer [] = ansF3.getText();
    }

  • Need logic for this output  itab  format

    hi guys
    i need the output itab in following format
    i have data in my present  itab
    itab-f1     itab-f2    itab-f3
    AAA         10    (means null,' ')
    AAA         20            
    BBB         10          
    BBB         20    A1
    BBB         30         
    and i want output in following way output itab
    itab-f1     itab-f2    itab-f3
    AAA     30          
    BBB         60      A1
    can anyone suggest me code for this

    You want the sum of f2 for a group of f1's?
    Is f3 going to be the same for that group?
    Try this
    sum = 0
    sort itab by f1.
    itab2 like itab.
    loop itab.
    sum = itab-f2 + sum.
    f3var = tab-f3.
    at end of f1.
    move itab-f1 to itab2-f1.
    move sum to itab2-f2.
    move f3var to itab2-f3.
    append itab2.
    sum = 0.
    endat.
    endloop.
    Edited by: Ramiro Escamilla on Feb 7, 2008 11:29 PM

  • Maybe you are looking for