Order by multiple columns and ROWNUM

Hi -
I am trying to use rownum in colloboration with order by multiple columns but I guess I am doing something wrong
and I am always getting a single row per emp_id rather than getting single row for a particular emp_id,role_id,inst_id,exp_date.
Below is the table ddl and data insertion script.
====
create table tab_details
(emp_id varchar2(50),
role_id integer,
inst_id integer,
exp_date date,
chk_ind char(1),
trans_type char(1),
trans_date date);
insert all
into tab_details values ('JBRAMS',12,4556,'07/15/2011','Y','U','05/21/2011')
into tab_details values ('JBRAMS',12,4556,'07/15/2011','N','U','05/22/2011')
into tab_details values ('JBRAMS',12,4556,'07/15/2011','N','D','05/23/2011')
into tab_details values ('JBRAMS',12,4556,'07/15/2011','N','U','05/24/2011')
into tab_details values ('KCASOT',98,9001,'08/03/2011','Y','U','04/11/2011')
into tab_details values ('KCASOT',98,9001,'08/03/2011','N','U','04/12/2011')
into tab_details values ('KCASOT',98,9001,'08/03/2011','N','U','04/13/2011')
into tab_details values ('JBRAMS',43,7875,'06/28/2011','Y','U','03/19/2011')
into tab_details values ('JBRAMS',43,7875,'06/28/2011','N','U','03/20/2011')
into tab_details values ('BHAYEN',28,4098,'07/01/2011','Y','U','02/13/2011')
into tab_details values ('BHAYEN',28,4098,'07/01/2011','N','U','02/14/2011')
into tab_details values ('BHAYEN',28,4098,'07/01/2011','N','D','02/15/2011')
into tab_details values ('BHAYEN',28,4098,'07/01/2011','Y','U','02/16/2011')
into tab_details values ('BHAYEN',28,4098,'07/01/2011','N','U','02/17/2011')
into tab_details values ('BHAYEN',28,4098,'07/01/2011','N','U','02/18/2011')
select * from dual;
commit;
====
So for the first four rows inserted above, I need only following row:
'JBRAMS',12,4556,'07/15/2011','N','U','05/22/2011'
Basically, I need only the rows with chk_ind='N' and trans_type<>'D' and if there is a row with
chk_ind='N' and trans_type='U' after trans_type='D" for a emp_id,role_id,inst_id,exp_date then it should be ignored.
Following are the only rows I am looking for:
'JBRAMS',12,4556,'07/15/2011','N','U','05/22/2011'
'KCASOT',98,9001,'08/03/2011','N','U','04/12/2011'
'JBRAMS',43,7875,'06/28/2011','N','U','03/20/2011'
'BHAYEN',28,4098,'07/01/2011','N','U','02/14/2011'
'BHAYEN',28,4098,'07/01/2011','N','U','02/17/2011'
Please share your thought over this.
Thanks,
-Seenu

Hi, Seenu,
Seenu001 wrote:
Hi -
I am trying to use rownum in colloboration with order by multiple columns but I guess I am doing something wrong
and I am always getting a single row per emp_id rather than getting single row for a particular emp_id,role_id,inst_id,exp_date.Thanks for posting the CREATE TABLE and INSERT statements. It would help if you posted your query, too: even if it's not qute right, it could help to understand the problem, and modifying it might be more efficient than writing a completely new query.
What are the multiple columns you are sorting on? Why isn't trans_date enough?
Here's one way:
WITH     got_okay     AS
     SELECT     t.*
     ,     CASE
               WHEN  LAG (chk_ind)    OVER ( PARTITION BY  emp_id
                                 ,           role_id
                                 ,           inst_id
                                 ,           exp_date
                                 ORDER BY      trans_date
                                  ) = 'N'
               AND   LAG (trans_type) OVER ( PARTITION BY  emp_id
                                 ,           role_id
                                 ,           inst_id
                                 ,           exp_date
                                 ORDER BY      trans_date
                                  ) IN ('D', 'U')
               THEN  0
               ELSE  1
          END          AS okay
     FROM     tab_details     t
