Thtmlb:cellerator: color in a single row

Hi,
I have a thtmlb:cellerator which is showing 5 rows. I want that las row has a background color in yellow (for example).
I have tried to do this in the iterator, in method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START, setting the value of parameter p_style for ecahc cell in row like this:
      p_style = 'background-color:#88D9FF'.
The problem is that my cellerator shows all rows in white. The definition of my cellerator is:
<thtmlb:cellerator id                      = "table"
                   table                   = "<%= model->I_LISTADO_TAREAS %>"
                   iterator                = "<%= model->ITERATOR_TABLEVIEW %>"
                   width                   = "100%"
                   personalizable          = "TRUE"
                   design                  = "STANDARD"
                   fixedHeaders            = "FALSE"
                   hasExpander             = "TRUE"
                   hasPagerWhenCollapsed   = "TRUE"
                   horizontalScrolling     = "FALSE"
                   isExpanded              = "FALSE"
                   onHeaderClick           = "TRUE"
                   onRowSelection          = "onRowSelection"
                   verticalScrolling       = "TRUE"
                   scrollRowCount          = "20"
                   selectionMode           = "MULTI"
                   showPersonalizeButton   = "FALSE"
                   tableLayout             = "FIXED"
                   visibleRowCount         = "30"
                   visibleRowCountExpanded = "40"
                   rowSelectionByLineClick = "TRUE"
                   />
Could anybody help me?
Thank you in advance.
Regards,
Jose.

