Seveval columns in a JMenu ?

Hello,
i build a JMenu with many items (20) which are very small (kind of gif smileys),
so i'd like to make 4 columns instead of a long one.
Is there any solution except a complex JTable ?
thx !!!

myMenu.getPopupMenu().setLayout(new GridLayout(10,0));

Similar Messages

  • Add and remove columns from JTable

    Help me please!
    A try to remove column from JTable. It's removed, but when I try to add column in table, then I get all old (removed early) columns + new column....
    I completely confused with it.....
    Here is my code for remove column:
    class DelC implements ActionListener
              public void actionPerformed (ActionEvent e )
                   int [] HowManyColDelete = table.getSelectedColumns();
                   if (HowManyColDelete.length !=0)
                        TableColumnModel tableCModel = table.getColumnModel();
                        for (int i = HowManyColDelete.length-1; i>-1; i--)
                             table.getColumnModel().removeColumn (tableCModel.getColumn (HowManyColDelete [ i ]));
                   else
                          JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
         }

    It's little ex for me, I just try understand clearly how it's work (table models i mean). Here is code. All action with tables take place through menu items.
    My brain is boiled, I've try a lot of variants of code, but did't get right result :((
    It's code represent problem, which I've describe above. If you'll try remove column and then add it again, it will be ma-a-a-any colunms...
    I understand, that my code just hide columns, not delete from table model....
    But now I have not any decision of my problem...
    Thanks a lot for any help. :)
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.table.DefaultTableModel;
    class JTableF extends JFrame
         Object [] [] data = new Object [0] [2];
         JTable table;
         DefaultTableModel model;
         String [] columnNames = {"1", "2"};
         TableColumnModel cm;
         JTableF()
              super("Table features");
              setDefaultLookAndFeelDecorated( true );
              setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
              JMenuBar MBar = new JMenuBar();
              JMenu [] menus =  {new JMenu("A"), new JMenu("B")};
              JMenuItem [] menu1 =  {new JMenuItem("Add row"), new JMenuItem("Delete row", 'D'),  new JMenuItem("Add column"), new JMenuItem("Delete column")};
              menu1 [ 0 ].addActionListener(new AddL());
              menu1 [ 1 ].addActionListener(new DelL());
              menu1 [ 2 ].addActionListener(new AddC());
              menu1 [ 3 ].addActionListener(new DelC());
              for (int i=0; i<menu1.length; i++)
                   menus [ 0 ].add( menu1 [ i ]);
              for (int i=0; i<menus.length; i++)
                   MBar.add(menus );
              JPanel panel = new JPanel ();
              model = new DefaultTableModel( data, columnNames );
              table = new JTable (model);
              cm = table.getColumnModel();
              panel.add (new JScrollPane(table));
              JButton b = new JButton ("Add row button");
              b.addActionListener(new AddL());
              panel.add (b);
              setJMenuBar (MBar);
              getContentPane().add(panel);
              pack();
              setLocationRelativeTo (null);
              setVisible (true);
         class DelC implements ActionListener
              public void actionPerformed (ActionEvent e )
                   int [] HowManyColDelete = table.getSelectedColumns();
                   if (HowManyColDelete.length !=0)
                        TableColumnModel tableCModel = table.getColumnModel();
                        for (int i = HowManyColDelete.length-1; i>-1; i--)
                             int vizibleCol = table.convertColumnIndexToView(HowManyColDelete [ i ]);
                             tableCModel.removeColumn (tableCModel.getColumn (vizibleCol));
                        //cm = tableCModel;
                   else
                        JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Column is not selected!");
         class AddC implements ActionListener
              public void actionPerformed (ActionEvent e)
                   //table.setColumnModel(cm);
                   Object NewColumnName = new String();
                   NewColumnName = JOptionPane.showInputDialog ("Input new column name", "Here");
                   int i = model.getRowCount();
                   int j = model.getColumnCount();
                   Object [] newData = new Object [ i ];
                   model.addColumn ( NewColumnName, newData);
         class AddL implements ActionListener
              public void actionPerformed (ActionEvent e)
                   int i = model.getColumnCount();
                   Object [] Row = new Object [ i ];
                   model.addRow ( Row );
         class DelL implements ActionListener
              public void actionPerformed (ActionEvent e)
                   int [] HowManyRowsDelete = table.getSelectedRows();
                   if (HowManyRowsDelete.length !=0)
                        for (int k = HowManyRowsDelete.length-1; k>-1; k--)
                             model.removeRow (HowManyRowsDelete[k]);
                   else
                        JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "Row is not selected!");
         public static void main (String [] args)
              javax.swing.SwingUtilities.invokeLater(new Runnable()
                   public void run()
                        JTableF inst = new JTableF();

  • JTable in a JMenu

    It is posibble to add a jtable in jmenu ??

    This is what i;m trying to get : http://kynamar.dublu.ro/java/emoticoane.html
    Follow the link please.
    I have a jtable with all the icons but i don't know how to add to jmenu!
    In that thread the jmenu have 2 columns,not 10 for example!
    This is my jtable of icons
    import java.util.Enumeration;
    import java.util.Vector;
    import javax.swing.ImageIcon;
    import javax.swing.table.AbstractTableModel;
    * @author marian.radu
    public class ModelTabelSmyleys extends AbstractTableModel {
        protected Vector<ImageIcon> data;
        protected Vector<String> columnNames ;
        /** Creates a new instance of ModelTabelSmyleys */
        public ModelTabelSmyleys() {
            data=new Vector<ImageIcon>();
            columnNames=new Vector<String>();
            columnNames.addElement("");
            columnNames.addElement("");
            columnNames.addElement("");
            columnNames.addElement("");
            //columnNames.addElement("");
            //columnNames.addElement("");
            ObiectSmyleys smyleys=new ObiectSmyleys();
            smyleys.initializare();
            Enumeration enumeratie=smyleys.getContinut().keys();
                                while(enumeratie.hasMoreElements())
                                    String urmatorul=enumeratie.nextElement().toString();
                                           data.addElement(smyleys.getContinut().get(urmatorul));
        public int getRowCount() {
        return data.size() / getColumnCount();
      public int getColumnCount(){
        return columnNames.size();
      public String getColumnName(int columnIndex) {
        String colName = "";
        if (columnIndex <= getColumnCount())
           colName = columnNames.elementAt(columnIndex);
        return colName;
      public Class getColumnClass(int columnIndex){
        return ImageIcon.class;
      public boolean isCellEditable(int rowIndex, int columnIndex) {
        return false;
      public void removeRow(int rowIndex)
          for(int i = 0;i < getColumnCount();i++)
          data.removeElementAt((rowIndex * getColumnCount()));
      public Object getValueAt(int rowIndex, int columnIndex) {
        return data.elementAt
            ( (rowIndex * getColumnCount()) + columnIndex);
      public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
        data.setElementAt((ImageIcon)aValue,(rowIndex * getColumnCount()) + columnIndex);
    import java.io.File;
    import java.io.IOException;
    import java.util.Hashtable;
    import javax.swing.ImageIcon;
    import javax.swing.JLabel;
    * @author marian.radu
    public class ObiectSmyleys {
        private Hashtable<String,ImageIcon> continut=new Hashtable<String,ImageIcon>();
        /** Creates a new instance of ObiectSmyleys */
        protected String calea_dir_cur()
                String cale=""; //initializare cale nula
                try
                    File f=new File(".");
                    cale=f.getCanonicalPath();
                }catch(IOException err){}
                return cale;
        public Hashtable<String,ImageIcon> getContinut()
            return continut;
        public void addSmyleys(String toolTip,String nume_fisier)
            //JLabel label=new JLabel();
            ImageIcon imagine=new ImageIcon(calea_dir_cur()+"\\smiley\\"+nume_fisier);
            //label.setIcon(imagine);
            //label.setToolTipText(toolTip);
            continut.put(toolTip,imagine);
        public ObiectSmyleys() {
        public void initializare()
           addSmyleys(":-)","1.png");
           addSmyleys(":-(","2.png");
           addSmyleys(";-)","3.png");
           addSmyleys(":-D","4.png");
           addSmyleys(":-P","10.png");
           addSmyleys(":-*","11.png");
           addSmyleys(":-X","8.png");
           addSmyleys(":-))","20.png");
        public static void main(String[] args)
            ObiectSmyleys smyle=new ObiectSmyleys();
            System.out.println(smyle.getContinut().size());
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.text.TabExpander;
    * @version 1.0 06/19/99
    public class AnimatedTableIconExample extends JFrame {
      public AnimatedTableIconExample(){
        super( "AnimatedIconTable Example" );
        final JTable table = new JTable(new ModelTabelSmyleys());
        table.addMouseListener(new MouseAdapter()
        public void mouseClicked(MouseEvent e)
            if (e.getClickCount()==1)
                System.out.println("De 2 ori");
                System.out.println(table.getIntercellSpacing());
               System.out.println(table.getValueAt(table.getSelectedRow(),table.getSelectedColumn()));
        table.setAutoResizeMode(table.AUTO_RESIZE_OFF);
        for(int i=0;i<table.getModel().getColumnCount();i++)
            table.getColumnModel ().getColumn(i).setMaxWidth(18);
        table.setRowHeight(18);
        table.setColumnSelectionAllowed(false);
        table.setRowSelectionAllowed(false);
        table.setCellSelectionEnabled(true);
        table.setIntercellSpacing(new Dimension(0,0));
        //setImageObserver(table);
        JScrollPane pane = new JScrollPane(table);
        getContentPane().add(pane);
        table.repaint();
      private void setImageObserver(JTable table) {
        TableModel model = table.getModel();
        int colCount = model.getColumnCount ();
        int rowCount = model.getRowCount();
        for (int col=0;col<colCount;col++) {
          if (ImageIcon.class == model.getColumnClass(col)) {
            for (int row=0;row<rowCount;row++) {
              ImageIcon icon = (ImageIcon)model.getValueAt(row,col);
              if (icon != null) {
                icon.setImageObserver(new CellImageObserver(table, row, col));
      class CellImageObserver implements ImageObserver {
        JTable table;
        int row;
        int col;
        CellImageObserver(JTable table,int row, int col) {
          this.table = table;
          this.row   = row;
          this.col   = col;
        public boolean imageUpdate(Image img, int flags,
                       int x, int y, int w, int h) {
          if ((flags & (FRAMEBITS|ALLBITS)) != 0) {
            Rectangle rect = table.getCellRect(row,col,false);
            table.repaint(rect);
          return (flags & (ALLBITS|ABORT)) == 0;
      public static void main(String[] args) {
        AnimatedTableIconExample frame = new AnimatedTableIconExample();
        frame.addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
        frame.setSize( 300, 150 );
        frame.setVisible(true);
    }

  • Updating a JTable by hiding/displaying columns

    I have a customizable JTable where I display/hide columns according to a users' selection criteria. My code works fine for hiding/displaying columns if the Jtable is opened for the fist time, but doesnot work if I want to hide columns in already displayed table.How do I do it?? Any clue?? I tried
    myTabModel.fireTableDataChanged();
    but this only works for updating the table data...it does not hide columns for me... when I hide column I just remove desired column like this:
    myTable.removeColumn(myTable.getColumn("Column 3"));

    Here is the sample code I tried. It worked without any invalidate or repaint or updateUI(). generated using NetBeans
    check for <==== for the line of code doing this
    * TableTest.java
    * Created on October 9, 2002, 1:42 PM
    * @author  Anki Reddy Nelaturu
    public class TableTest extends javax.swing.JFrame {
        /** Creates new form TableTest */
        public TableTest() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {
            jScrollPane1 = new javax.swing.JScrollPane();
            jTable1 = new javax.swing.JTable();
            jButton1 = new javax.swing.JButton();
            jTextField1 = new javax.swing.JTextField();
            menuBar = new javax.swing.JMenuBar();
            fileMenu = new javax.swing.JMenu();
            openMenuItem = new javax.swing.JMenuItem();
            saveMenuItem = new javax.swing.JMenuItem();
            saveAsMenuItem = new javax.swing.JMenuItem();
            exitMenuItem = new javax.swing.JMenuItem();
            editMenu = new javax.swing.JMenu();
            cutMenuItem = new javax.swing.JMenuItem();
            copyMenuItem = new javax.swing.JMenuItem();
            pasteMenuItem = new javax.swing.JMenuItem();
            deleteMenuItem = new javax.swing.JMenuItem();
            helpMenu = new javax.swing.JMenu();
            contentsMenuItem = new javax.swing.JMenuItem();
            aboutMenuItem = new javax.swing.JMenuItem();
            getContentPane().setLayout(null);
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            jTable1.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null},
                    {null, null, null, null}
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
            jScrollPane1.setViewportView(jTable1);
            getContentPane().add(jScrollPane1);
            jScrollPane1.setBounds(80, 30, 230, 120);
            jButton1.setText("jButton1");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            getContentPane().add(jButton1);
            jButton1.setBounds(170, 180, 81, 26);
            jTextField1.setText("jTextField1");
            getContentPane().add(jTextField1);
            jTextField1.setBounds(60, 190, 63, 20);
            fileMenu.setText("File");
            openMenuItem.setText("Open");
            fileMenu.add(openMenuItem);
            saveMenuItem.setText("Save");
            fileMenu.add(saveMenuItem);
            saveAsMenuItem.setText("Save As ...");
            fileMenu.add(saveAsMenuItem);
            exitMenuItem.setText("Exit");
            exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    exitMenuItemActionPerformed(evt);
            fileMenu.add(exitMenuItem);
            menuBar.add(fileMenu);
            editMenu.setText("Edit");
            cutMenuItem.setText("Cut");
            editMenu.add(cutMenuItem);
            copyMenuItem.setText("Copy");
            editMenu.add(copyMenuItem);
            pasteMenuItem.setText("Paste");
            editMenu.add(pasteMenuItem);
            deleteMenuItem.setText("Delete");
            editMenu.add(deleteMenuItem);
            menuBar.add(editMenu);
            helpMenu.setText("Help");
            contentsMenuItem.setText("Contents");
            helpMenu.add(contentsMenuItem);
            aboutMenuItem.setText("About");
            helpMenu.add(aboutMenuItem);
            menuBar.add(helpMenu);
            setJMenuBar(menuBar);
            pack();
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
            jTable1.removeColumn(jTable1.getColumnModel().getColumn(Integer.parseInt(jTextField1.getText())));        // <========
        private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
            System.exit(0);
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            new TableTest().show();
        // Variables declaration - do not modify
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JMenu fileMenu;
        private javax.swing.JMenuItem exitMenuItem;
        private javax.swing.JButton jButton1;
        private javax.swing.JMenuItem saveAsMenuItem;
        private javax.swing.JMenuItem saveMenuItem;
        private javax.swing.JMenuItem copyMenuItem;
        private javax.swing.JMenuItem pasteMenuItem;
        private javax.swing.JMenuItem cutMenuItem;
        private javax.swing.JMenuItem openMenuItem;
        private javax.swing.JMenuBar menuBar;
        private javax.swing.JMenu editMenu;
        private javax.swing.JMenuItem aboutMenuItem;
        private javax.swing.JMenuItem contentsMenuItem;
        private javax.swing.JMenu helpMenu;
        private javax.swing.JTextField jTextField1;
        private javax.swing.JMenuItem deleteMenuItem;
        private javax.swing.JTable jTable1;
        // End of variables declaration
    }

  • Swing JMenu + mysql

    Hi,
    I try make to import data from Mysql to JMenu, Could somebody help me.
    (Table Products, column productid and productname).
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    public class MenuWithMysql extends JFrame
         static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";       
         static final String DATABASE_URL = "jdbc:mysql://localhost:3306/menuwithmysql";
         public static void main(String[] args)
              Connection connection = null;
              Statement statement = null;
              try
             Class.forName( JDBC_DRIVER ); // load database driver class
             // establish connection to database
             connection = DriverManager.getConnection( DATABASE_URL, "", "" );
             // create Statement for querying database
             statement = connection.createStatement();
             System.out.println("MySQL Successfully connected");
        /*     ResultSet rs = statement.executeQuery("SELECT * FROM products");
             if (rs.next())
                  String productid = rs.getString("productid");
                  String productname = rs.getString("productname");
                  System.out.println(productid + "     " + productname);
         } // end try
          catch ( SQLException sqlException )
             sqlException.printStackTrace();
             System.exit( 1 );
          } // end catch
          catch ( ClassNotFoundException classNotFound )
             classNotFound.printStackTrace();           
             System.exit( 1 );
          } // end catch
          finally // ensure statement and connection are closed properly
             try                                                       
                statement.close();                                     
                connection.close();                                    
             } // end try                                              
             catch ( Exception exception )                       
                exception.printStackTrace();                                    
                System.exit( 1 );                                      
             } // end catch                                            
          } // end finallytry
            JFrame frame = new JFrame("Menu With Mysql");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 300);
            frame.setVisible(true);
            frame.setLocationRelativeTo(null);
           JMenuBar menuBar = new JMenuBar();
          JMenu jMenu1 = new JMenu( "Products" );
          JMenuItem jMenuItem1 = new JMenuItem( "books" );
          JMenuItem jMenuItem2 = new JMenuItem( "hardware" );
          menuBar.add(jMenu1);
          jMenu1.add(jMenuItem1);
          jMenu1.add(jMenuItem2);
          frame.setJMenuBar(menuBar);
    }

    thank you ignignokt84, it work fine.
    I have another question (about JMenu)
    DB that use 2 TABLES
    a) categories with columns categories_id | parent_id | sort_order |
    b) categories_description with columns categories_id | categories_name
    categories_id | parent_id | sort_order |
    1 | 0 | 1 |
    2 | 0 | 2 |
    3 | 1 | 1 |
    4 | 1 | 2 |
    8 | 2 | 1 |
    9 | 2 | 2 |
    categories_id | categories_name |
    1 | Books |
    2 | Hardware |
    3 | Java Book |
    4 | Mysql Book |
    8 | keyboard |
    9 | mouse |
    I try make JMenu with submenu
    JMenu = Books {Submenu = Java Book, Mysql Book}
    JMenu = Hardware {Submenu = keyboard, mouse}
    import javax.swing.event.*;
    import java.sql.*;
    public class Test
         static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";       
         static final String DATABASE_URL = "jdbc:mysql://localhost:3306/DBname";
        public Test()
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 300);
            JMenu menu1 = new JMenu("Products");
            JMenu subMenu1 = new JMenu();
            JMenu subMenu2 = new JMenu("Hardware");
           JMenu subMenu4 = new JMenu();
            Connection connection = null;
              Statement statement = null;
              try
                   Class.forName( JDBC_DRIVER ); // load database driver class
                   // establish connection to database
                   connection = DriverManager.getConnection( DATABASE_URL, "", "" );
                   // create Statement for querying database
                   statement = connection.createStatement();
                ResultSet rs =  statement.executeQuery("select CATEGORIES.categories_id, CATEGORIES_DESCRIPTION.categories_name, CATEGORIES.parent_id from  CATEGORIES, CATEGORIES_DESCRIPTION where CATEGORIES.parent_id = 0  AND CATEGORIES.categories_id = CATEGORIES_DESCRIPTION.categories_id");// AND CATEGORIES.parent_id = CATEGORIES.categories_id //select * from products
                while(rs.next())
                  menu1.add(new JMenu(rs.getString("categories_name")));
                 ResultSet rs2 =  statement.executeQuery("select CATEGORIES.categories_id, CATEGORIES_DESCRIPTION.categories_name, CATEGORIES.parent_id from  CATEGORIES, CATEGORIES_DESCRIPTION where CATEGORIES.parent_id = 1  AND CATEGORIES.categories_id = CATEGORIES_DESCRIPTION.categories_id");// AND CATEGORIES.parent_id = CATEGORIES.categories_id //select * from products
                while(rs2.next())
                    subMenu1.add(new JMenuItem(rs2.getString("categories_name")));
                rs.close();
                rs2.close();
            }catch(Exception e) {
                e.printStackTrace();
            menu1.add(subMenu1);
            JMenuBar menuBar = new JMenuBar();
            menuBar.add(menu1);
            frame.setJMenuBar(menuBar);
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            new Test();
    }this code giveme JMenu then I try another ResultSet2, but nothing , could you HELP ME, I try many things but I thing that this is wrong way.
    I try :
    rs1.absolute(1);
    rs1.absolute(2);and then
    while(rs3.next())But don't forgot sort_order column.

  • Re: Column is not getting displayed in the BI report

    Hello Gurus,
    I have developed a BI report with more number of parameters.
    Case 1:
    When i run my report , I am able to see data for particular condition but one column doesn't show any thing. All the rows in the column are blank.
    Case 2
    I tried to put the blank column as parameter, The Program works with out displaying that column data.
    I am not sure where it is going wrong. I tried running the code in toad and i am able to see the data.
    I have checked the code, Parameter description, length, Template and data definition.
    Please help.
    Thanks,
    Sreekanth

    Hi ,
    For that column did u changed any alias name in the query...
    check ur template once by loading the xml data...
    check that column form field that matches with the xml tag or not..
    Thanks,
    Ananth

  • Query help: query to return column that represents multiple rows

    I have a table with a name and location column. The same name can occur multiple times with any arbitrary location, i.e. duplicates are allowed.
    I need a query to find all names that occur in both of two separate locations.
    For example,
    bob usa
    bob mexico
    dot mexico
    dot europe
    hal usa
    hal europe
    sal usa
    sal mexico
    The query in question, if given the locations usa and mexico, would return bob and sal.
    Thanks for any help or advice,
    -=beeky

    How about this?
    SELECT  NAME
    FROM    <LOCATIONS_TABLE>
    WHERE   LOCATION IN ('usa','mexico')
    GROUP BY NAME
    HAVING COUNT(DISTINCT LOCATION) >= 2Results:
    SQL> WITH person_locations AS
      2  (
      3          SELECT 'bob' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      4          SELECT 'bob' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      5          SELECT 'dot' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      6          SELECT 'dot' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      7          SELECT 'hal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      8          SELECT 'hal' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      9          SELECT 'sal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
    10          SELECT 'sal' AS NAME, 'Mexico' AS LOCATION FROM DUAL
    11  )
    12  SELECT  NAME
    13  FROM    person_locations
    14  WHERE   LOCATION IN ('USA','Mexico')
    15  GROUP BY NAME
    16  HAVING COUNT(DISTINCT LOCATION) >= 2
    17  /
    NAM
    bob
    salHTH!
    Edited by: Centinul on Oct 15, 2009 2:25 PM
    Added sample results.

  • Unable to capture the adf table column sort icons using open script tool

    Hi All,
    I am new to OATS and I am trying to create script for testing ADF application using open script tool. I face issues in recording two events.
    1. I am unable to record the event of clicking adf table column sort icons that exist on the column header. I tried to use the capture tool, but that couldn't help me.
    2. The second issue is I am unable to capture the panel header text. The component can be identified but I was not able to identify the supporting attribute for the header text.

    Hi keerthi,
    1. I have pasted the code for the first issue
    web
                             .button(
                                       122,
                                       "/web:window[@index='0' or @title='Manage Network Targets - Oracle Communications Order and Service Management - Order and Service Management']/web:document[@index='0' or @name='1824fhkchs_6']/web:form[@id='pt1:_UISform1' or @name='pt1:_UISform1' or @index='0']/web:button[@id='pt1:MA:0:n1:1:pt1:qryId1::search' or @value='Search' or @index='3']")
                             .click();
                        adf
                        .table(
                                  "/web:window[@index='0' or @title='Manage Network Targets - Oracle Communications Order and Service Management - Order and Service Management']/web:document[@index='0' or @name='1c9nk1ryzv_6']/web:ADFTable[@absoluteLocator='pt1:MA:n1:pt1:pnlcltn:resId1']")
                        .columnSort("Ascending", "Name" );
         }

  • Implementing BADI MD_ADD_COL_EZPS for MD04 custom column

    Hi there,
    I'm using BADI MD_ADD_COL_EZPS to display 3 new buttons and three new columns in MD04.
    For each line item that is displayed, the custom column is filled, after the button is hit -This works fine.
    My Question is:
    Is there any way to limit the value that is filled into the new column so that it only appears on the FIRST line item/row?
    (At the moment it is repeated all the way down the page - the new value is a material characteristic, so doesn't change, will always be the same for each line)
    I've looked at all the available structures/tables in the FILL_ADD_COLUMNS method of the BADI, and none seem suitable
    to determine the "first" row. (ie. something like the way SY-TABIX or SY-INDEX might be used)
    Any help appreciated.
    Thanks,
    David.

    Hi Shubhendu,
    in the method 'ACTIVATE_ADD_COLUMNS', you can set the flag EZ1_MODE to '1' to make the first column visible always. (it's been a while, but I think setting it to '2' makes it visible when the button is pressed.)
    Same applies to EZ2_MODE for second column, EZ3_MODE for third.
    look at the flags/parameters in this method, and also in FILL_ADD_COLUMNS, to fill the data.
    here you need to fill structure EMDEZX_USEX1 (for column 1) etc.
    The code is hit for each record displayed in MD04
    Hopefully this helps you.
    Regards,
    David

  • APEX-The manullay created column is not getting updated in the database

    Dear all
    I have a form on page, which is created along with a report using Form on a Table with Report option. From the form I have deleted one field and recreated manullay as set the property as database column. When I am calling from the report page (using defualt edit option) the value is showing there, but if I am 'Apply Changes' , the column value in database is get updated with null.
    Please help
    DJ.

    This is the SQL and PL/SQL forum.
    Please re-post this on the APEX forum.
    Oracle Application Express (APEX)

  • Not null and enable or disable  column in tabular form

    Hi,
    Using apex version 4.1 and working on tabular form.
    ACT_COA_SEGMENT_MAS is Master table
    and
    ACT_SEGMENT_VALUES_MAS is detail table
    I have entered 8 rows in master table and PARENT_SEGMENT_ID is column in master table which is null able. If i specified PARENT_SEGMENT_ID with value in master table then in detail table there is column PARENT_ID that should not be null and enable.
    How i can enable or disable column when in master table PARENT_SEGMENT_ID column is null then in detail table PARENT_ID column should disable and vice versa.
    I have created tabular form on Detail table. before insert into the tabular form Check in master table in first entry if PARENT_SEGMENT_ID is not null in first row of master table then in tabular form PARENT_ID should enable and not null able in corresponding to this first row id's lines in tabular form.
    Same should check for second row in master table if PARENT_SEGMENT_ID is not null then entered rows with PARENT_ID into tabular form corresponding to 2nd id in master table should not nullable and column should enable in tabular form.
    Thanks & Regards
    Vedant
    Edited by: Vedant on Jan 9, 2013 9:12 PM

    Vedant,
    You need to create you own manual tabular form and not use the wizard.
    Using APEX_ITEM api you should be build you own form and you will be able to control how you wan to display the rows. (See Link [Apex Item Help|http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_item.htm#CACEEEJE] )
    select case when PRIMARY_TABLE_COLUMN is null then APEX_ITEM.DISPLAY_AND_SAVE(3 , DETAIL_COLUMN ) else APEX_ITEM.TEXT(2,detail_column) end "ALIAS" from detail table
    Hope that help.
    Vivek

  • Converting null and blank to NA in a column of a database table

    Hi
    This is a simple thing but is giving me a hard time. I need to change the values coming as null or blank to NA . The values comes in a flat file as a source and I need to laod it convertign to NA in database. I wrote the expression as
    ISNULL([NPS Rating]) ? "NA" : [NPS Rating] in a derived column  and checked the box " retain null values from source as null values in data flow:
    However it is not working instead giving the error as : Truncation may occur due to inserting data from dataflow column from  column name" with a length of ...........
    Can any help me to sort out this problem. Am I writing the correct expression?
    Thank you so much for your help in advance.
    Kind regards
    Rama

    In your conditional result force it to the same length and type and make sure it is long enough, e.g.
    ISNULL([NPS Rating])==TRUE ? (DT_WSTR,256)"NA" : (DT_WSTR, 256)[NPS
    Rating]
    and if the data comes from a flat file, the test will most likely need to test for zero length string too, or trim spaces and then test for zero length.
    LEN(TRIM([NPS Rating])) == 0 || ISNULL...
    Jan D'Hondt - SQL server BI development

  • Get column values from list of values programmatically

    hi all
    how i get column values from list of values programmatically in the
    returnPopupDataListener method

    If this answers your question , please close this thread by marking it as answered.
    Thanks

  • How to delete file from column after upload with messageFileUpload?

    Which is the way to delete a file from column i have uploaded with messageFileUpload. After uploading the system generates a link to download the file. But how i can delete the file?

    Thank you! Syncing has always scared me...basically I am just afraid to lose any photos. But it worked. Again thank you

  • In ALV report is possible to display the subtotals in separate column

    Hi,
    I have made one ALV report, i need to show the subtotals of ekpo-brtwr (Gross Value)  grouped by or sorted by
    ekko-ebeln (Purshasing Doc) but in separate column  not at the end of the line items of each purshasing doc
    any idea how can i do this?
    let us say i have the following cols in my report:
    ekko-bukrs
    ekko-ebeln,
    ekko-aedat,
    kko-lifnr,
    ekpo-brtwr
    i want to add one more col for example (T-Gross) and to fill it with the suptotals of (ekpo-brtwr) sorted by the
    ekko-ebeln (Purshasing Doc).
    thanks a lot.

    If you need one more column, then you need to expand the field catalog table and data table as you did for all other fields and you need to code the logic to calculate the subtotals and populate the new column, but if you want to have row, that will be easy. For more info you can [refer |http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/4063c42a-2549-2c10-fab6-a8c99d98b9b5?quicklink=index&overridelayout=true]this:

Maybe you are looking for

  • Last iTunes update 10.2.2.12 deleted all music files and all artwork

    Within the last month I got a notice to upgrade Apple iTunes and Quicktime software which I did not thinking anything about it.  I have used myiPod since then but not in iTunes at all and no synching.  I have about 225 CD's loaded in iTunes plus some

  • Execute mbean methods in a separate dedicated thread.

    Hi all, I have an MBean and I want that all its methods be executed in swing thread. [Common swing confinement rules]. Is there a way to do this by jmx rulebook? One way i though of was to use a proxy class with an inocationhandler which executes the

  • Video clips on iweb pages

    I have several small quicktimes on several of my iweb pages to show samples of my work. Is there a way in iweb that I can place a thumbnail that visitors can click on to open that specific video file? I'm looking for a way to avoid a visitor having t

  • I have a disc to install Lightroom 4, but my computer does not have a disc drive

    Is there a way I can still download this software onto my computer?  I have the serial number that came with the disc

  • About range partition

    Dear Friends , I am using Oracle10g . I have to create a range partition like below : CREATE TABLE EMP EMPNO NUMBER(4), ENAME VARCHAR2(10 BYTE), JOB VARCHAR2(9 BYTE), MGR NUMBER(4), HIREDATE DATE, SAL NUMBER(7,2), COMM NUMBER(7,2), DEPTNO NUMBER(2) P