SELECT       *     -- or list all columns except d_cnt
FROM       got_okay
WHERE       chk_ind     = 'N'
AND       trans_type     != 'D'
AND       (     trans_type     != 'U'
       OR     okay          = 1
;

Similar Messages

  • Multiple columns and rows in MessageService

    I am attempting to create a message (via MessageService) which has multiple lines of data, and each line has multiple data columns.
    Background:  My program reads data from a web store, and creates Sales Orders in SBO.  A single run might process multiple orders.  When all orders have been entered, the program should send a (single) message to a list of recipients.  The message will have one line of data for each sales order produced.  Each line will contain two fields: the linked SBO sales order number, and the unlinked web order number.
    When the message is initially created, I'm defining the multiple columns and initializing the data lines:
    pMessageDataColumns = oMessage.MessageDataColumns
    pMessageDataColumn = pMessageDataColumns.Add()
    pMessageDataColumn.ColumnName = "SalesOrder"
    pMessageDataColumn.Link = BoYesNoEnum.tYES
    pMessageDataColumn = pMessageDataColumns.Add()
    pMessageDataColumn.ColumnName = "WebOrder"
    pMessageDataColumn.Link = BoYesNoEnum.tNO
    oLines = pMessageDataColumn.MessageDataLines()
    Later, as each Sales Order is processed, I'm attempting to inject the two data values into the message data:
    oLine = oLines.Add()
    oLine.Value = Str(pOrd.DocNum)
    oLine.Object = 17
    oLine.ObjectKey = Str(pOrd.DocEntry)
    oLine = oLines.Add()
    oLine.Value = pOrd.WebOrder
    The above code would be invoked for each Sales Order processed.  However, it generates an "Internal error (-5002) occurred" when the message is ultimately sent.
    The SDK documentation states:
    The MessageDataLine is a child data structure related to the MessageDataColumn. It contains the value of a specified cell in the Data table, which is defined by its column number (vtIndex of Item of MessageDataColumns) and row number (vtIndex of Item of MessageDataLines).
    I guess I don't understand the relationship between adding a "line" in my data display versus adding data into a "column".  It appears that the "oLines.Add()" is used to bump across the columns of the data.  If so, how do I advance to the next entire row of data in the message?
    Thanks, Dave

        Class Item
            Public ItemCode As String
            Public Dscription As String
        End Class
    Dim ItemCodes as new list( of item)
    Dim one as new item
    one.ItemCode = "ItemCode"
    one. Dscription ="Name of Item"
    itemcodes.add (one)
            Try
                Dim oCmpSvc As SAPbobsCOM.CompanyService = _ocmp.GetCompanyService()
                Dim oMsgSvc As SAPbobsCOM.MessagesService = oCmpSvc.GetBusinessService(ServiceTypes.MessagesService)
                Dim oMsg As SAPbobsCOM.Message = oMsgSvc.GetDataInterface(MessagesServiceDataInterfaces.msdiMessage)
                oMsg.Subject = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                oMsg.Text = Msg
                Dim oMsgDataColumn As SAPbobsCOM.MessageDataColumn
                If ItemCodes.Count > 0 Then
                    oMsgDataColumn = oMsg.MessageDataColumns.Add()
                    oMsgDataColumn.ColumnName = "Product / Item Code"
                    oMsgDataColumn.Link = BoYesNoEnum.tYES
                    For Each oneitem As Item In ItemCodes
                        Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()
                        oMsgDataLine.Object = "4"
                        oMsgDataLine.ObjectKey = oneitem.ItemCode
                        oMsgDataLine.Value = oneitem.Dscription
                    Next
                    oMsgDataColumn = oMsg.MessageDataColumns.Add()
                    oMsgDataColumn.ColumnName = "Description"
                    oMsgDataColumn.Link = BoYesNoEnum.tNO
                    For Each oneitem As Item In ItemCodes
                        Dim oMsgDataLine As SAPbobsCOM.MessageDataLine = oMsgDataColumn.MessageDataLines.Add()
                        oMsgDataLine.Value = oneitem.Dscription
                    Next
                End If
                        Dim oMsgRecipient As SAPbobsCOM.Recipient = oMsg.RecipientCollection.Add()
                        oMsgRecipient.UserCode = "manager"
                        oMsgRecipient.SendInternal = BoYesNoEnum.tYES
                        oMsgRecipient.SendEmail = BoYesNoEnum.tNO
                oMsgSvc.SendMessage(oMsg)
                MsgBox("SAP B1 internal Message sent...")
            Catch ex As Exception
                MsgBox("Unable to send SAP B1 internal message. Error:" + ex.Message)
            End Try
        End Sub

  • Multiple Columns and List Order with Color

    I am trying to take this code and enhance it by:
    1. It currently displays the output in a 5 column vertical format
    output1 output2 output3...
    I want it to display in a scrolling 5 column vertical format
    output1  output4
    output2  output5
    output3  output6
    based on the number of data points
    2. I want the first column background to be blue, the next white, the next blue, the next white, the last blue.
    Any way to accomplish this..appreciate any help.
    Leo
    Code:
    <table width="100%" border="0" cellpadding="7" cellspacing="0">
    <tr>
    <td colspan="5" align="left" valign="top" bgcolor="#CC6699">
    <span class="datetextwhite"><a name="THURSDAY"> </a><span class="style6">Thursday, October 29th: PRE-CONFERENCE INTENSIVES</span></span></td>
    </tr>
         <TR>
         <CFOUTPUT QUERY="q_daysschedule">
              <TD valign=top><span class="bodytextbold"><span class="style16"><font face="Verdana, Arial, Helvetica, sans-serif">#q_daysschedule.time#</font></span></span><br /><span class="topNavigationBar"><a href="session.cfm?ID=201" class="topNavigationBar">#q_daysschedule.Title#</a></span></TD>
              <CFIF q_daysschedule.CurrentRow MOD 5 IS 0>
                   </TR>
                   <TR></TR>
              </CFIF>
         </CFOUTPUT>
    <tr>

    I find these problems easier to solve if I rearrange my data into an array.  Something like this:
    DataArray = ArrayNew(2);
    Cols = 5;
    Outputs = "output1,output2,etc";
    Rows = Round(ListLen(Outputs) / Cols + .5);    // 32 outputs would give you 7 rows
    for (ii = 1; ii lt cols; ii = ii + 1) {
    for (j = 1; j lte Rows; j = j + 1) {
    DataArray[ii][j] = ListFirst(Outputs);
    Outputs = ListRestOutputs;
    } // rows
    }  // cols
    // Last Column
    for (ii = 1; ii lte ListLen(Outputs); ii = ii + 1 )
    DataArray[cols][ii] = ListGetAt(outputs, ii);
    // put spaces in blank rows
    for (j = ii; j lte rows; j = j + 1)
    DataArray[cols][j] = " ";
    Output like this
    <cfoutput>
    <cfloop from = "1" to = cols index = "ThisRow">
    <cfloop from = "1" to = rows index = "ThisCol">
    #DataArray[ThisCol][ThisRow]#
    closing tags, formatting etc

  • How to Make FUNCTION to return multiple column and multiple row output

    Hi All,
    Kindly Share ur Idea;Thanks in Advance;
    i Have Table Demo.
    table DEMO:
    id name
    1 a10
    1 a11
    1 a12
    2 b10
    2 b11
    3 ccc
    and the function is like:
    create or replace function (p1 number) return varchar2 as
    vid number;
    vname varchar2(20);
    begin
    select id,name into vid,vname from demo where id=p1;
    return v1;
    end;
    this function returns output for id=3;
    BUT,
    i need output as (for input as 1)
    vid vname
    1 a10
    1 a11
    1 a12

    A function returns a single datatype.
    That datatype may be an atomic datatype (varchar2, number etc.) or it may be an object/record datatype, or even a collection datatype.
    Where are you going to use this function? In PL/SQL or SQL?
    If you are wanting to use it in SQL, then you would need a pipelined function e.g.
    SQL> CREATE OR REPLACE TYPE myemp AS OBJECT
      2  ( empno    number,
      3    ename    varchar2(10),
      4    job      varchar2(10),
      5    mgr      number,
      6    hiredate date,
      7    sal      number,
      8    comm     number,
      9    deptno   number
    10  )
    11  /
    Type created.
    SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myemp
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION pipedata(p_min_row number, p_max_row number) RETURN myrectable PIPELINED IS
      2    v_obj myemp := myemp(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
      3  BEGIN
      4    FOR e IN (select *
      5              from (
      6                    select e.*
      7                          ,rownum rn
      8                    from (select * from emp order by empno) e
      9                   )
    10              where rn between p_min_row and p_max_row)
    11    LOOP
    12      v_obj.empno    := e.empno;
    13      v_obj.ename    := e.ename;
    14      v_obj.job      := e.job;
    15      v_obj.mgr      := e.mgr;
    16      v_obj.hiredate := e.hiredate;
    17      v_obj.sal      := e.sal;
    18      v_obj.comm     := e.comm;
    19      v_obj.deptno   := e.deptno;
    20      PIPE ROW (v_obj);
    21    END LOOP;
    22    RETURN;
    23  END;
    24  /
    Function created.
    SQL> select * from table(pipedata(1,5));
         EMPNO ENAME      JOB               MGR HIREDATE                    SAL       COMM     DEPTNO
          7369 SMITH      CLERK            7902 17-DEC-1980 00:00:00        800                    20
          7499 ALLEN      SALESMAN         7698 20-FEB-1981 00:00:00       1600        300         30
          7521 WARD       SALESMAN         7698 22-FEB-1981 00:00:00       1250        500         30
          7566 JONES      MANAGER          7839 02-APR-1981 00:00:00       2975                    20
          7654 MARTIN     SALESMAN         7698 28-SEP-1981 00:00:00       1250       1400         30
    SQL> select * from table(pipedata(6,10));
         EMPNO ENAME      JOB               MGR HIREDATE                    SAL       COMM     DEPTNO
          7698 BLAKE      MANAGER          7839 01-MAY-1981 00:00:00       2850                    30
          7782 CLARK      MANAGER          7839 09-JUN-1981 00:00:00       2450                    10
          7788 SCOTT      ANALYST          7566 19-APR-1987 00:00:00       3000                    20
          7839 KING       PRESIDENT             17-NOV-1981 00:00:00       5000                    10
          7844 TURNER     SALESMAN         7698 08-SEP-1981 00:00:00       1500          0         30
    SQL> select * from table(pipedata(11,15));
         EMPNO ENAME      JOB               MGR HIREDATE                    SAL       COMM     DEPTNO
          7876 ADAMS      CLERK            7788 23-MAY-1987 00:00:00       1100                    20
          7900 JAMES      CLERK            7698 03-DEC-1981 00:00:00        950                    30
          7902 FORD       ANALYST          7566 03-DEC-1981 00:00:00       3000                    20
          7934 MILLER     CLERK            7782 23-JAN-1982 00:00:00       1300                    10
    SQL>If you are using it in PL/SQL then just populating a collection datatype and returning that will do. Though you should question why you want to pass large amounts of data around like that first.
    Explain your purpose and what you are intending to do and we can recommend the best way.
    {message:id=9360002}

  • Compare the values of multiple columns and take the column header

    Hi all,
    I have a table as follows:
    acct-d1-d2-d3-d4-d5
    101-1/2/2009- - - 3/2/2009-12/12/2009
    102- - 10/10/2009- -12/25/2009-
    acct is a number where as d,d2,d3,d4,d5 are date columns.
    I need to write a query where i need to pick the maximum date for an acct.
    for acct - 101 12/12/2009 should be picked up and for acct 102 12/25/2009.
    output should be :
    acct-dt
    101-12/12/2009
    102-12/25/2009
    Thanks..

    Hi,
    Starting in Oracle 11, you can use the UNPIVOT feature:
    WITH     unpivoted     AS
         SELECT     acct
         ,     column_name
         ,     ROW_NUMBER () OVER ( PARTITION BY acct
                                   ORDER BY         dt     DESC
                                 ) AS r_num
         FROM     mytab
         UNPIVOT     (     dt     FOR column_name IN ( d1
                                         , d2
                                     , d3
                                     , d4
                                     , d5
    SELECT     acct
    ,     column_name
    FROM     unpivoted
    WHERE     r_num     = 1
    ;

  • How to insert parameter value into multiple columns and rows

    Hi All,
    I have one procedure insert_tab and I am passing
    100~101~102:103~104~105:106~107~108 as a parameter to that procedure. I wanted to insert each numeric value into one column. The output of the table should contain
    Table:
    Col1 Col2 Col3
    100 101 102
    103 104 105
    106 107 108
    Awaiting for your reply..

    That's not more clear for me...
    Anyway, if you really want a procedure for that, try :
    SQL> create table tblstr (col1 number,col2 number,col3 number);
    Table created.
    SQL>
    SQL> create or replace procedure insert_fct (p_string IN varchar2)
      2  as
      3  v_string     varchar2(4000):=p_string||':';
      4  v_substring  varchar2(4000);
      5 
      6  begin
      7      while instr(v_string,':') > 0 loop
      8            v_substring := substr(v_string,1,instr(v_string,':')-1)||'~';
      9            insert into tblstr(col1,col2,col3)
    10            values (substr(v_substring,1,instr(v_substring,'~',1,1)-1),
    11                    substr(v_substring,instr(v_substring,'~',1,1)+1,instr(v_substring,'~',1,2)-instr(v_substring,'~',1,1)-1),
    12                    substr(v_substring,instr(v_substring,'~',1,2)+1,instr(v_substring,'~',1,3)-instr(v_substring,'~',1,2)-1));
    13            v_string:=substr(v_string,instr(v_string,':')+1);
    14      end loop;
    15  end;
    16  /
    Procedure created.
    SQL>
    SQL> show err
    No errors.
    SQL>
    SQL> select * from tblstr;
    no rows selected
    SQL> exec insert_fct('100~101~102:103~104~105:106~107~108')
    PL/SQL procedure successfully completed.
    SQL> select * from tblstr;
          COL1       COL2       COL3
           100        101        102
           103        104        105
           106        107        108
    SQL> exec insert_fct('109~~')
    PL/SQL procedure successfully completed.
    SQL> exec insert_fct('~110~')
    PL/SQL procedure successfully completed.
    SQL> exec insert_fct('~~111')
    PL/SQL procedure successfully completed.
    SQL> select * from tblstr;
          COL1       COL2       COL3
           100        101        102
           103        104        105
           106        107        108
           109
                      110
                                 111
    6 rows selected.
    SQL> Nicolas.

  • PO With respect to realse order with Multiple Item and Multiple Services

    Dear Guru,
    I am having Issues with BAPI_PO_CREATE1 which i am not able to resolve.
    I am Trying to create a PO with Multiple Line (such as line item 10, 20, 30, 40 )
    and Each line item should contain multiple services in its service line item (such as 10, 20 30, 40)
    The Import parameters i have defined for
    POHEADER is as below: 
    COMP_CODE                      1000
    DOC_TYPE                       RO
    CREATED_BY                     SAIFUR
    PURCH_ORG                      1000
    PUR_GROUP                      102
    CURRENCY                       INR
    DOC_DATE                       05.12.2009
    AGREEMENT                      4700014635
    The Import parameters i have defined for
    POHEADERX is as below:
    COMP_CODE                      X
    DOC_TYPE                       X
    CREATED_BY                     X
    PURCH_ORG                      X
    PUR_GROUP                      X
    CURRENCY                       X
    DOC_DATE                       X
    AGREEMENT                      X
    The Table Parameter I have Defiend For 1st line item
    in POITEM is as below :
    PO_ITEM                        00010
    SHORT_TEXT                     HIRING OF COMPUTER / LAPTOP
    PLANT                          078
    TRACKINGNO                     ITEM1
    QUANTITY                                  1.000
    ITEM_CAT                       9
    ACCTASSCAT                     U
    AGREEMENT                      4700014635
    AGMT_ITEM                      00010
    PREQ_NAME                      127562_B
    PERIOD_IND_EXPIRATION_DATE     D
    PCKG_NO                        0000000001
    The Table Parameter I have Defiend For 2nd line item
    in POITEM is as below :
    PO_ITEM                        00020
    SHORT_TEXT                     HIRING OF LCD
    PLANT                          078
    TRACKINGNO                     ITEM2
    QUANTITY                                  1.000
    ITEM_CAT                       9
    ACCTASSCAT                     U
    AGREEMENT                      4700014635
    AGMT_ITEM                      00020
    PREQ_NAME                      127562_B
    PERIOD_IND_EXPIRATION_DATE     D
    PCKG_NO                        0000000000

    The Table Parameter I have Defiend For 1st line item
    in POSCHEDULE is as below :
    PO_ITEM                        00010
    SCHED_LINE                     0001
    DEL_DATCAT_EXT                 D
    DELIVERY_DATE                  05.12.2009
    QUANTITY                                  1.000
    The Table Parameter I have Defiend For 2nd line item
    in POSCHEDULE is as below :
    PO_ITEM                        00020
    SCHED_LINE                     0002
    DEL_DATCAT_EXT                 D
    DELIVERY_DATE                  05.12.2009
    QUANTITY                                  1.000
    The Table Parameter I have Defiend For 1st line item
    in POSCHEDULEX is as below :
    PO_ITEM                        00010
    SCHED_LINE                     0001
    DEL_DATCAT_EXT                 X
    DELIVERY_DATE                  X
    QUANTITY                       X
    The Table Parameter I have Defiend For 2nd line item
    in POSCHEDULEX is as below :
    PO_ITEM                        00020
    SCHED_LINE                     0002
    DEL_DATCAT_EXT                 X
    DELIVERY_DATE                  X
    QUANTITY                       X
    The Table Parameter I have Defiend For 1st and 2nd line item
    in POSERVICES is as below :
    PCKG_NO     LINE_NO     EXT_LINE     SUBPCKG_NO     QUANTITY     BAS     GR_PRICE     SHORT_TEXT
    1     1     0     2     0          0     HIRING OF COMPUTER / LAPTOP
    2     2     10     0     1     EA     700     PENTIUM COM WITH COL MON & NETWORK COM
    2     3     20     0     1     EA     350     INKJET PRINTER(BLACK&WHITE AND COLOUR)
    2     4     30     0     1     EA     325     SCANNER COLOUR
    5     5     0     5     0          0     HIRING OF LCD
    5     6     10     0     1     HR     400     LCD HIRING PER HOUR
    5     7     20     0     2     HR     200     FOR EVERY ADDITIONAL HOUR

  • Problem in showing multiple columns and rows in horizontal wrap as like as

    I am trying to implement the ListView in my application as like as in windows.
    But i am able to show single row by this code snippet.
    What should i do to show  the multiple row ,multiple coloumns in JList.
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    public class JListExample extends JFrame
        private class Value
            Value(String value, Icon image)
                this.value = value;
                this.image = image;
            String value;
            Icon image;
        private Icon getIcon(String name)
            return new ImageIcon(name);
        public JListExample()
            super("Simple JList Example");
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            final Value[] VALUES =
                new Value("the road", getIcon("10.jpg")),
                new Value("trees",  getIcon("11.jpg")),
                new Value("stooges",  getIcon("12.jpg")),
                new Value("bauld tires",  getIcon("13.jpg")),
                new Value("bvot tires",  getIcon("14.jpg")),
                new Value("volt tires",  getIcon("15.jpg")),
                new Value("send tires",  getIcon("17.jpg")),
            JList list = new JList(VALUES);
            list.setLayoutOrientation(JList.HORIZONTAL_WRAP);
            list.setVisibleRowCount(1);
            list.setCellRenderer(new SimpleCellRenderer());
            list.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                if (evt.getValueIsAdjusting())
                return;
                System.out.println("Selected from " + evt.getFirstIndex()
                    + " to " + evt.getLastIndex());
            JScrollPane ListViewer = new JScrollPane(list);
            getContentPane().add(ListViewer);
            setBounds(0,0,600,600);
            //pack();
        public static void main(String[] args)
            try
                new JListExample().setVisible(true);
            catch (Exception e)
                e.printStackTrace(System.out);
        class SimpleCellRenderer extends JLabel implements ListCellRenderer
            public SimpleCellRenderer()
                setOpaque(true);
            public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus)
                Value val = (Value)value;
                setText(val.value);
                setIcon(val.image);
                //setBackground(isSelected ? Color.red : (index & 1)  ==0 ?                 Color.cyan : Color.green);
                //setForeground(isSelected ? Color.white : Color.black);
                return this;
    }

    I know this is an old topic, but I found the solution and thought I'd share it! By default, a JList only has 1 visible row. To allow the number of rows to expand dynamically, throw this in.
    this.imageList.setVisibleRowCount(-1);My code looks like this. It centers each image and centers the text under the image and wraps images horizontally.
        ListCellRenderer renderer = new ImageListCellRenderer();
        this.imageList.setCellRenderer(renderer);
        DefaultListModel listModel = new DefaultListModel();
        this.imageList.setVisibleRowCount(-1);
        this.imageList.setLayoutOrientation(JList.HORIZONTAL_WRAP);
        this.imageList.setModel(listModel);and the renderer
    public class ImageListCellRenderer extends DefaultListCellRenderer { 
      public Component getListCellRendererComponent(JList list, Object value, int
          index, boolean isSelected, boolean hasFocus) {
        JLabel label = (JLabel)super.getListCellRendererComponent(list, value,
            index, isSelected, hasFocus);
        if (value instanceof File) {
          File imageFile = (File)value;
          String path = imageFile.getAbsolutePath();
          Image image = Toolkit.getDefaultToolkit().getImage(path);
          image = image.getScaledInstance(100, 100, Image.SCALE_DEFAULT);
          ImageIcon imageIcon = new ImageIcon(image);
          label.setIcon(imageIcon);
          label.setText(path.substring(path.lastIndexOf(File.separatorChar) + 1));
          label.setVerticalTextPosition(SwingConstants.BOTTOM);
          label.setHorizontalAlignment(SwingConstants.CENTER);
          label.setHorizontalTextPosition(SwingConstants.CENTER);
        else {
          label.setIcon(null);
        return label;
    }I need to work on this to improve performance, but it works!

  • CSS3 Multiple columns and Internet Exploder

    I developed a web page that needs a two-column layout and decided to use CSS3 to describe the columns: Really simple:
    .twocol {
              border-style: solid;
              border-width: 7px;
              border-color: #0476ac;
              -webkit-border-radius: 20px;
              -moz-border-radius: 20px;
              border-radius: 20px;
      -moz-column-count: 2;
              -moz-column-gap: 20px;
              -webkit-column-count: 2;
              -webkit-column-gap: 20px;
              column-count: 2;
              column-gap: 20px;
              padding: 10px;
              height: 300px;
    The CSS in bold describes the two column layout I want.
    Looked at in Internet Exploiter version 9 and it failed. And, since text was missing I did the "old skool" method:
    .colLeft {
              width: 410px;
    .colRight {
              width: 410px;
              float: right;
    Then in HTML:
    <section class="twocol">
    <div class="colRight">
    <p>Right column stuff goes here</p>
    </div>
    <div class="colLeft">
    <p>Left column stuff goes here</p>
    </div>
    </section>
    I commented out the stuff in bold in my stylesheet.
    Here is my question:
    Since I am using the HTML5 Shiv, ought not that to have created support for the multi-column declarations in CSS3 or is that just too complex?

    Well I sure wish Microsoft would give me the ability to check on Exploiter 10…
    (on My Macintosh).
    The two column definition worked on Safari 5.1.7 (which is certainly not the latest version)
    It worked just fine on Chrome 24.0.1312.57, which is close to current.
    It worked just fine on Firefox 19.0.
    Of course I didn't try 3 column or four column.
    Of course, just "north" of that is an "Amazon Scroller," which does not work on IE 8 or below… IE 7 reports an error with the script, but doesn't say which one (could be jQuery or it could be the amazon_scroller.js script). I have read (with interest) Al Sparber's commentary about jQuery and I am beginning to think he is right. However, many of these fun tools work brilliantly and are wonderful ways to please a client.
    If I could do a challenge throwdown for Al, I'd love to see him modify his horizontal glider to do what the scroller is doing and loop the images (please understand, this is something Al and I have discussed before and that I highly recommend his tools).
    I think Nancy gets the nod for "solver" here, though Al is always very helpful.

  • SELECT from multiple columns and CMP -- possible?

    Hello,
    Is it possible to write a findByXX() method that will return data from
    multiple tables using CMP? If so, are there any examples of how to do
    this?
    Thanks.

    Plus, the TopLink EJBs will only work with weblogic.
    "Manny Celi" <[email protected]> wrote in message
    news:[email protected]..
    At this point in time, TopLink is most probably a choice, although it is avery
    expensive choice ($5,000.00 per developer), but it also depends on whatversion
    of Java you are using.
    As I understand, the new version of the EJB 2.0 will feature mappingfeatures,
    similar to that of TopLink, although the people from WebGain claim thatthe new
    EJB 2.0 specifications will not be as powerful as TopLink.
    You can create your own mappings by creating objects that will map to your
    result sets. It takes some work, but its not too bad, you will need toincrease
    the timelines.
    The avantage to using a tool like TopLink, or Gemstone's product, is thatthey
    provide Wizards that take you step by step to creating the mappings. The
    disadvantage is the "proprietary" code that you have to implement. Thelearning
    curve is also steep.
    I don't know if I have help, but good luck.
    Manny
    [email protected] wrote:
    Thanks.
    But I would like to know if this is possible using only the Weblogic
    server
    and the J2EE technologies.
    Senthil Kumar S wrote:
    U can use TOPLink..
    http://www.webgain.com
    [email protected] wrote:
    Hello,
    Is it possible to write a findByXX() method that will return data
    from
    multiple tables using CMP? If so, are there any examples of how todo
    this?
    Thanks.

  • How to calculate the sum of multiple columns and enter it into a single col

    I have a table tab_contributions which has the following columns:
    Emp_code Current_month(format: yyyymm) Contribution_amt
    Sample entry:
    Emp_code Current_month Contribution_amt
    100 200910 100
    100 200911 100
    100 200912 100
    100 200912 100
    100 201001 100
    100 201002 100
    100 201003 100
    Desired output: Table_result
    Emp_code Years Contribution_amt
    100 2009-2010 700
    Also, the years duration should be of only one year. For eg: 2008-2009, 2009-2010 etc.
    Edited by: user9027633 on Feb 26, 2010 12:34 AM

    Select Emp_code, min(substr(Current_month,1,4))||'-'||max(substr(Current_month,1,4)) period, sum(Contribution_amt) amount
    from mytable
    group by Emp_code;
    SQL> with mytable as (
      2  select 100 Emp_code, 200910 Current_month, 100 Contribution_amt from dual union all
      3  select 100, 200911, 100 from dual union all
      4  select 100, 200912, 100 from dual union all
      5  select 100, 200912, 100 from dual union all
      6  select 100, 201001, 100 from dual union all
      7  select 100, 201002, 100 from dual union all
      8  select 100, 201003, 100 from dual)
      9  Select Emp_code,
    10         min(substr(Current_month,1,4))||'-'||
    11         max(substr(Current_month,1,4)) period,
    12         sum(Contribution_amt) amount
    13  from mytable
    14  group by Emp_code;
      EMP_CODE PERIOD        AMOUNT
           100 2009-2010        700Max
    http://oracleitalia.wordpress.com
    Edited by: Massimo Ruocchio on Feb 26, 2010 9:11 AM
    Added example

  • Multiple columns and rows update using select staement

    i am trying to update the 2 colums of a table based on the cursor result set with key values are matching.
    DECLARE
    CURSOR update_master
    IS
    SELECT B.cust_num,c.cust_num,
    B.cust_name,B.cust_bal
    FROM
    Table_one B
    JOIN
    Table_two C
    ON B.cust_num= C.cust_num;
    BEGIN
    FOR master_rec IN update_master
    LOOP
    UPDATE Table_three
    SET col1 = master_rec.cust_name,
    Col2 = master_rec.cust_bal,
    Where WHERE Cust_num = master.cust_num;
    END LOOP;
    COMMIT;
    END;
    The 3 tables are having around 50000 records individually............
    It is taking too much of time to execute......more than 6 minutes......
    how can we optimize it?? can we write this update statement directly? instead of writing it in procedure?

    Here's a general approach:
    update some_table s
    set   (s.col1, s.col2) = (select x.col1, x.col2
                              from   other_table x
                              where  x.key_value = s.key_value
    where exists             (select 1
                              from   other_table x
                              where  x.key_value = s.key_value
    ;

  • Multiple Column Report Question

    Post Author: LCS213
    CA Forum: Crystal Reports
    I'm creating a student transcript report that has multiple columns, and is three groups deep.  The first two groups need to be in a columnar layout. However, I'd like the third group to contain a subreport that spans the width of the entire page. 
    Are there any options within Crystal XI to do this?  I know in the Section Expert, i can format the detail level with multiple columns, and on the Layout tab, I can select "Format Groups with multiple columns".  But that seems like it either formats ALL groups or NO groups.  Am I mistaken?  Is there a workaround I'm missing?
    Thanks in advance for any help on this issue!

    Hi Dan,
    According to your description, we are not clear about the “6 sections for each Additional task”. Do you mean six data records? If so, based on my understanding, there are three groups and eighteen records in your report. You want to make those records appear
    on eighteen separated pages, right?
    In Reporting Service, we can add a page break to groups within data regions to control the amount of information on each page. In your scenario, you should add page break to group “Sub task”, group “Additional Task” and details. As we tested in our environment,
    add page break to these records, the report appears in eighteen pages. Please refer to steps below:
    1.On Group Properties of Details1, choose “Between each instance of a group” option on Page Breaks page. Please refer to screenshot below:
     Choose same option on Group Properties for group “Month” and “Name”.
    2.Click drop-down button next to Column Groups, then choose Advanced Mode.
    3.Click on Static under Row Groups, set RepeatOnNewPage as True in Tablix Member Properties.
    4.Click Preview, the results before and after adding page break look like below:
    If you still have any question, please post some detail information or screenshot about the report design you expect.
    Best regards,
    Qiuyun Yu

  • Problem in creating Maintenance Order with multiple operations

    Hello all,
    I am facing problem while creating Maintenance Order with multiple operations and sub-operations. I am using BAPI : BAPI_ALM_ORDER_MAINTAIN.
    For single operation it is working fine,but i am unable to create MO with multiple operations and sub-operations.
    Please, provide me the inputs required,
    I have used methods :
    ORDER        CREATE,
    OPERATION CREATE
    and SAVE.
    Regards,
    Siddhartha

    Hi,
    The FM you are using is a perfect one. This FM is bit tricky to use. You need to perfectly pass the Reference number field. which links various input table parameters of this FM.
    Thanks & Regards,
    Navneeth K.

  • GROUP BY with multiple columns.

    I have little query about GROUP BY clause.
    Sometimes we will give multiple column names in GROUP BY .If it behaves in the same way as ORDER BY (multiple columns) i would love to have an example where I can use GROUP BY multiple columns. Anyways howsoever it behaves it will be really appreciated if anyone can explain a scenario where GROUP BY with multiple columns can be used.
    I know about the usage of aggregate functions with GROUP BY but using only one column.
    Thanks..!!!

    Hi,
    Group by is used for grouping of same records. check this bellow scenario
    SELECT registrationid, dateofbirth, age FROM prawin62 WHERE registrationid = 22;
    22     1/23/1975     54
    22     5/18/2011     66
    22     5/18/2011     66
    22     5/18/2011     66
    22     5/18/2011     66
    22     5/18/2011     66SELECT registrationid, sum(age) FROM prawin62 WHERE registrationid = 22 GROUP BY registrationid;
    22     384SELECT registrationid, dateofbirth, sum(age) FROM prawin62 WHERE registrationid = 22 GROUP BY registrationid, dateofbirth ;
    22     5/18/2011     330
    22     1/23/1975     54Thanks,
    Praveen

Maybe you are looking for

  • Lost sound devices now blue screen of death when updating creative drivers.

    I have an XPS with windows 7, dont k now what the sound card is, I have factory installed software for Creative X something extreme, and Realtex. Now I had been trying to get sound via an optical cable to an AV amp with no success. I had tried disabl

  • F.5e error

    Dear expert    while am running F.5E a getting two errors    Post zero balance    Document number  Document could not be posted plese help me Thanks regards Ajeesh Edited by: Ajeeshsudevan on Nov 3, 2011 8:22 AM

  • Mighty Mouse shortcuts changed

    I'm using a wireless Mighty Mouse on OS 10.5.8. The track ball is set to Button 3 and when in a web browser, would open a new tab when clicked once. For some reason, its now acting like the Secondary Button (opens the sub menu). There used to be a mo

  • 10.6.5 Mail - Crazy Account Disappearing Problems on 2 machines!

    My mail on my MacPro started crashing yesterday. Mail accounts (POP and Apple) disappeared. I replaced the mail.plist file and all's well, for like 5 minutes. Then one account or two would disappear, or maybe all. Then I noticed the same thing was ha

  • My LiveType have no textures and objects! Please help me! Thank you!

    Sorry to trouble, thank you for taking your time to reply me =) I just bought my Mac OS X 10.5.4 Leopard not long ago. And today is my first time using LiveType on my laptop. I've learn how to use LiveType in school before, but i just found out that