Need help: checkbox or radiobutton in table cell

So basically i am looking for code samples or links to where i can find an implementation of 2 or 3 radiobuttons or checkboxes in a table cell/column, so that for each row, i can have a selection of A, B or C for a particular string in the first column. I can create a table with one checkbox, but i cant figure out 2 or more inside the same cell.
thanks :)

The JTable tutorial has a section titled "Using a Combo Box as an Editor". Take a look at their example for how to do this.
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

Similar Messages

  • Need Help with giving Colors to Table Cells and Table Borders in Dreamweaver CC - Please!

    Hi,
    I am a teacher and use Dreamweaver CC to make my class web page.
    How do I give colors to the cell borders of a table I inserted?  How do I give colors and line thickness
    to table borders, too?
    I bought the David Powers DVD and it doesn't show that.
    Please help.
    Thank you,
    John

    Assuming that you have placed a table in your document and your CSS Designer panel is open
    1. Click the '+' sign
    2. Choose your option. I will choose 'Define in Page'
    3. Follow the above sequence, 1.click on table, 2.ensure table is selected, 3.click on style, 4.click the '+' sign, 5. see the selector appear.
    4. Click on the selector and choose the required Properties.
    You can do the same for the row (<tr>) or a cell (<td>). In fact, this is how you would go about styling anything in your document.

  • Search help in case of a table cell editor

    Hi
    I need a search help in case of a table cell editor as well as the the other requirement is that it shld be a reusable one.
    could anyone of u suggest me some methods
    regards
    Nikhil Tapkir

    There are several ways of doing this.
    1. Use OVS
    2. Create a Search help in R3. Call the function module.
    3. Create a Jar file which would provide the result .
    It is upto you on which ever way you want to provide
    Kumar

  • I need a text field in a table cell to expand dynamically

    When I say expand I mean the whole cell has to grow as the content is entered into it, not just have a scroll bar present to contain the content, every new line should expand the table cell vertically. I've been looking all over and I can't seem to figure this one out, help?

    Turns out I just needed to search the forums better, here's a link to the thread with my solution:
    http://forums.adobe.com/thread/450522

  • Need help for finding oracle payables tables

    Hi,
    I need help for finding tables relating fields INVOICE_ID, NOTIFICATION_ID and APPROVAL_STATUS or WFAPPROVAL_STATUS. I have searched a lot but has been unable to find any table containing all the above mentioned fields. I found the table WF_NOTIFICATIONS for INVOICE_ID, however have been unable to find the latest tables with INVOICE_ID and APPROVAL_STATUS as fields.
    All the tables having this combination are either very old tables which are not used anymore or doesnt give the required data. Please let me know where am i going wrong. Once i get the required tables, i need to join the tables to get the required data with the imp fields. Also, the values of WFAPPROVAL_STATUS are not very clear to me. I need values for it as APPROVED, REJECTED AND INITIATED.

    Hi Swetha,
    You will have to manually make the table adjustments in all the systems using SE14 trans since the changes done using SE14 cannot be collected in any TR.
    How to adjust tables :
    Enter the table name in SE14. For ex for any Z master data(Say ZABCD), master data table name would be /BIC/PZABCD, text table would be /BIC/TZABCD. Similarly any DSO(say ZXYZ) table name would be /BIC/AZXYZ00 etc.
    Just enter the table name in SE14 trans --> Edit --> Select the radio button "Save Data" --> Click on Activate & adjust database table.
    NOTE : Be very careful in using SE14 trans since there is possibility that the backend table could be deleted.
    How to collect the changes in TR:
    You can collect only the changes made to the IO --> When you activate, it will ask you for the TR --> Enter the correct package name & create a new TR. If it doesn't prompt you for TR, just goto Extras --> Write transport request from the IO properties Menu screen. Once these IO changes are moved successfully, then the above proceduce can be followed using SE14 trans.
    Hope it helps!
    Regards,
    Pavan

  • Help with creating a custom table cell editor?

    hi, i was reading up on various tutorials and trying to write codes that pops up a simple calendar when clicked on text of the Date class in a table, so far, i can't seem to get my classes working.. the following is some classes i've written for this task (note, there are alot of commented out lines, those are the modifications done to the tutorial classes in http://java.sun.com/docs/books/tutorial/)
    any help would be appreciated :D
    thanks in advance!
    What i have done so far:
    /** BASIC TABLE CLASS FOR DEMONSTRATION*/
    //import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    public class TableBasic extends JFrame
         public TableBasic()
              String[] columnNames = { "Date", "String", "Integer", "Boolean" };
              Object[][] data =
                   {  { new Date(), "A", new Integer(1), Boolean.TRUE },
                        {new Date(), "B", new Integer(2), Boolean.FALSE },
                        {new Date(), "C", new Integer(9), Boolean.TRUE },
                        {new Date(), "D", new Integer(4), Boolean.FALSE}
              JTable table = new JTable(data, columnNames)
                   //Returning the Class of each column will allow different
                   //renderers to be used based on Class
                   public Class getColumnClass(int column)
                        return getValueAt(0, column).getClass();
              table.setDefaultRenderer(Date.class, new CalendarRenderer(true));
              table.setDefaultEditor(Date.class, new CalendarEditor());
              table.setPreferredScrollableViewportSize(table.getPreferredSize());
              JScrollPane scrollPane = new JScrollPane(table);
              getContentPane().add(scrollPane);
         public static void main(String[] args)
              TableBasic frame = new TableBasic();
              frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
              frame.pack();
              //frame.setLocationRelativeTo(null);
              frame.setVisible(true);
    * CLASS BASED ON ColorRenderer.java at http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/ColorRenderer.java
    import javax.swing.BorderFactory;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.border.Border;
    import javax.swing.table.TableCellRenderer;
    //import java.awt.Color;
    import java.awt.Component;
    public class CalendarRenderer
         extends JLabel
         implements TableCellRenderer
         Border unselectedBorder = null;
         Border selectedBorder = null;
         boolean isBordered = true;
         public CalendarRenderer(boolean isBordered)
              this.isBordered = isBordered; setOpaque(true);
              //MUST do this for background to show up.
         public Component getTableCellRendererComponent(JTable table,
                                                                     Object color,
                                                                     boolean isSelected,
                                                                     boolean hasFocus,
                                                                     int row,
                                                                     int column)
              String newDate = (String)color;
              setText(newDate);
              if (isBordered)
                   if (isSelected)
                        if (selectedBorder == null)
                             selectedBorder = BorderFactory.createMatteBorder(2,5,2,5, table.getSelectionBackground());
                        setBorder(selectedBorder);
                   else
                        if (unselectedBorder == null)
                             unselectedBorder = BorderFactory.createMatteBorder(2,5,2,5, table.getBackground());
                        setBorder(unselectedBorder);
              //setToolTipText("RGB value: " + newColor.getRed() + ", " + newColor.getGreen() + ", " + newColor.getBlue());
              return this;
    * the editor based on ColorEditor.java at http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/ColorEditor.java
    import javax.swing.AbstractCellEditor;
    import javax.swing.table.TableCellEditor;
    import javax.swing.JButton;
    import javax.swing.JColorChooser;
    import javax.swing.JDialog;
    import javax.swing.JTable;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class ColorEditor
         extends AbstractCellEditor
         implements TableCellEditor, ActionListener
         Color currentColor;
         JButton button;
         JColorChooser colorChooser;
         JDialog dialog;
         protected static final String EDIT = "edit";
         public ColorEditor()
              //Set up the editor (from the table's point of view),
              //which is a button.
              //This button brings up the color chooser dialog,
              //which is the editor from the user's point of view.
              button = new JButton();
              button.setActionCommand(EDIT);
              button.addActionListener(this);
              button.setBorderPainted(false);
              //Set up the dialog that the button brings up.
              colorChooser = new JColorChooser();
              dialog = JColorChooser.createDialog(button,
                   "Pick a Color",
                   true, //modal
                   colorChooser,
                   this, //OK button handler
                   null); //no CANCEL button handler
          * Handles events from the editor button and from
          * the dialog's OK button.
         public void actionPerformed(ActionEvent e)
              if (EDIT.equals(e.getActionCommand()))
                   //The user has clicked the cell, so
                   //bring up the dialog.
                   button.setBackground(currentColor);
                   colorChooser.setColor(currentColor);
                   dialog.setVisible(true); //Make the renderer reappear.
                   fireEditingStopped();
              else
                   //User pressed dialog's "OK" button.
                   currentColor = colorChooser.getColor();
         //Implement the one CellEditor method that AbstractCellEditor doesn't.
         public Object getCellEditorValue()
              return currentColor;
         //Implement the one method defined by TableCellEditor.
         public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
              currentColor = (Color)value; return button;
    /** THE SIMPLE CALENDAR WRITTEN TALIORED TO WORK WITH DIALOGS*/
    import javax.swing.*;
    import java.util.Calendar;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.SimpleDateFormat;
    //import java.beans.*; //property change stuff
    public class CalendarDialog
         extends JDialog
         //implements PropertyChangeListener
         private JButton[] btn = new JButton[49];
         private int month = Calendar.getInstance().get(Calendar.MONTH);
         private int year = Calendar.getInstance().get(Calendar.YEAR);
         private JLabel lbl = new JLabel("", JLabel.CENTER);
         private JOptionPane optionPane;
         private String curDate = null;
         private JTextArea output = new JTextArea(curDate, 1, 20);
         private String btnString1 = "Enter";
         private String btnString2 = "Cancel";
         public CalendarDialog()
              //super(aFrame, true);
              setContentPane(buildGUI());
              setDates();
         public JPanel buildGUI()
              JPanel panel = new JPanel();
              String[] header = { "Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat" };
              JPanel midPanel = new JPanel(new GridLayout(7, 7));
              for (int x = 0; x < btn.length; x++)
                   final int selection = x;
                   btn[x] = new JButton();
                   btn[x].setFocusPainted(false);
                   if (x < 7)
                        JLabel lbl = new JLabel(header[x], JLabel.CENTER);
                        lbl.setFont(new Font("Lucida", Font.PLAIN, 10));
                        midPanel.add(lbl);
                   else
                        btn[x].addActionListener(new ActionListener()
                             public void actionPerformed(ActionEvent ae)
                                  displayDatePicked(btn[selection].getActionCommand());
                        midPanel.add(btn[x]);
              JPanel lowPanel = new JPanel(new GridLayout(1, 3));
              JButton prevBtn = new JButton("<< Previous");
              prevBtn.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        month--;
                        setDates();
              lowPanel.add(prevBtn);
              lowPanel.add(lbl);
              lowPanel.add(output);
              JButton nextBtn = new JButton("Next >>");
              nextBtn.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        month++;
                        setDates();
              lowPanel.add(nextBtn);
              JPanel outputPanel = new JPanel();
              Object[] options = { btnString1, btnString2 };
              optionPane =
                   new JOptionPane(
                        output,
                        JOptionPane.QUESTION_MESSAGE,
                        JOptionPane.YES_NO_OPTION,
                        null,
                        options,
                        options[0]);
              outputPanel.add(optionPane);
              panel.setLayout(new BorderLayout());
              panel.add(lowPanel, BorderLayout.NORTH);
              panel.add(midPanel, BorderLayout.CENTER);
              panel.add(outputPanel, BorderLayout.SOUTH);
              return panel;
         public void setDates()
              for (int x = 7; x < btn.length; x++)
                   btn[x].setText("");
              SimpleDateFormat sdf = new SimpleDateFormat("MMMM yyyy");
              Calendar cal = Calendar.getInstance();
              cal.set(year, month, 1);
              int dayOfWeek = cal.get(java.util.Calendar.DAY_OF_WEEK);
              int daysInMonth = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
              for (int x = 6 + dayOfWeek, day = 1; day <= daysInMonth; x++, day++)
                   btn[x].setText("" + day);
              lbl.setText(sdf.format(cal.getTime()));
         public void displayDatePicked(String day)
              if (day.equals("") == false)
                   SimpleDateFormat sdf = new SimpleDateFormat("EEEE d MMMM, yyyy");
                   Calendar cal = Calendar.getInstance();
                   cal.set(year, month, Integer.parseInt(day));
                   curDate = sdf.format(cal.getTime());
                   //JOptionPane.showMessageDialog(this, "You picked " + sdf.format(cal.getTime()));
                   output.setText(sdf.format(cal.getTime()));
         public String getDate()
              return curDate;
         public void setDate(String date)
              curDate = date;
    }

    well, i have indeed narrowed down my problem after some digging around.. one thing i discovered that i don't need CalendarRenderer.java.. and i found out i don't really know what does
    //Implement the one method defined by TableCellEditor.
         public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
              curDate = (String)value; return button;
         }do, as it seems to be the problem:
    java.lang.ClassCastException
         at CalendarEditor.getTableCellEditorComponent(CalendarEditor.java:78)
         at javax.swing.JTable.prepareEditor(JTable.java:3786)
         at javax.swing.JTable.editCellAt(JTable.java:2531)
         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.adjustFocusAndSelection(BasicTableUI.java:510)
         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mousePressed(BasicTableUI.java:494)
         at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
         at java.awt.Component.processMouseEvent(Component.java:5097)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3195)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    mmm.. does anyone know what i should modify for that to work?

  • I need help creating a formula that looksup cell data and give a value.

    I want to have the table "At a glance"  show the total days a driver has worked, there total in sales and there total in milage. The table shown is a example of what I want to have happen. I want to input any name into cell B2,C2,D2,ect. that is found in the row C2:C17 of Checkpoint (Truck 1) and Checkpoint (Truck 2) and return the total amount of day the driver has driven both trucks, The total in sales the driver has collected (Truck 1 and 2) and How many miles the driver has driven (Truck 1 and 2). I realize that these tables are not labeled correct. If I enter a name into B2 and the driver associated with that name hasnt driven then I want "N/A' to show in cell B2 and so one. I assume that the formula that is created for cell B2 will be copied and pasted into cell C2, D2, ect..
    If someone could help me with this problem I'd really appreciate it.
    Thanks.

    Hi br,
    To show the number of days worked by a driver, you need to COUNT the number of times that driver's name appears in row 2 of both tables.
    To calculate his total sales and total mileage, you need to SUM the amounts he brought in each day and the distances he drove each day.
    Your functions for this are COUNTIF and SUMIF.
    Formulas in At a Glance:
    B2: =COUNTIF(Truck 1 :: $3:$3,B$1)+COUNTIF(Truck 2 :: 3:3,B$1)
    B3: =SUMIF(Truck 1 :: $3:$3,B$1,Truck 1 :: $5:$5)+SUMIF(Truck 2 :: $3:$3,B$1,Truck 2 :: $5:$5)
    B4: =SUMIF(Truck 1 :: $3:$3,B$1,Truck 1 :: $12:$12)+SUMIF(Truck 2 :: $3:$3,B$1,Truck 2 :: $12:$12)
    Fill all three formulas right to the last column of At a Glance.
    To put N/A in place of the 0 in Roger's column and the empty columns, wrap each of the formulas in an IF statement:
    Bn: =IF(AND(ISERROR(MATCH(B$1,Truck 1 :: $3:$3,0)),ISERROR(MATCH(B$1,Truck 2 :: $3:$3,0))),"N/A",formula)
    Where formula is the formula used in column B above.
    Regards,
    Barry

  • Need Help for Pivoting Columns in table

    I have a data like below in the table
    col1 col2 col3 col4
    a b 10 jan-11
    aa b 20 feb-11
    aab b 30 mar-11
    Need desire o/p like
    col1 col2 jan-11 feb-11 mar-11
    a b 10
    aa b 20
    aab b 30
    Can anyone help me on this? decode is not the option here because my table gets dynamic data and rows count can vary too(eg. 2000).
    Thanks,
    -KP

    Please try searching the forum BEFORE you ask a question.. There are NUMEROUS posting son the subject:
    http://forums.oracle.com/forums/search.jspa?objID=f75&q=pivot
    Thank you,
    Tony Miller
    Webster, TX
    Never Surrender Dreams!
    JMS
    If this question is answered, please mark the thread as closed and assign points where earned..

  • Need Help!!  Cannot Create Table

    Hi,
    I just installed Oracle XE and APEX 4.0.2. I REALLY need to create an application with 3 tables where I can update these tables via a form like found in Application Express. The install and configuration went very smoothly until I went to create an application built on my .csv files of the tables. When I try to add the table when building the application I get this error:
    ORA-20001: Unable to create modules. ORA-20001: create_table error: ORA-20001: Excel load run ddl error: ORA-01003: no statement parsed
    Can someone give me an idea how I can fix this error?
    Thanks so much for your help! It's greatly appreciated!!
    NS

    The user is system.Are you saying that the parsing schema for the application is the standard SYSTEM schema? This should not be possible, and is certainly not recommended. If this is somehow the case, create a new schema and use it instead.
    (Please update your forum profile with a better handle than "user649041".)

  • [8i] Need help updating/fixing a workday table

    I'm working in an old database:
    Oracle8i Enterprise Edition Release 8.1.7.2.0 - Production
    PL/SQL Release 8.1.7.2.0 - Production
    CORE 8.1.7.0.0 Production
    TNS for HPUX: Version 8.1.7.2.0 - Production
    NLSRTL Version 3.4.1.0.0 - Production
    I'm trying to fix a workday calendar, and I'm not exactly sure how to do it. I'm used to querying data, not making changes to the data...
    Here's some sample data:
    CREATE TABLE     test_cal
    (     clndr_dt     DATE     NOT NULL
    ,     work_day     NUMBER(3)
    ,     clndr_days     NUMBER(6)
    ,     work_days     NUMBER(5)
    INSERT INTO     test_cal
    VALUES     (TO_DATE('12/30/2010','mm/dd/yyyy'), 254, 11322, 7885);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('12/31/2010','mm/dd/yyyy'), 255, 11323, 7886);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/01/2011','mm/dd/yyyy'), 0, NULL, NULL);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/02/2011','mm/dd/yyyy'), 0, NULL, NULL);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/03/2011','mm/dd/yyyy'), 1, NULL, NULL);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/04/2011','mm/dd/yyyy'), 2, NULL, NULL);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/05/2011','mm/dd/yyyy'), 3, NULL, NULL);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/06/2011','mm/dd/yyyy'), 4, NULL, NULL);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/07/2011','mm/dd/yyyy'), 5, NULL, NULL);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/08/2011','mm/dd/yyyy'), 0, NULL, NULL);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/09/2011','mm/dd/yyyy'), 0, 11332, 7895);
    INSERT INTO     test_cal
    VALUES     (TO_DATE('01/10/2011','mm/dd/yyyy'), 6, 11333, 7896);Note: 12/31/2010 is the last time I am 100% sure the data in the table is good. After that, clndr_days and work_days are either missing or, at least in the case of work_days, are not correct.
    This is a two-part question, since I need to fix both clndr_days and work_days. (You can probably fix them both with one statement, but I broke it into two to start, to simplify it for myself).
    I only show 12 days in my sample data, but really, the table stretches back a number of years, and forward another 5 or so years.
    PART 1: fixing clndr_days
    I put together this query:
    SELECT     clndr_dt
    ,     work_day
    ,     work_days
    ,     clndr_days
    ,     min_clndr_day + r_num     AS clndr_days_test
    FROM     (
         SELECT     t.*
         ,     MIN(clndr_days)     OVER(ORDER BY clndr_dt)     AS min_clndr_day
         ,     ROW_NUMBER() OVER(ORDER BY clndr_dt)-1     AS r_num
         FROM     test_cal t
         WHERE     clndr_dt     >= TO_DATE('12/31/2010','mm/dd/yyyy')
    ;Which gives the right clndr_days (as clndr_days_test), but I'm not sure how to get that into the table.
    This doesn't work:
    UPDATE     test_cal
    SET     clndr_days     =     (
                        SELECT     min_clndr_day + r_num
                        FROM     (
                             SELECT     t.*
                             ,     MIN(clndr_days)     OVER(ORDER BY clndr_dt)     AS min_clndr_day
                             ,     ROW_NUMBER() OVER(ORDER BY clndr_dt)-1     AS r_num
                             FROM     test_cal t
                             WHERE     clndr_dt     >= TO_DATE('12/31/2010','mm/dd/yyyy')
                             ) c
                        WHERE     c.clndr_dt     = ???  -- how do I make this equal whatever the clndr_dt is for the record I'm updating?
    WHERE     clndr_dt     >      TO_DATE('12/31/2010','mm/dd/yyyy')and I'm not sure how to make it work...
    PART 2: Fixing work_days
    Then, I can't seem to put together a query for work_days.
    This is what I have so far, but it doesn't work quite right, and then it also needs to be an UPDATE statement as well:
    SELECT     clndr_dt
    ,     work_day
    ,     work_days
    ,     clndr_days
    ,     min_work_day + r_num     AS work_days_test --this isn't right, when work_day is 0 work_days_test should be the previous work_day not the minimum work_day
    FROM     (
         SELECT     t.*
         ,     MIN(work_days)     OVER ( ORDER BY clndr_dt)     AS min_work_day
         ,     CASE
                   WHEN     work_day     <> 0
                   THEN     ROW_NUMBER()     OVER ( PARTITION BY     CASE
                                                      WHEN     work_day <> 0
                                                      THEN     1
                                                      ELSE     2
                                                 END
                                         ORDER BY     clndr_dt
                   ELSE     0
              END               AS r_num
         FROM     test_cal t
         WHERE     clndr_dt     >= TO_DATE('12/31/2010','mm/dd/yyyy')
    ;(When I tried using LAG, that didn't work either, because you can have more than 1 non-work day in a row, and so it only works for the first non-work day to have the correct work_days, and then it's back to being wrong again)
    This is what I want my table to look like in the end:
    CLNDR_DT                   WORK_DAY       WORK_DAYS CLNDR_DAYS_TEST
    12-31-2010 00:00:00         255.000       7,886.000    11,323.000
    01-01-2011 00:00:00            .000       7,886.000    11,324.000
    01-02-2011 00:00:00            .000       7,886.000    11,325.000
    01-03-2011 00:00:00           1.000       7,887.000    11,326.000
    01-04-2011 00:00:00           2.000       7,888.000    11,327.000
    01-05-2011 00:00:00           3.000       7,889.000    11,328.000
    01-06-2011 00:00:00           4.000       7,890.000    11,329.000
    01-07-2011 00:00:00           5.000       7,891.000    11,330.000
    01-08-2011 00:00:00            .000       7,891.000    11,331.000
    01-09-2011 00:00:00            .000       7,891.000    11,332.000
    01-10-2011 00:00:00           6.000       7,892.000    11,333.000(sorry about all the extra decimal places)
    Edited by: user11033437 on Jan 11, 2012 1:40 PM

    Hi,
    Thanks for posting the CREATE TABLE and INSERT statements, the very clear desired output, and your attempts; that's all very helpful. It would also be helpful to explain how you get the results you want from the sample data. There's always a chance someone might coincidentally get the right results for the wrong reasons with the small set of sample data, but would cause you to get wrong results with your full data.
    It looks like clndr_days is the total number of days since some conventional starting point (maybe when the company started), and that work_days is the total number of work days from some starting point. It looks like work_day is 0 when the day is not a working day, and otherwise, it's the total number of working days so far in the calendar year. Is that right?
    You said the data after December 31, 2010 isn't reliable. Did you mean that two columns (clndr_days and work_days) are unreliable, but the rest of the data is reliable? That is, are you sure there is exactly one row per day even after 2010, and that the work_day column is accurate? If so, you can do this:
    UPDATE       test_cal     m
    SET       (clndr_days, work_days) =
         SELECT     MIN (clndr_days) + COUNT (*) - 1          -- clndr_days
         ,     MIN (work_days)  + COUNT ( CASE
                                               WHEN  work_day > 0
                                    AND   clndr_dt > TO_DATE ('12/31/2010', 'MM/DD/YYYY')
                                    THEN  1
                                END
                                 )               -- work_days
         FROM     test_cal
         WHERE     clndr_dt     BETWEEN     TO_DATE ('12/31/2010', 'MM/DD/YYYY')
                        AND     m.clndr_dt
    WHERE     clndr_dt     > TO_DATE ('12/31/2010', 'MM/DD/YYYY')
    ;You were right: it is possible to set both columns at the same time.
    It's a shame that you're using Oracle 8.1. The MERGE command, which was new in Oracle 9.1, is a lot clearer and more efficient. If you could use MERGE, you could basically use the code you posted as the core of a MERGE statement.
    The UPDATE statement above assumes that, for the inaccurate days, clndr_days and work_days will never be lower than the last accurate value. If that's not the case, the solution is a little more complicated. You could avoid that problem, and make the statment faster as well, by simply hard-coding the last accurate values of clndr_days and work_days in the UPDATE statment, where I used MIN. (This sounds like one situation where efficientcy isn't a big deal, however. You'll probably never do this exact UPDATE statement again, so whether it runs in 1 second or 10 minutes might not matter much.)
    Sorry, I don't have an Oracle 8 database to test this. It works in Oracle 9.2, and I don't believe it uses any features that aren't available in 8.1.

  • Need help with query joining several tables into a single return line

    what i have:
    tableA:
    puid, task
    id0, task0
    id1, task1
    id2, task2
    tableB:
    puid, seq, state
    id0, 0, foo
    id0, 1, bar
    id0, 2, me
    id1, 0, foo
    id2, 0, foo
    id2, 1, bar
    tableC:
    puid, seq, date
    id0, 0, 12/21
    id0, 1, 12/22
    id0, 2, 12/22
    id1, 0, 12/23
    id2, 0, 12/22
    id2, 1, 12/23
    what i'd like to return:
    id0, task0, 12/21, 12/22, 12/22
    id1, task1, 12/23, N/A, N/A
    id2, task2, 12/22, 12/23, N/A
    N/A doesn't mean return the string "N/A"... it just means there was no value, so we don't need anything in this column (null?)
    i can get output like below through several joins, however i was hoping to condense each "id" into a single line...
    id0, task0, 12/21
    id0, task0, 12/22
    id0, task0, 12/23
    id1, task1, 12/23
    is this possible fairly easily?
    Edited by: user9979830 on Mar 29, 2011 10:53 AM
    Edited by: user9979830 on Mar 29, 2011 10:58 AM

    Hi,
    Welcome to the forum!
    user9979830 wrote:
    what i have:...Thanks for posting that so clearly!
    Whenever you have a question, it's even better if you post CREATE TABLE and INSERT statements for your sample data, like this:
    CREATE TABLE     tablea
    (       puid     VARCHAR2 (5)
    ,     task     VARCHAR2 (5)
    INSERT INTO tablea (puid, task) VALUES ('id0',  'task0');
    INSERT INTO tablea (puid, task) VALUES ('id1',  'task1');
    INSERT INTO tablea (puid, task) VALUES ('id2',  'task2');
    CREATE TABLE     tablec
    (       puid     VARCHAR2 (5)
    ,     seq     NUMBER (3)
    ,     dt     DATE          -- DATE is not a good column name
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  0,  DATE '2010-12-21');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  1,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id0',  2,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id1',  0,  DATE '2010-12-23');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id2',  0,  DATE '2010-12-22');
    INSERT INTO tablec (puid, seq, dt) VALUES ('id2',  1,  DATE '2010-12-23');This way, people can re-create the problem and test their ideas.
    It doesn't look like tableb plays any role in this problem, so I didn't post it.
    Explain how you get the results from that data. For example, why do you want this row in the results:
    PUID  TASK  DT1        DT2        DT3
    id0   task0 12/21/2010 12/22/2010 12/22/2010rather than, say
    PUID  TASK  DT1        DT2        DT3
    id0   task0 12/22/2010 12/21/2010 12/22/2010? Does 12/21 have to go in the first column because it is the earliest date, or is it because 12/21 is related to the lowest seq value? Or do you even care about the order, just as long as all 3 dates are shown?
    Always say what version of Oracle you're uisng. The query below will work in Oracle 9 (and up), but starting in Oracle 11, the SELECT ... PIVOT feature could help you.
    i can get output like below through several joins, however i was hoping to condense each "id" into a single line... Condensing the output, so that there's only one line for each puid, sounds like a job for "GROUP BY puid":
    WITH     got_r_num     AS
         SELECT     puid
         ,     dt
         ,     ROW_NUMBER () OVER ( PARTITION BY  puid
                                   ORDER BY          seq          -- and/or dt
                           )         AS r_num
         FROM    tablec
    --     WHERE     ...     -- If you need any filtering, put it here
    SELECT       a.puid
    ,       a.task
    ,       MIN (CASE WHEN r.r_num = 1 THEN r.dt END)     AS dt1
    ,       MIN (CASE WHEN r.r_num = 2 THEN r.dt END)     AS dt2
    ,       MIN (CASE WHEN r.r_num = 3 THEN r.dt END)     AS dt3
    ,       MIN (CASE WHEN r.r_num = 4 THEN r.dt END)     AS dt4
    FROM       tablea    a
    JOIN       got_r_num r  ON   a.puid  = r.puid
    GROUP BY  a.puid
    ,            a.task
    ORDER BY  a.puid
    ;I'm guessing that you want the dates arranged by seq; that is, for each puid, the date related to the lowest seq comes first, regardless of whther that date is the earliest date for that puid or not. If that's not what you need, then change the analytic ORDER BY clause.
    This does not assume that the seq values are always consecutive integers (0, 1, 2, ...) for each puid. You can skip, or even duplicate values. However, if the values are always consecutive integers, starting from 0, then you could simplify this. You won't need a sub-query at all; just use seq instead of r_num in the main query.
    Here's the output I got from the query above:
    PUID  TASK  DT1        DT2        DT3        DT4
    id0   task0 12/21/2010 12/22/2010 12/22/2010
    id1   task1 12/23/2010
    id2   task2 12/22/2010 12/23/2010As posted, the query will display the first 4 dts for each puid.
    If there are fewer than 4 dts for a puid, the query will still work. It will leave some columns NULL at the end.
    If there are more than 4 dts for a puid, the query will still work. It will display the first 4, and ignore the others.
    There's nothing special about the number 4; you could make it 3, or 5, or 35, but whatever number you choose, you have to hard-code that many columns into the query, and always get that many columns of output.
    For various ways to deal with a variable number of pivoted coolumns, see the following thread:
    PL/SQL
    This question actually doesn't have anything to do with SQL*Plus; it's strictly a SQL question, and SQL questions are best posted on the "SQL and PL/SQL" forum:
    PL/SQL
    If you're not sure whether a question is more of a SQL question or a SQL*Plus question, then post it on the SQL forum. Many more people pay attention to that forum than to this one.

  • Need help in joining the following tables!

    send me the query for how to join the fields from the tables given.
    Important thing is i need all the values of vbeln in output.
    Whether its corresponding values in other fields present or not doesnt matter
            VBELN LIKE VBAK-VBELN,
             VKORG LIKE VBAK-VKORG,
             ERDAT LIKE VBAK-ERDAT,
             AUGRU LIKE VBAK-AUGRU,
             BEZEI LIKE TVAUT-BEZEI,
             BSTDK LIKE VBKD-BSTDK,
             BSTDK_E LIKE VBKD-BSTDK_E,
             BSTKD LIKE VBKD-BSTKD,
             KDKG2 LIKE VBKD-KDKG2,
             KONDA LIKE VBKD-KONDA,
             MATNR LIKE VBAP-MATNR,
             SPART LIKE VBAP-SPART,
             KONDM LIKE VBAP-KONDM,
             WAERK LIKE VBAP-WAERK,
             NETWR LIKE VBAP-NETWR,
             KWMENG LIKE VBAP-KWMENG,
             VKAUS LIKE VBAP-VKAUS,
             MVGR1 LIKE VBAP-MVGR1,
             MVGR2 LIKE VBAP-MVGR2,
             MVGR3 LIKE VBAP-MVGR3,
             MVGR4 LIKE VBAP-MVGR4,
             MVGR5 LIKE VBAP-MVGR5,
             KUNNR LIKE VBPA-KUNNR,
             POSTCODE1 LIKE ADRC-POST_CODE1,
             POBOX LIKE ADRC-PO_BOX,
             NAME1 LIKE ADRC-NAME1,
             NAME2 LIKE ADRC-NAME2,
             CITY1 LIKE ADRC-CITY1,
             CITY2 LIKE ADRC-CITY2,
             COUNTRY LIKE ADRC-COUNTRY,
             STREET LIKE ADRC-STREET,
             STRSUPPL1 LIKE ADRC-STR_SUPPL1,
             STRSUPPL2 LIKE ADRC-STR_SUPPL2,
             STRSUPPL3 LIKE ADRC-STR_SUPPL3,
             NRART LIKE TPAR-NRART,
             VTEXT1 LIKE TPART-VTEXT,
             PARVW LIKE TPART-PARVW,
             BEZE_I LIKE TVLVT-BEZEI,
             VTEXT LIKE V_T178-VTEXT,
             V_TEXT like V_T188-VTEXT,
             BEZEI1 LIKE TVM1T-BEZEI,
             BEZEI2 LIKE TVM2T-BEZEI,
             BEZEI3 LIKE TVM3T-BEZEI,
             BEZEI4 LIKE TVM4T-BEZEI,
             BEZEI5 LIKE TVM5T-BEZEI,
             VTEXT2 LIKE TVKGGT-VTEXT,
             SMTP_ADDR LIKE ADR6-SMTP_ADDR,

    hi there,
    i want to fetch data from all the fields i ahve given here .It will be a join statement.
    the important thing is I need all the values of vbeln in leftside
    as output.

  • Recent Switcher from XLS needs help on Formatting UPC Codes in Cells

    I frequently need to have 11 and 12 digit UPCs in my cells. Many of them have a leading ZERO. XLS has a way to custom format for them so it does not drop the leading zero or you can put it back if it has been dropped on opening.
    Is there a way to custom format a text cell to include that leading ZERO or put it back in a column it has been dropped from?

    OK,
    I wished to know how they must be displayed.
    In column B I used the formula:
    =LEFT(RIGHT("00000"&A,12),1)&" "&MID(RIGHT("00000"&A,12),2,5)&"-"&MID(RIGHT("00000"&A,12),7,5)&" "&RIGHT(RIGHT("00000"&A,12),1)
    In column C I used:
    =LEFT(RIGHT("00000"&A,12),6)&" "&RIGHT(RIGHT("00000"&A,12),6)
    If you tell me which is the correct format I would be able to give an AppleScript doing the formatting easily with no auxiliary column.
    Yvan KOENIG (from FRANCE vendredi 21 mars 2008 20:33:37)

  • Need help for data extraction from table

    Hi all,
    i have a requirement where i need to identify fields PERNR,BEGDA,ENDDA,REASN,fmlan in table PA0672 .If all these field are identical for an employee in more than one record, then greatest value of REMAN field out of these records should be displayed only in output.
                                            How would i go about it?
    Thanks
    Snehasish

    select PERNR BEGDA ENDDA REASN REMAN
      into table itab
      from PA0672.
    * delete all but the highest reman value for each pernr
    sort itab by pernr reman descending.
    delete adjacent duplicates from itab comparing PERNR BEGDA ENDDA REASN.

  • Need help w a popup based on cell value

    I have a spreadsheet that when the value of any cell in column  H between rows 2 & 71 is greater than cell K1 I would like a popup to say "Winner"
    Thank you in advance for any help
    Dustin Shepard

    Hello,
    where would you like the popup? How are the values in H2 to H71 getting changed? If they are changed by manual user entry, you could use a worksheet change event like this:
    copy the code below. Right-click the sheet tab, select "View Code" and paste the code into the big, white code window:
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Intersect(Target, Range("H2:H71")) Is Nothing Then
            If Target > Range("K1") Then
                MsgBox ("The Winner is cell " & Target.Address)
            End If
        End If
    End Sub
    Close the VBA editor and change a value in your sheet.
    If this is not what you want to achieve, please provide more background.
    cheers, teylyn

Maybe you are looking for

  • A better way to determine the current state of the FLVPlayback component?

    Below is the AS3 code I have used to display images (MCs) over an instance of the FLVPlayback component.  These images (one for loading, one for the title) are to appear – or disappear – according to the current state of the FLVPlayback component.  I

  • Moved iTunes Library to external drive- now can't move iPad purchase to Mac

    I moved my iTunes Library to an external drive because I didn't have enough internal HD space to move a movie purchased on the iPad to my Mac. Now iTunes won't sync my iPad - and wants to reformat it - because it says it was formatted on another Mac.

  • Windows 8.1 won't load on my i mac

    Hi all i need to run a electrical test cert program on my Mac that requires windows, i have just purchased a new copy of windows 8.1 but my superdrive does not seem to recognise  either the 32 or 64bit CD disk via bootcamp, i also purchased a program

  • Serial Number issue with Photoshop Elements

    Hello, I have an old laptop which has been misplaced/lost which has Photoshop Elements installed on it. I now have a new machine and wish to install it on the new machine but it wont let me. I gather because of the fact that it is licensed for 1 mach

  • IPhone 4 Spring Board crashes when I slide the top menu

    Every time I slide down the top menu, Spring Board crashes: it appears that it is resetting, showing the black screen with the white apple logo for a few seconds, then the screen goes black for a few seconds and then iOS is back, like the crash didn'