I have tried many timesNo you haven't.
What happens when you compile this code:
class Test {
     public static void main(String[] argv) {
          for( int i = 0; i < 10; i++ ) {
               System.out.print(i + " ");
}

Similar Messages

  • How to change the background color of a single row

    Hi OTN,
    I am using JDeveloper 11.1.1.2 with ADF faces in view layer.My issue is How to change the background color of a single row in af:table ?.

    How to highlight ADF table row based on column value?
    Found by searching

  • JTable set single row color

    I have alternating colors for my jtable, and when a row is selected i pop up another window and clear the selection. i want to change the color of all selected rows, but if i dont clear the selection, it doesn't allow me to re-open the same record because of the way the selectionListener works. so basically i dont want to mark a row as selected, i jus want to change its color. anyone know how to do this?

    looks promising.. i'm going to give it a shot. why dont they just have a method like.. table.setRowColor (rowIndex), because im implementing a selectionlistener, so i already know the rowIndex that was selected, jus have to change its color. maybe coz that would be tooo easy lol. thanks

  • Interactive Report's Column Definition - Single Row View Label Bug?

    Hello,
    I have an Interactive report that I've added a Blue background to certain column headings (done by giving Column Heading a background color), this works fine except for the Single Row view - it displays the &lt;....&gt; code I used to get the background color and the column heading. I've tried to change the Single Row View Label by unchecking the 'Use Same Text for Single Row View' on the Column Definition and giving a different label, it just ignores whatever I put in and shows the Column Heading with the &lt; .... &gt; code. Is this a Bug or am I doing something wrong?
    Thanks,
    Anna

    Hi Anna,
    I believe that it is a bug.
    If the 'Use Same Text for Single Row View' checkbox is unticked and some text is entered in the 'Single Row View Label' field it gets ignored completely when viewed in the single row view and the existing value in 'Column Heading' is used.
    I wanted to do something similar to you, colouring some of the Interactive Report column headers, and it works fine in the IR report itself but shows the code (span style:color etc) in the single row query. I am using Apex 3.1.1 and the Sand Theme.
    I created a simple application on apex.oracle.com using the red theme and in single row view it still ignores the 'Single Row View Label' but interestingly shows the Column Heading text without the code. This indicates that there could be a work-around by altering the theme.
    Regards,
    Chris

  • Trying to change the color of a single cell

    hi, I am trying to change the color of a single cell when mouse moves over it, but couldn't do it. i even tried my own renderer, but it doesn't work. can anybody help ?

    Here is what I am trying to do. I am displaying some data in a java JTable retrieved from a table in database. What is needed is when user moves his mouse over any cell in the third column, the cursor should change to hand cursor and possibly the background color should also change, to indicate the user that this cell is clickable. I have to show some other report when user clicks any cell in column three. The code follows as
    import java.awt.*;
    import java.sql.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.sql.rowset.*;
    import javax.swing.table.*;
    public class MouseMotionInTable extends JFrame
    public static void main(String[] args)
      MouseMotionInTable f = new MouseMotionInTable();
      Toolkit tk = Toolkit.getDefaultToolkit();
      Dimension dim = tk.getScreenSize();
      int w = dim.width;
      int h = dim.height;
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setBounds((w-600)/2, (h-300)/2, 600, 300);
      f.setVisible(true);
    MouseMotionInTable()
      Connection con = null;
      CachedRowSet crs = null;
      try
       Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       con = DriverManager.getConnection("jdbc:odbc:FMS", "", "");
       Statement st = con.createStatement();
       String query = "SELECT ItemName, Alias, ItemReOrderQuty, ItemMeasure FROM ItemInfo";
       ResultSet rs = st.executeQuery(query);
       crs = new com.sun.rowset.CachedRowSetImpl();
       crs.populate(rs);
       st.close();
      catch (SQLException e)
       e.printStackTrace();
      catch (ClassNotFoundException e)
       e.printStackTrace();
      finally
       if(con != null)
        try
         con.close();
        catch (SQLException e)
         e.printStackTrace();
      DBTableModel model = new DBTableModel(crs);
      table = new JTable(model);
      JPanel center = new JPanel();
      center.setLayout(new BorderLayout());
      center.add(new JScrollPane(table), BorderLayout.CENTER);
      add(center, BorderLayout.CENTER);
      table.addMouseMotionListener(new MouseMotionAdapter()
       public void mouseMoved(MouseEvent me)
        int col = table.columnAtPoint(new Point(me.getX(), me.getY()));
        int row = table.rowAtPoint(new Point(me.getX(), me.getY()));
        if(col == 2)
         Object val = table.getValueAt(row, col);
         boolean isSelect = table.isCellSelected(row, col);
         boolean focus = table.isCellSelected(row, col);
         TableCellRenderer cellRender = table.getCellRenderer(row, col);
         Component comp = cellRender.getTableCellRendererComponent(table, val, isSelect, focus, row, col);
         comp.setCursor(new Cursor(Cursor.HAND_CURSOR));
         comp.setBackground(Color.yellow);
    private JTable table;
    class DBTableModel extends AbstractTableModel
    ResultSet rs;
    ResultSetMetaData rsMeta;
    DBTableModel(ResultSet rs)
      try
       this.rs = rs;
       rsMeta = rs.getMetaData();
      catch(SQLException e)
       e.printStackTrace();
    public int getColumnCount()
      try
       return rsMeta.getColumnCount();  
      catch(SQLException e)
       e.printStackTrace();
      return -1;
    public String getColumnName(int c)
      try
       return rsMeta.getColumnName(c+1);
      catch(SQLException e)
       e.printStackTrace();
      return "";
    public int getRowCount()
      try
       rs.last();
       return rs.getRow();
      catch(SQLException e)
       e.printStackTrace();
      return -1;
    public Object getValueAt(int r, int c)
      try
       rs.absolute(r+1);
       return rs.getObject(c+1);
      catch(SQLException e)
       e.printStackTrace();
      return "";
    public boolean isCellEditable(int r, int c)
      return false;
    public Class getColumnClass(int c)
      return getValueAt(0,c).getClass();
    }

  • ALV Web Dynpro for ABAP enable/disable single row

    hi all,
    is it possible to change the layout of one single row or cell in a alv (component SALV_WD_TABLE) web dynpro for abap?
    i managed to get columns to be editable using the tutorial "Editing ALV in Web Dynpro for ABAP".
    but it is not described how to change a single row or cell in this tutorial. also the example programs i found do not get into this subject.
    did i miss something?
    thanks in advance

    Hi,
    I think you cannot set the focus to the particular cell.
    I think you can  loop at that row of that table and set the the cell design to apply some color to differentiate that way rather than focusing so that user can know that he has to do something in that cell.
    check out this example salv_wd_test_table_focus
    Regards,
    Lekha.

  • Single row in alv report

    Hi experts...
    I want single row in alv report.
    I have use loop for fatch data into internal table using loop when i am passing data in alv report then the data comes according loop. i want onlu one data in alv row.
    how can i do such, plz help me.

    decleare two internal table.
    read table itab into  wa index  1.
    append wa to itab2.
    pass itab2 only one record display.

  • How to "Highlight/Color Label" a single event in Month View.

    Hi.
    How do i either Hightlight or Color Label a single event or a single calendar in Month View? Like the pic shows, the one on the right...
    Thank you for your time.

    Never Mind... Thank you though..
    It's an all day event...

  • Merge two rows & show in a single row in table results

    Hi, I need to merge 2 rows having 3 columns in a single row in table view
    The cols are currently shown as :
    Project NO-------(Current_Month) Revenue----------(Prior_Month) Revenue
    123123 10000
    20000
    Revenue is a single column with revenue for diffreent Period.
    10000 is for May
    20000 is for April
    Project NO for both are same, just the periods are different. if I am not displaying Period i need to merge the 2 rows & show as
    Project NO-------(Current_Month) Revenue----------(Prior_Month) Revenue
    123123 10000 20000
    Please let me know how we can acheive this??
    thanx
    Pankaj

    123123 is the project number..
    the above is not getting displayed properly....as the blank spaces are removed...
    Please consider this

  • How to add A single row at the middle of the table in a Webi report

    Hi,
         I created a Webi report using Universe(Created universe using bex query).Now i have a requirement to display a row at the middle of a report. Can you please tell me ,how to add a sigle row at the middle of a Webi report.
                                                    Thanks in advance
    Regards
    Monika

    Hi Monika,
    It is not really possible to add a row (I assume you mean of unrelated data) to the middle of a table in a report. You can add a new table with a single row between two tables. For instance you could add a new one row table, or even single cells which are positioned relatively between two tables. Possibly a block on top of another. But this gets tricky.
    Can you explain in more detail what you are trying to do?
    Thanks

  • Multiple rows Converge to Single row and join

    Hi Folks,
    I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
    Table 1: DTL_TABLE (id, period, course, names, title, type)
    1 2010 mat john null null
    1 2010 mat jim null null
    1 2010 cam null officer null
    1 2010 cam null Prof null
    1 2010 phy null null Inclass
    1 2010 phy null null Online
    Join with
    Table 2: ID_TABLE(id, period, Loc, Dept, Code)
    1 2010 nj 101 CC.
    Output format (id, period, course, names, title, type, Loc, Dept, Code)
    result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
    I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
    Thank you,
    Aj
    CREATE TABLE DTL_TABLE
       ids      VARCHAR2 (10),
       period   VARCHAR2 (10),
       course   VARCHAR2 (10),
       names    VARCHAR2 (10),
       title    VARCHAR2 (10),
       TYPE     VARCHAR2 (10)
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'jim',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'john',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'mat',
                 'kale',
                 NULL,
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'cam',
                 NULL,
                 'officer',
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'cam',
                 NULL,
                 'prof',
                 NULL);
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'phy',
                 NULL,
                 NULL,
                 'inclass');
    INSERT INTO DTL_TABLE
         VALUES ('1',
                 '2010',
                 'phy',
                 NULL,
                 NULL,
                 'online');
    COMMIT;
    CREATE TABLE id_table
       ids      VARCHAR2 (10),
       period   VARCHAR2 (10),
       loc      VARCHAR2 (10),
       dept     VARCHAR2 (10),
       code     VARCHAR2 (10)
    INSERT INTO id_table
         VALUES ('1',
                 '2010',
                 'nj',
                 '101',
                 'cc');
    COMMIT;

    Aj09 wrote:
    Hi Folks,
    I am facing a tricky challenge to join a table with multiple rows and converge into a single row (based on ID, period) and join with another table to get a single row. Let me explain.
    Table 1: DTL_TABLE (id, period, course, names, title, type)
    1 2010 mat john null null
    1 2010 mat jim null null
    1 2010 cam null officer null
    1 2010 cam null Prof null
    1 2010 phy null null Inclass
    1 2010 phy null null Online
    Join with
    Table 2: ID_TABLE(id, period, Loc, Dept, Code)
    1 2010 nj 101 CC.
    Output format (id, period, course, names, title, type, Loc, Dept, Code)
    result : 1 2010 mat,cam,phy john,jim officer,prof inclass,online nj 101 CC
    I have created all the DDLs and DMLs if that help. Kindly let me know if a Join SQL query is possible.
    SELECT TBL.id,
           DTLperiod,
           course,
           names,
           title,
           TYPE,
           Loc,
           Dept,
           Code
    FROM   ID_TABLE TBL,
           DTL_TABLE DTL
    WHERE  TBL.ID = DTL.ID
           AND TBL.PERIOD = DTL.PERIOD; it not good to use RESERVED WORDS like "ID" or "TYPE" as column names

  • Display data in single row

    i have table dept of deptno d001,d002,d003,d004
    i want to list the data like below
    deptno
    d001,d002,d003,d004 ( in a single row)
    is it possible..?
    S

    Based on your database version you can try any one of the following http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php

  • Data in single row

    thanks
    Edited by: 786304 on May 25, 2011 12:22 PM

    BluShadow .
    I agree your opinion.
    I resurrect it from google cache.
    Hi All,
    I have two queries as follows
    Select
    Xrc.Profile_Nbr Var_Profile_Nbr,
    xsr.Profile_Nbr Var_Profile_Nbr,
    Nvl(Ppa.First_Name,' ') Var_First_Name,
    Nvl(Ppa.Last_Name,' ') Var_Last_Nmae,
    Nvl(Ppa.Last_Name2,' ') Var_Last_Name2,
    Nvl(Ppa.Middle_Name,' ') Var_Middle_Name,
    Nvl(Pfl.Display_Name,' ') Var_Display_Name,
    Nvl(Addr.Street1,' ') Var_Street1,
    Nvl(Addr.Street2,' ') Var_Street2,
    Nvl(Addr.City,' ') Var_City ,
    Nvl(Addr.State_Name,' ') Var_State_Name,
    Addr.Post_Code Var_Post_Code,
    Nvl(Cnt.Cntry_Name,' ') Var_Country,
    Phn.Phone Var_Phone_Nbr,
    Nvl(To_Char(Ppa.Birthdate,'MON/DD/YYYY'),' ') Var_Birthdate,
    Nvl(Ppa.Occupation,' ') Var_Occupation,
    Nvl(Ppa.Country_Of_Nationality,1) Var_Country_Of_Nationality,
    Nvl(Ppa2.First_Name,' ') Var_First_Name,
    Nvl(Ppa2.Last_Name,' ') Var_Last_Nmae,
    Nvl(Ppa2.Last_Name2,' ') Var_Last_Name2,
    Nvl(Ppa2.Middle_Name,' ') Var_Middle_Name,
    Nvl(Pfl2.Display_Name,' ') Var_Display_Name,
    Nvl(Addr2.Street1,' ') Var_Street1,
    Nvl(Addr2.Street2,' ') Var_Street2,
    Nvl(Addr2.City,' ') Var_City ,
    Nvl(Addr2.State_Name,' ') Var_State_Name,
    Addr2.Post_Code Var_Post_Code,
    Nvl(Cnt2.Cntry_Name,' ') Var_Country,
    Phn2.Phone Var_Phone_Nbr,
    Nvl(To_Char(Ppa2.Birthdate,'MON/DD/YYYY'),' ') Var_Birthdate,
    Nvl(Ppa2.Occupation,' ') Var_Occupation,
    Nvl(ppa2.COUNTRY_OF_NATIONALITY,1) var_COUNTRY_OF_NATIONALITY
    From
    V_Xact_Receiver Xrc, V_Person_Profile Ppa, V_Profile Pfl,V_Phone Phn,V_Address Addr,V_Country_Lu Cnt
    ,V_Xact_sender xsr, V_Person_Profile Ppa2, V_Profile Pfl2,V_Phone Phn2,V_Address Addr2,V_Country_Lu Cnt2
    Where Xrc.Xact_Hdr_Nbr=71138142
    and xsr.Xact_Hdr_Nbr=71138142
    And xrc.Profile_Nbr=Ppa.Profile_Nbr
    And Ppa.Profile_Nbr=Pfl.Profile_Nbr
    And Pfl.Profile_Nbr=Phn.Profile_Nbr
    And Pfl.Profile_Nbr=Addr.Profile_Nbr
    And Phn.Country_Nbr=Cnt.Country_Nbr
    And Xsr.Profile_Nbr=Ppa2.Profile_Nbr
    And Ppa2.Profile_Nbr=Pfl2.Profile_Nbr
    And Pfl2.Profile_Nbr=Phn2.Profile_Nbr
    And Pfl2.Profile_Nbr=Addr2.Profile_Nbr
    And Phn2.Country_Nbr=Cnt2.Country_Nbr;
    and
    SELECT
    Nvl(Dlu.Id_Type_Desc,' ') Var_Ident_Type_Desc,
    Nvl(D.Id_Number,' ') Var_Id_Number,
    Nvl(To_Char(D.Id_Issue_Date,'MON/DD/YYYY'),' ') Dte_Id_Issue,
    Nvl(To_Char(D.Id_Expiration_Date,'MON/DD/YYYY'),' ') Dte_Id_Expiration,
    Nvl(To_Char(Id_Expiration_Date,'MON/DD/YYYY'),' ') Dte_Id_Expiration,
    Nvl(D.Id_Issue_Place,' ') Var_Issue_Loc,
    Nvl(Pfl.Occupation,' ') Var_Occupation,
    Nvl(To_Char(Pfl.Birthdate,'MON/DD/YYYY'),' ') Dte_Birth,
    Nvl(To_Char(Pfl.Country_Of_Nationality,'MON/DD/YYYY'),' ') Var_Country_Of_Nationality
    FROM V_PROFILE_IDENT D,
    V_ID_TYPE_LU DLU,
    V_Country_Lu Clu,
    V_Xact_sender Xsr,
    v_person_profile pfl
    Where Xsr.Xact_Hdr_Nbr='71138142'
    And D.Profile_Nbr = Xsr.Profile_Nbr
    and D.Profile_Nbr=pfl.Profile_Nbr
    And D.Id_Type_Nbr = Dlu.Id_Type_Nbr
    And D.Country_Nbr = Clu.Country_Nbr(+)
    And D.Is_Valid = 'Y'
    and rownum<=3;
    The first query it returns the result in a single row
    The second query it returns the output in 3 rows
    while i was club these two it gives the result in 3 rows
    but have to get the result in a single row with all appropriate values side by side if the values are same get the values one only
    and the query club as
    Select
    Xrc.Profile_Nbr Var_Profile_Nbr,
    xsr.Profile_Nbr Var_Profile_Nbr,
    Nvl(Ppa.First_Name,' ') Var_First_Name,
    Nvl(Ppa.Last_Name,' ') Var_Last_Nmae,
    Nvl(Ppa.Last_Name2,' ') Var_Last_Name2,
    Nvl(Ppa.Middle_Name,' ') Var_Middle_Name,
    Nvl(Pfl.Display_Name,' ') Var_Display_Name,
    Nvl(Addr.Street1,' ') Var_Street1,
    Nvl(Addr.Street2,' ') Var_Street2,
    Nvl(Addr.City,' ') Var_City ,
    Nvl(Addr.State_Name,' ') Var_State_Name,
    Addr.Post_Code Var_Post_Code,
    Nvl(Cnt.Cntry_Name,' ') Var_Country,
    Phn.Phone Var_Phone_Nbr,
    Nvl(To_Char(Ppa.Birthdate,'MON/DD/YYYY'),' ') Var_Birthdate,
    Nvl(Ppa.Occupation,' ') Var_Occupation,
    Nvl(Ppa.Country_Of_Nationality,1) Var_Country_Of_Nationality,
    Nvl(Ppa2.First_Name,' ') Var_First_Name,
    Nvl(Ppa2.Last_Name,' ') Var_Last_Nmae,
    Nvl(Ppa2.Last_Name2,' ') Var_Last_Name2,
    Nvl(Ppa2.Middle_Name,' ') Var_Middle_Name,
    Nvl(Pfl2.Display_Name,' ') Var_Display_Name,
    Nvl(Addr2.Street1,' ') Var_Street1,
    Nvl(Addr2.Street2,' ') Var_Street2,
    Nvl(Addr2.City,' ') Var_City ,
    Nvl(Addr2.State_Name,' ') Var_State_Name,
    Addr2.Post_Code Var_Post_Code,
    Nvl(Cnt2.Cntry_Name,' ') Var_Country,
    Phn2.Phone Var_Phone_Nbr,
    Nvl(To_Char(Ppa2.Birthdate,'MON/DD/YYYY'),' ') Var_Birthdate,
    Nvl(Ppa2.Occupation,' ') Var_Occupation,
    Nvl(Ppa2.Country_Of_Nationality,1) Var_Country_Of_Nationality,
    Nvl(Dlu.Id_Type_Desc,' ') Var_Ident_Type_Desc,
    Nvl(D.Id_Number,' ') Var_Id_Number,
    Nvl(To_Char(D.Id_Issue_Date,'MON/DD/YYYY'),' ') Dte_Id_Issue,
    Nvl(To_Char(D.Id_Expiration_Date,'MON/DD/YYYY'),' ') Dte_Id_Expiration,
    Nvl(To_Char(Id_Expiration_Date,'MON/DD/YYYY'),' ') Dte_Id_Expiration,
    Nvl(D.Id_Issue_Place,' ') Var_Issue_Loc,
    Nvl(Pfl3.Occupation,' ') Var_Occupation,
    Nvl(To_Char(Pfl3.Birthdate,'MON/DD/YYYY'),' ') Dte_Birth,
    Nvl(To_Char(Pfl3.Country_Of_Nationality,'MON/DD/YYYY'),' ') Var_Country_Of_Nationality
    From
    V_Xact_Receiver Xrc, V_Person_Profile Ppa, V_Profile Pfl,V_Phone Phn,V_Address Addr,V_Country_Lu Cnt
    ,V_Xact_sender xsr, V_Person_Profile Ppa2, V_Profile Pfl2,V_Phone Phn2,V_Address Addr2,V_Country_Lu Cnt2
    V_Profile_Ident D,
    V_Id_Type_Lu Dlu,
    V_Country_Lu Clu,
    V_Xact_receiver Xrc2,
    v_person_profile pfl3
    Where Xrc.Xact_Hdr_Nbr=71138142
    And Xsr.Xact_Hdr_Nbr=71138142
    and xrc2.Xact_Hdr_Nbr=71138142
    And xrc.Profile_Nbr=Ppa.Profile_Nbr
    And Ppa.Profile_Nbr=Pfl.Profile_Nbr
    And Pfl.Profile_Nbr=Phn.Profile_Nbr
    And Pfl.Profile_Nbr=Addr.Profile_Nbr
    And Phn.Country_Nbr=Cnt.Country_Nbr
    And Xsr.Profile_Nbr=Ppa2.Profile_Nbr
    And Ppa2.Profile_Nbr=Pfl2.Profile_Nbr
    And Pfl2.Profile_Nbr=Phn2.Profile_Nbr
    And Pfl2.Profile_Nbr=Addr2.Profile_Nbr
    And Phn2.Country_Nbr=Cnt2.Country_Nbr
    And D.Profile_Nbr = Xrc2.Profile_Nbr
    and D.Profile_Nbr=pfl3.Profile_Nbr
    And D.Id_Type_Nbr = Dlu.Id_Type_Nbr
    And D.Country_Nbr = Clu.Country_Nbr(+)
    And D.Is_Valid = 'Y'
    and rownum<=3;
    regards,

  • Display of data in a single row

    Hi
    Here is my query:
    SELECT
    --Element Classification Details:
    pec.CLASSIFICATION_ID,
    pec.classification_name,
    pec1.classification_id "Sub Classification Id",
    DECODE(pec1.classification_name,'Other Deductions', 'Other Deductions',
    'Others Voluntary Deductions', 'Other Deductions',
    'Personal Deductions', 'Personal Deductions',
    'Personal Voluntary Deductions', 'Personal Deductions',
    'Car Loan Deductions') "Sub Classification",
    pec1.parent_classification_id,
    scr.sub_classification_rule_id,
    --Element Details:
    pet.element_name, pet.element_type_id, pet.reporting_name,
    DECODE(pet.processing_type, 'R', 'Recurring', 'Nonrecurring') "Processing Type",
    pet.EFFECTIVE_START_DATE, pet.EFFECTIVE_END_DATE,
    --Run Result Details:
    prr.run_result_id,
    TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)) "Amount",
    piv.NAME "Input Value",
    --Assignment Details:
    paa.assignment_id,
    --Time Period
    ptp.START_DATE, ptp.end_date,
    ptp.period_name "Payroll Period"
    FROM hr.pay_element_classifications pec,
    hr.pay_element_classifications pec1,
    hr.pay_sub_classification_rules_f scr,
    hr.pay_element_types_f pet,
    hr.pay_run_results prr,
    hr.pay_run_result_values prrv,
    hr.pay_input_values_f piv,
    hr.pay_assignment_actions assact,
    hr.per_all_assignments_f paa,
    hr.pay_payroll_actions payroll,
    hr.per_time_periods ptp
    WHERE
    pec.classification_id = pec1.parent_classification_id (+)
    AND scr.classification_id = pec1.classification_id
    AND pet.classification_id = pec.classification_id
    AND scr.element_type_id = pet.element_type_id
    AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
    AND prr.run_result_id = prrv.run_result_id
    AND piv.input_value_id = prrv.input_value_id
    AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
    AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
    AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
    AND ptp.TIME_PERIOD_ID = payroll.time_period_id
    AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
    AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
    AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE
    AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
    AND pec1.classification_name LIKE '%Deduction%'
    AND piv.name = 'Pay Value'
    AND paa.payroll_id != 0
    AND paa.pay_basis_id != 0
    AND paa.ASSIGNMENT_ID = '560'
    I needed to display the amounts as separate columns pertaining to different elements or rather different sub classification of the elements
    This is the final expected result for the report:
    Employee Personal Deductions PD Amount Other Deductions OD Amt
    XYZ Element1 00000.00 Element3 0000.00
    Element 2
    Car Loan Deductions CLD Amt Total Deductions (Total of all three)
    Element4 00000.00 00000000.00
    Here Personal Deductions, Other, Car Loan etc. are grouping of elements (sub classifications)
    I have used MAX function to display the results as separate columns like this:
    SELECT
    --Run Result Details:
    prr.run_result_id,
    MAX(DECODE(pec1.classification_name, 'Personal Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Personal Deductions",
    MAX(DECODE(pec1.classification_name, 'Personal Voluntary Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Personal V Deductions",
    MAX(DECODE(pec1.classification_name, 'Other Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Other Deductions",
    MAX(DECODE(pec1.classification_name, 'Others Voluntary Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Others V Deductions",
    MAX(DECODE(pec1.classification_name, 'Car Loan Deductions', TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) "Car Loan Deductions"
    /*--Assignment Details:
    paa.assignment_id,
    --Time Period
    ptp.START_DATE, ptp.end_date,
    ptp.period_name "Payroll Period"*/
    FROM hr.pay_element_classifications pec,
    hr.pay_element_classifications pec1,
    hr.pay_sub_classification_rules_f scr,
    hr.pay_element_types_f pet,
    hr.pay_run_results prr,
    hr.pay_run_result_values prrv,
    hr.pay_input_values_f piv
    /*hr.pay_assignment_actions assact,
    hr.per_all_assignments_f paa,
    hr.pay_payroll_actions payroll,
    hr.per_time_periods ptp*/
    WHERE
    pec.classification_id = pec1.parent_classification_id (+)
    AND scr.classification_id = pec1.classification_id
    AND pet.classification_id = pec.classification_id
    AND scr.element_type_id = pet.element_type_id
    AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
    AND prr.run_result_id = prrv.run_result_id
    AND piv.input_value_id = prrv.input_value_id
    /*AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
    AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
    AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
    AND ptp.TIME_PERIOD_ID = payroll.time_period_id
    --and pet.element_NAME like 'IVTB%' 
    AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
    AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
    AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE*/
    AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
    AND pec1.classification_name LIKE '%Deduction%'
    AND piv.name = 'Pay Value'
    --and paa.PRIMARY_FLAG like 'Y%'
    /*AND paa.payroll_id != 0
    AND paa.pay_basis_id != 0*/
    GROUP BY
    prr.run_result_id
    However, the fact is that my each element_type_id has each run_result_id, which means 1 element has 1 run result id. Thus, I cannot display the data in a single row.
    Can someone guide me on this? How can I display the data for an employee as a single row?
    Thanks and regards,
    Aparna

    SELECT EMP_ID,
         Sum(Decode(DECODE(pec1.classification_name,'Other Deductions', 'Other Deductions','Others Voluntary Deductions', 'Other Deductions'),'Other Deductions',TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Other deduction',
         sum(Decode(DECODE(pec1.classification_name,'Personal Deductions', 'Personal Deductions', 'Personal Voluntary Deductions', 'Personal Deductions'),'Personal Deductions'),TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Personal deduction',
         sum(DECODE(pec1.classification_name,'Car Loan Deductions',TO_NUMBER(NVL(prrv.RESULT_VALUE, 0)))) 'Car deduction'
    FROM hr.pay_element_classifications pec,
    hr.pay_element_classifications pec1,
    hr.pay_sub_classification_rules_f scr,
    hr.pay_element_types_f pet,
    hr.pay_run_results prr,
    hr.pay_run_result_values prrv,
    hr.pay_input_values_f piv,
    hr.pay_assignment_actions assact,
    hr.per_all_assignments_f paa,
    hr.pay_payroll_actions payroll,
    hr.per_time_periods ptp
    WHERE
    pec.classification_id = pec1.parent_classification_id (+)
    AND scr.classification_id = pec1.classification_id
    AND pet.classification_id = pec.classification_id
    AND scr.element_type_id = pet.element_type_id
    AND pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
    AND prr.run_result_id = prrv.run_result_id
    AND piv.input_value_id = prrv.input_value_id
    AND assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
    AND paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
    AND payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
    AND ptp.TIME_PERIOD_ID = payroll.time_period_id
    AND ptp.end_date BETWEEN scr.EFFECTIVE_START_DATE AND scr.EFFECTIVE_END_DATE
    AND ptp.end_date BETWEEN pet.effective_start_date AND pet.effective_end_date
    AND ptp.end_date BETWEEN paa.EFFECTIVE_START_DATE AND paa.EFFECTIVE_END_DATE
    AND pec.CLASSIFICATION_NAME IN ('Voluntary Deductions', 'Pre-Tax Deductions')
    AND pec1.classification_name LIKE '%Deduction%'
    AND piv.name = 'Pay Value'
    AND paa.payroll_id != 0
    AND paa.pay_basis_id != 0     
    I hope this may help!
    Brijesh

  • SQL Update a Single Row Multiple Times Using 2 Data Sets

    I'm working in tsql and have an issue where I need to do multiple updates to a single row based on multiple conditions. 
    By Rank_
    If the column is NULL I need it to update no matter what the Rank is.
    If the Ranks are the same I need it to update in order of T2_ID.
    And I need it to use the last updated output.
    I've tried using the update statement below but it only does the first update and the rest are ignored. Here is an example of the data sets i'm working w/ and the Desired results. Thanks in advance!
    update a
    set Middle = case when a.Rank_> b.Rank_ OR a.Middle IS NULL then ISNULL(b.Middle,a.Middle) end,
    LName = case when a.Rank_> b.Rank_ OR a.Lname IS NULL then ISNULL(b.LName,a.LName) end,
    Rank_ = case when a.Rank_> b.Rank_ then b.Rank_ end
    from #temp1 a
    inner join #temp2 b on a.fname = b.fname
    where b.T2_ID in (select top 100% T2_ID from #temp2 order by T2_ID asc)

    The Merge clause actually errors because it attempt to update the same record.  I think this CTE statement is the closest I've come but I'm still working through it as I'm not too familiar w/ them.  It returns multiple rows which I will have to
    insert into a temp table to update since the resulting row I need is the last in the table.
    ;WITH cteRowNumber
    AS(
    Select DISTINCT
    Row_Number() OVER(PARTITION BY a.LName ORDER BY a.LName ASC, a.Rank_ DESC,b.T2ID ASC) AS RowNumber
    ,a.FName
    ,a.LName
    ,b.LName as xLname
    ,a.MName
    ,b.MName AS xMName
    ,a.Rank_
    ,b.Rank_ AS xRank
    ,b.T2ID
    FROM #temp1 a
    inner join #temp2 b
    ON a.fname = b.fname
    ), cteCursor
    AS(
    Select a.RowNumber,
    a.Fname
    ,a.LName
    ,a.xLname
    ,a.MName
    ,a.xMName
    ,a.xRank
    ,a.T2ID
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xRank,a.Rank_) else ISNULL(a.Rank_,a.xRank) end AS Alt_Rank_
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xMName,a.MName) else ISNULL(a.MName,a.xMName) end AS Alt_MName
    ,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xLName,a.lname) else ISNULL(a.LName,a.xlname) end as Alt_Lname
    FROM cteRowNumber a
    where a.RowNumber = 1
    UNION ALL
    Select crt.RowNumber
    ,crt.FName
    ,crt.LName
    ,crt.xLname
    ,crt.MName
    ,crt.xMName
    ,crt.xRank
    ,crt.T2ID
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xRank,Prev.Alt_Rank_) else ISNULL(Prev.Alt_Rank_,crt.xRank) end AS Alt_Rank
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xMName,Prev.Alt_MName) else ISNULL(Prev.Alt_MName,crt.xMName) end AS Alt_MName
    ,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xLName,Prev.Alt_Lname) else ISNULL(Prev.Alt_Lname,crt.xLName) end as Alt_Lname
    FROM cteCursor prev
    inner join cteRowNumber crt
    on prev.fname = crt.fname and prev.RowNumber + 1 = crt.RowNumber
    SELECT cte.*
    FROM cteCursor cte

Maybe you are looking for