Adding Dates To Query

What I am trying to achieve.
I have 3 tables.
tblCUSTDETAILS - Contains Customers Information.
tblFLTNUMS - Contains Faults The Customer Has
tblCONTACTS - Contains The Monthly Volume of Contacts by the Customer.
What I want to do is show the amount of contacts 3 months after the date of the fault. So I can say things like 3 month after a fault the customer still contacts us back as they have lost confidence with our service. etc.
The problem is that if the customer hasn't called back for a specific month then it doesn't record 0 and this is what I want.
WITH tblCUSTDETAILS AS (
    SELECT  '11111' AS CUST_ID, 'John Smith' AS CUST_NAME FROM DUAL UNION ALL
    SELECT  '11112' AS CUST_ID, 'Andy Wilson' AS CUST_NAME FROM DUAL
), tblFLTNUMS AS (
    SELECT  '11111' AS CUST_ID, TO_DATE('JAN-10', 'MON-YY') AS FLT_DT FROM DUAL UNION ALL
    SELECT  '11112', TO_DATE('FEB-10', 'MON-YY') FROM DUAL UNION ALL
    SELECT  '11112', TO_DATE('APR-10', 'MON-YY') FROM DUAL 
   tblCONTACTS AS (
    SELECT  '11111' AS CUST_ID, TO_DATE('JAN-10', 'MON-YY') AS CONTACT_DT, 5 AS CONTACT_VOL FROM DUAL UNION ALL
    SELECT  '11111', TO_DATE('FEB-10', 'MON-YY'), 3 FROM DUAL UNION ALL
    SELECT  '11112', TO_DATE('MAR-10', 'MON-YY'), 1 FROM DUAL UNION ALL
    SELECT  '11112', TO_DATE('MAY-10', 'MON-YY'), 2 FROM DUAL
SELECT  t1.cust_id,
        t2.cust_name,
        t1.flt_dt,
        t3.contact_dt,
        t3.contact_vol
FROM    tblFLTNUMS t1
JOIN    tblCUSTDETAILS t2
    ON t1.cust_id = t2.cust_id
JOIN    tblCONTACTS t3
    ON t1.cust_id = t3.cust_id
ORDER BY flt_dt, contact_dt, cust_name DESC
;   As you can see by the atttached example Joh Smith had a fault on the 01/01/2010 and contacted us on the 01/01, 01/02 and not on the 01/03 but I want the 01/03 to say 0.
As this is just a one of report I can not rebuild the tables so a SQL based solution is required.
I hope you can help.

I'm not sure what you are really after but I gave it a shot:
SQL> WITH tblCUSTDETAILS AS (
  2      SELECT  '11111' AS CUST_ID, 'John Smith' AS CUST_NAME FROM DUAL UNION ALL
  3      SELECT  '11112' AS CUST_ID, 'Andy Wilson' AS CUST_NAME FROM DUAL
  4  ), tblFLTNUMS AS (
  5      SELECT  '11111' AS CUST_ID, TO_DATE('JAN-10', 'MON-YY') AS FLT_DT FROM DUAL UNION ALL
  6      SELECT  '11112', TO_DATE('FEB-10', 'MON-YY') FROM DUAL UNION ALL
  7      SELECT  '11112', TO_DATE('APR-10', 'MON-YY') FROM DUAL
  8  ), tblCONTACTS AS (
  9      SELECT  '11111' AS CUST_ID, TO_DATE('JAN-10', 'MON-YY') AS CONTACT_DT, 5 AS CONTACT_VOL FROM DUAL UNION ALL
10      SELECT  '11111', TO_DATE('FEB-10', 'MON-YY'), 3 FROM DUAL UNION ALL
11      SELECT  '11112', TO_DATE('MAR-10', 'MON-YY'), 1 FROM DUAL UNION ALL
12      SELECT  '11112', TO_DATE('MAY-10', 'MON-YY'), 2 FROM DUAL
13  ), tblMonthParameters AS (
14          SELECT  MIN(FLT_DT) AS startMonth
15          ,       ADD_MONTHS(MAX(FLT_DT),2) AS endMonth
16          FROM    tblFLTNUMS
17  ), tblMONTHS AS (
18          SELECT  ADD_MONTHS(startMonth,ROWNUM - 1) AS DT
19          FROM    tblMonthParameters
20          CONNECT BY LEVEL <= MONTHS_BETWEEN(endMonth,startMonth) + 1
21  )
22  SELECT  t1.cust_id,
23          t2.cust_name,
24          t1.flt_dt,
25          t3.dt,
26          NVL(t3.contact_vol,0)   AS CONTACT_VOL
27  FROM    tblFLTNUMS t1
28  JOIN    tblCUSTDETAILS t2
29      ON t1.cust_id = t2.cust_id
30  JOIN    (
31                  SELECT  CUST_ID
32                  ,       CONTACT_VOL
33                  ,       DT
34                  FROM    tblCONTACTS PARTITION BY (tblCONTACTS.CUST_ID)
35                  RIGHT JOIN tblMONTHS  ON tblCONTACTS.CONTACT_DT = tblMONTHS.DT
36          ) t3
37      ON  t3.CUST_ID = T1.CUST_ID
38      AND MONTHS_BETWEEN(t3.DT,t1.FLT_DT) BETWEEN 0 AND 2
39  ORDER BY flt_dt, dt, cust_name DESC
40  ;
CUST_ CUST_NAME   FLT_DT              DT                           CONTACT_VOL
11111 John Smith  01/01/2010 00:00:00 01/01/2010 00:00:00                    5
11111 John Smith  01/01/2010 00:00:00 02/01/2010 00:00:00                    3
11111 John Smith  01/01/2010 00:00:00 03/01/2010 00:00:00                    0
11112 Andy Wilson 02/01/2010 00:00:00 02/01/2010 00:00:00                    0
11112 Andy Wilson 02/01/2010 00:00:00 03/01/2010 00:00:00                    1
11112 Andy Wilson 02/01/2010 00:00:00 04/01/2010 00:00:00                    0
11112 Andy Wilson 04/01/2010 00:00:00 04/01/2010 00:00:00                    0
11112 Andy Wilson 04/01/2010 00:00:00 05/01/2010 00:00:00                    2
11112 Andy Wilson 04/01/2010 00:00:00 06/01/2010 00:00:00                    0
9 rows selected.I added two more tables to your WITH clause. The tblMonthParameters calculates the minimum FLT_DT and maximum FLT_DT + 2 months based on your three month fault requirement. The tblMonths takes these input parameters and generates a dense month range.
This dense month range is then outer joined using the PARTITION BY syntax to the tblCONTACTS table to generate the range of months for each customer. This result is then used as a subquery to the original main query that you had joining based on the customer and FLT_DT. Where the customer did not contact for a particular month I've placed a 0 in the CONTACT_VOL column.
If this isn't correct please let me know. This solution depends on 10g so if you don't have it you may have to find another way to achieve this.
HTH!

Similar Messages

  • Help: How to call a user defined function in a data block query?

    I created a string aggregation function in the program unit, see reference:
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
    I now like to call the function in my data block query. I got the error: ORA-00904: 'concatenate_list' invalid identifier.
    Please help.
    Thank you in advance.
    Jimmy

    Hi,
    You can write UDFs in java in Graphical mapping to enhance your XI Graphical mapping functionality
    The steps for doing it would be:
    1. Click on Create New function Button found on Bottom left corner on your XI Mapping window.
    2. Write your java code.
    3. Run the Mapping Test as usual.
    >>The module that is given here ...where and how it is used.
    The adapters in the Adapter Framework convert XI messages to the protocols of connected external systems and the other way around. When doing so, some
    functionality might need to be added specific to a situation which is possible with the use of custom modules.
    Typical example would be validation of file content when using a File Adapter or modification of the message payload to a common content structure which is not supported by any of the standard SAP modules.
    An Adapter module is developed as an Enterprise Java Bean and is called locally by the Adapter.
    An example on modules :
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/da5675d1-0301-0010-9584-f6cb18c04805">How to develop a module for reading file name in a sender file adapter XI 3.0</a>
    Cheers,
    Chandra

  • How to backdate Date Added date

    Im trying to change my date added date because my old computer crashed, but i backed up all my music on an external harddrive, but then when I imported my music to my new computer, all the date added dates were as if I had added all those songs that day, and not when I had actually added them to my itunes library. Is there a way to back date songs without changing my system clock, adding songs and all that.

    This is the iTunes for Windows forum. You appear to be asking a question about iPhoto on a Mac. You might want to repost your query in a more relevant forum. The people checking this one may not know much about what you're asking.
    Maybe this one:
    http://discussions.apple.com/forum.jspa?forumID=1192
    Best of luck.

  • Not able to access data in Query

    Hi,
    I have loaded data using DTP from 2 different source systems.
    One is 3.x emulated datasource and the other is New 7.0 datasource.I have loaded data sucessfully in to DSO.Built a query on same.
    But when iam executing the query by material as selection criteria.Iam not able to found data in query from one source system.The same data is available in DSO.Please needed in this regard.

    Hi Venkat,
    After extracting data into DSO check the request whether active or not.
    Check data in DSO in contents.
    If is there any restrictions on info providers in Queries.
    Let us know status clearly.......
    Reg
    Pra

  • Adding data to a specific row in excel

    Hi there,
                        I have problems with my data collection from serial read block. I get every time 16 bytes when I write certain command to my serial device. But after a continuous data written to excel, that is let say six rows of data and after that I get one byte of data which I do not want to save in current updating excel sheet. 
    For that now, I have taken a case structure with two cases, one case contains nothing when I read the one byte and another case contains the code(Spreadsheet file VI) for adding data to excel when 16 bytes received one by one. Still, I am not getting what I wish for. The one byte case adding zero to the current excel file at row 6 and then continuous with 16bytes of data in remaining rows and again after 6 continuous rows it adds zero and so on. I don't know why it is adding zero even i did not put any code inside the case of it.
    How could I eliminate this adding of zeros?
    Here it looks like in my excel sheet.
    row1: 15 16 17 18 19 20
    row2: 15 16 17 18 19 20
    row3: 15 16 17 18 19 20
    row4: 15 16 17 18 19 20
    row5: 15 16 17 18 19 20
    row6: 0                            (This when one byte reception case which contains no spreadsheet file VI)
    row7: 15 16 17 18 19 20
    row8: 15 16 17 18 19 20
    row9: 15 16 17 18 19 20
    row10: 0
    Any help here around!

    You misunderstood my point. I have no code inside the adding zero case. It adding by no meaning. I have only written in one case to add continuous data to excel when ever I receive more than one byte. If I receive one byte exactly, I would not like to append this to excel but currently my program is doing that.
    I have added my code snippet which is not the current working code. I am out of access to my current code. But instead I have attached similar one. You merely assume that the data is coming form serial read block.
    Thanks for your efforts.
    Attachments:
    Excel.vi ‏11 KB

  • Adding data labels to column graph

    I work in the financial industry and I have to add data labels to all bars that appear in my ten year performance graphs (see http://fundinvestor.calamos.com/ClosedEndFunds/CEFund.aspx?name=CHI under the "Performance" tab as an example). Is there a script that can do this? I saw there's this technique that Adobe offers for column totals: http://livedocs.adobe.com/en_US/Illustrator/13.0/help.html?content=WS714a382cdf7d304e7e07d 0100196cbc5f-619e.html but that's not working. What am I doing wrong? Adding data labels to bars is ridiculously simple in Excel, why can't I find the way to do it easily in Illustrator?

    http://help.adobe.com/en_US/Illustrator/14.0/WS714a382cdf7d304e7e07d0100196cbc5f-619ea.htm l
    That should do the trick.
    Mylenium

  • Adding data to Manual Distribution Rule from DIAPI

    Hi
    I am searching for the object to insert the data to OMDR (manual distribution rule) using DI API. Can any one help me out.
    I found many questions related to adding data to manual distribution rule using DIAPI which were not answered.
    Thanks in Advance.

    hi.
    Just check the below posts.
    object type of distribution rules
    Distribution rules setup..

  • Adding data to multiple tables using one form in Access 2010?

    Hi All,
    I have a access database with two tables and I want to create a single form to enter data into that tables.
    How to adding data to multiple tables using one form in Access 2010?
    I don't have to much knowledge of access database?
    Please help me
    Thanks
    Balaji

    You really don't enter identical data into 2 tables.  You enter dat into one single table, and then you have an unique identifier that maps to another table (you have a unique relationship between two tables). 
    Maybe you need to read this.
    http://office.microsoft.com/en-001/access-help/database-design-basics-HA001224247.aspx
    Think about it this way...  What is you update data in 2 tables, and then the data in one of those tables changes, but the data in the other table does NOT change.  WHOOPS!!  Now, you've got a BIG problem.  For instance, you have a customer
    named Bill Gates.  In one Table you update Bill's address to 1835 73rd Ave NE, Medina, WA 98039 and in the other table you accidentally update Bill's address to 183 73rd Ave NE, Medina, WA 98039.  Now you have 2 addresses for Bill.  Why would
    you want that???  Which is right?  No one knows.  If you have one address, you just have to update one address and if there is a mistake, you just have to update one address, but you don't have to waste time trying to figure out which is right
    and which is wong...and then update the one that is wrong.
    Post back with specific questions.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Adding data in internal table using extracted data

    Hi Experts,
    Good day!
    I have a requirements in our historical data of material price which adding data that are not existing based on data extracted from standard tables such as A004 and KONP.
    Now, i need to use the VALIDFROM (DATAB) value as basis for the latest price.
    To make it more clear, see the example below:
    Extracted data:
    Material Number      Valid From       Valid to          Price
    100101                   01/01/2008      02/01/2008     100.00      
    100101                   02/02/2008      04/02/2008     100.00
    100101                   04/03/2008      08/01/2008     200.00
    100101                   08/02/2008      01/31/2009     300.00  
    100102                   05/02/2008      07/01/2008      10.00
    100102                   07/02/2008      10/31/2008      15.00 
    100102                   11/01/2008      01/31/2009      20.00  
    Output:
    Material Number     Calmonth        Price
    100101                 01/2008           100.00
    100101                 02/2008           100.00
    100101                 03/2008           100.00
    100101                 04/2008           200.00
    100101                 05/2008           200.00
    100101                 06/2008           200.00
    100101                 07/2008           200.00
    100101                 08/2008           300.00
    100101                 09/2008           300.00
    100101                 10/2008           300.00
    100101                 11/2008           300.00
    100101                 12/2008           300.00
    100101                 01/2009           300.00
    100102                 05/2008           10.00
    100102                 06/2008           10.00
    100102                 07/2008           15.00
    100102                 08/2008           15.00
    100102                 09/2008           15.00
    100102                 10/2008           15.00
    100102                 11/2008           20.00
    100102                 12/2008           20.00
    100102                 01/2009           20.00
    Text that are in bold are the added data. What is the best code to do with this?
    How can i come up with this output? Help me please
    Thanks and Godbless,
    nips

    Hi Nips,
    Logic shud b sumthing on similar lines
    lv_count = 1.
    Loop at itab into watab.
    if lv_count > 12.
    lv_count = 1.
    endif.
    if watab-date+0(2) = lv_count.
    append watab to gt_output.
    continue.
    else.
    concatenate lv_count sy-datum+4(4) into watab-date.
    append watab to gt_output.
    endif.
    endloop.
    Best regards,
    Prashant

  • Adding Data in the grid

    One thing I am finding a little awkward; Adding data in the grid. It would be nice to be able to use tab to get to the next cell. At present it just highlights the cell and typing doesn't do anything until the cell is clicked. Equally hitting return I would expect it to give me a new blank row. I would like to be able to add a couple of rows of data without resorting to using the mouse at each turn.
    Very good initial impressions though.

    Yes we should do this as it's what everyone will expect from Excel.
    -kris

  • Adding data from one matrix to another

    Hay guys.I'm having trouble with adding data, that is situated in a Matrix on form A and bound to a userdatasource,
    to a Matrix on form B that is bound to a dbdatasource.
    For some reason the data either does not display at all, or it only displays the last records' data as many times
    as there are records in the original matrix from form A.
    Here's the code I've tried: (Displays only last record x times)
    For i = 1 To oMatrixSync.RowCount
    oFormTime.DataSources.DBDataSources.Item("@TB_TIMEDET").SetValue("U_Activity", _
                              oMatrixTime.RowCount, _
                              oFormSync.DataSources.UserDataSources.Item("U_Act").ValueEx)
    oMatrixTime.AddRow()
    next
    And this code displays zip:
    For i = 1 To oMatrixSync.RowCount
      oCheckBox = oMatrixSync.Columns.Item("c_Check").Cells.Item(i).Specific
      If oCheckBox.Checked = True Then
        oEditS = oMatrixSync.Columns.Item("c_Activity").Cells.Item(i).Specific
        oFormTime.DataSources.DBDataSources.Item("@TB_TIMEDET").SetValue("U_Activity", _
                   oMatrixTime.RowCount, _
                   oEditS.Value)
      oMatrixTime.AddRow()
      oMatrixTime.LoadFromDataSource()
    next
    Any help would be greatly appreciated, thanx all!
    Message was edited by: Tjaard Du Plessis

    Thanks, Jaro!
    You are right. The code should look like this:
    Dim oDBDSTime As DBDataSource = oFormTime.DataSources.DBDataSources.Item("@TB_TIMEDET")
    Dim oUDSSync As UserDataSource = oFormSync.DataSources.UserDataSources.Item("U_Act")
    For i = 1 To oMatrixSync.RowCount
    oMatrixSync.GetLineData(i)
    oDBDSTime.InsertRecord(i)
    oDBDSTime.SetValue("U_Activity", _
                        i, _
                        oUDSSync.ValueEx)
    Next
    oMatrixTime.LoadFromDataSource()
    Regards,
    Frank

  • Adding data source-JDBC

    Hi Guys,
    I have another problem on adding data source on EID. When I try adding a data source on EID as a JDBC source I get error that says "Could not establish a connection"..Do you tell me step by step what I have to do when I add a data source on Endeca? My data has based on SQL 2008.

    The Studio Administration and Customization Guide includes the information on creating and managing data sources.
    Adding and editing data sources in the Data Source Library
    I don't know anything about the specific format of a connection URL for SQL 2008. That should be fairly standard, though.

  • Adding data dynamically to JTable with a filter - getting error

    Hello,
    I am using JTable, and adding data and displaying it worked fine
    until I tried adding a filter,
    can anyone tell me what am I doing wrong or
    why am I getting this Error?
    The Error message
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
            at javax.swing.DefaultRowSorter.convertRowIndexToModel(DefaultRowSorter.java:501)
            at javax.swing.JTable.convertRowIndexToModel(JTable.java:2620)
            at javax.swing.JTable.getValueAt(JTable.java:2695)
            at javax.swing.JTable.prepareRenderer(JTable.java:5712)
            at javax.swing.plaf.basic.BasicTableUI.paintCell(BasicTableUI.java:2075)
            at javax.swing.plaf.basic.BasicTableUI.paintCells(BasicTableUI.java:1977)
            at javax.swing.plaf.basic.BasicTableUI.paint(BasicTableUI.java:1773)
            at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
            at javax.swing.JComponent.paintComponent(JComponent.java:763)
            at javax.swing.JComponent.paint(JComponent.java:1027)
            at javax.swing.JComponent.paintChildren(JComponent.java:864)
            at javax.swing.JComponent.paint(JComponent.java:1036)
            at javax.swing.JViewport.paint(JViewport.java:747)
            at javax.swing.JComponent.paintChildren(JComponent.java:864)
            at javax.swing.JComponent.paint(JComponent.java:1036)
            at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
            at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:277)
            at javax.swing.RepaintManager.paint(RepaintManager.java:1217)
            at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
            at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
            at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:803)
            at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:714)
            at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:694)
            at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
            at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)I am also using my own class that extends "AbstractTableModel"
    as TableModel,
    public class MyTableModel extends AbstractTableModel  {
        ArrayList<TableData> tableData=new ArrayList<TableData>(10);
        String[] columnNames=new String[]{"S/N"," Time (mili)","SD","SA","SSAP","DA","DSAP","FC","DATA"};   
        public void addRow(TableData data){
            tableData.add(data);
            fireTableDataChanged();
        @Override
        public int getRowCount() {
            return tableData.size();
        public TableData getRow(int i){
            return tableData.get(i);
        @Override
        public int getColumnCount() {
            return columnNames.length;
        @Override
        public String getColumnName(int col) {
                return columnNames[col];
        @Override
        public Object getValueAt(int rowIndex, int columnIndex) {
            return tableData.get(rowIndex).getValue(columnIndex);
        }The Row Filter class
    class myRowFilter extends RowFilter<MyTableModel,Integer>{
            @Override
            public boolean include(Entry<? extends MyTableModel, ? extends Integer> entry) {
                // Entry < SomeCostumTableModel , Integer> entry   ; Integer =Identifier= Row Number
                boolean frame_type;
                MyTableModel model=entry.getModel();
                TableData data=model.getRow(entry.getIdentifier());
                frame_type=((SD1&&data.SD==TableData.SD1) ||
                                             (SD2&&data.SD==TableData.SD2) ||
                                             (SD3&&data.SD==TableData.SD3) ||
                                             (SD4&&data.SD==TableData.SD4) ||
                                             (SC&&data.SD==TableData.SC) );
               return frame_type;
        }and How I add the filter to the Table
        private MyTableModel myTableModel=new MyTableModel();
        private RowSelectionListener rowSelectionListener=new RowSelectionListener();
        TableRowSorter<MyTableModel> sorter=new TableRowSorter<MyTableModel>(myTableModel);
        private FilterFrame filterFrame=new FilterFrame(this);
        // then in the constructor of the main frame
        // I call this
            sorter.setRowFilter(filterFrame.filter);
            MainTable.setRowSorter(sorter);
            sorter.setSortsOnUpdates(true);Edited by: YellowMurdoch on Nov 17, 2009 6:31 AM
    Edited by: YellowMurdoch on Nov 17, 2009 6:31 AM

    Thanks for noting that.
    you mean like this?
    public void addEntry(TableData data){
            myTableModel.addRow(data);
            javax.swing.SwingUtilities.invokeLater(new Runnable(){
                @Override
                public void run(){
                        myTableModel.fireTableRowsInserted(0,0);
        }both work,
    would putting "invokeLater" inside "addEntry" somehow mess other things?
    i guess that means addRow() is not supposed to update the table graphically?
    Edited by: YellowMurdoch on Nov 17, 2009 9:30 AM
    Edited by: YellowMurdoch on Nov 17, 2009 9:33 AM

  • Adding Data through LOV when LOV validation fails to bring row

    Question on Adding data to LOV:
    Just like in form 5(Professional Forms), Is there a way to dynamically insert the row to add data if the data entered is not in the LOV? I have searched forum and looked at Dev Guide but didn't find any notes. One way is making "AutoValidation" false so LOV will not fire and validate, THEN upon SAVE just commit trx. Will this work? or Is there a better thought. Thanks

    Set the Disable  Validation property of the LOV Item to "True"
    Thanks,
    Kumar

  • How Can I use a Variable  in Data Controls query. Frank Kindly check...

    Hii,
    I am using JDeveloper 11g ADF BC.
    My Requirement is that I hv a login screen which is taken from [http://blogs.oracle.com/shay/simpleJSFDBlogin.zip].
    I hv attached BC in this application. I want to use the login usercode in the next pages after login screen. Next screen contains 3 list items which will be populating based on the user. So I created &lt;af:selectOneChoice&gt; using the BC( Just drag & dropped the column into the page from the data controls). But in the data control i want to use this usercode for passing the condition. Now Data is coming without any condition.
    So How can I use the usercode in the Data controls query.
    When I tried to display the usercode in the next page it is showing by binding the value. its code is follows
    &lt;af:outputText value="#{backing_getUser.uid}"
    The program for checking the username & Password is follows.
    package login.backing;
    import oracle.adf.view.rich.component.rich.RichDocument;
    import oracle.adf.view.rich.component.rich.RichForm;
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    import oracle.adf.view.rich.component.rich.layout.RichPanelFormLayout;
    import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
    import java.sql.*;
    import java.util.List;
    import java.util.Map;
    import oracle.adf.view.rich.component.rich.output.RichMessage;
    import oracle.jdbc.OracleDriver;
    public class GetUser {
    private RichInputText uid;
    private RichInputText pid;
    private RichCommandButton commandButton1;
    private RichInputText inputText1;
    private RichInputText inputText2;
    public void setUid(RichInputText inputText1) {
    this.uid = inputText1;
    public void setPid(RichInputText inputText2) {
    this.pid = inputText2;
    public RichInputText getUid() {
    return uid;
    public RichInputText getPid() {
    return pid;
    public void setCommandButton1(RichCommandButton commandButton1) {
    this.commandButton1 = commandButton1;
    public RichCommandButton getCommandButton1() {
    return commandButton1;
    public String login_action() {
    // Add event code here...
    String user = this.getUid().getValue().toString();
    // String pass = inputText2.getValue().toString();
    String pid = this.getPid().getValue().toString();
    Connection conn;
    conn = getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery ("SELECT usercode FROM guser where usercode = '"+user.toUpperCase()+"' and pwd=F_TEST('"+pid.toUpperCase()+"')");
    if (rset.next()) {
    conn.close();
    return "good";
    conn.close();
    } catch (SQLException e) {
    System.out.println(e);
    return "bad";
    public static Connection getConnection() throws SQLException {
    String username = "ACCTS";
    String password = "ACCTS";
    String thinConn = "jdbc:oracle:thin:@SERVER1:1521:G5PS";
    DriverManager.registerDriver(new OracleDriver());
    Connection conn =
    DriverManager.getConnection(thinConn, username, password);
    conn.setAutoCommit(false);
    return conn;
    public void setInputText1(RichInputText inputText1) {
    this.inputText1 = inputText1;
    public RichInputText getInputText1() {
    return inputText1;
    public void setInputText2(RichInputText inputText2) {
    this.inputText2 = inputText2;
    public RichInputText getInputText2() {
    return inputText2;
    -----

    Hi,
    I didn't look at the example, but if you want to secure your application then you should use container managed security. Read this .
    Anyway, you could add this before return "good"; in your login_action()
    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("username", user);Then, you can access this from anywhere in the application by using #{sessionScope.username}.
    Pedja

Maybe you are looking for

  • Smart object & timeline

    In PS6 I'm having trouble synchonising an animated drummer [as a smart object] with the audio track from the original clip I've drawn inlayers - because, when I go to the smart object edit file, the audio isn't there. I tried to copy the track and pa

  • How do I download Premier Pro in cc? It is not listed in the apps list.

    How do I download Premier Pro in cc? It is not listed in the apps list.

  • Pdf files no longer contain page info

    Saving copies of web pages (e.g., financial documents) in 2005 printed headers with URL, and the footers had the date and time. Sometime in 2005 this info was no longer being 'printed' as a part of the pdf. I would like to have this info as a part of

  • Problem regarding queues..............XBQO*

    file ->BPM->File scenario................ when i run this scenario......i see two rows in the SXMB_MONI.... First: message from sender business service to BPM and Second: message from BPM to Receiver business service..... but for these rows in the MO

  • SVG bar chart label length

    There seems to be a display limit of 15 chars on the length of labels for a SVG bar chart. Any known workarounds ?