Need help with nested table

Hi,
I am using the following code which is failing with no data found error.
While if i hardcode the same value the code works.
create table test(input varchar2(10),result varchar2(10));
insert into test values('4093163','SUCCESS')
declare
TYPE acctid_tab IS table  OF varchar2(40);
    acctid       acctid_tab := acctid_tab ();
V_RESULT varchar2(20);
v_input varchar2(40);
i pls_integer;
begin
acctid := acctid_tab('4080402 4093163 64472');
i := acctid.FIRST;
WHILE i IS NOT NULL
LOOP
v_input :=   trim(substr(acctid(i),instr(acctid(i),' ',1),instr(acctid(i),' ',-1,2)));
SElect result into v_result from test
where input = v_input;
      i := acctid.NEXT (i);
   END LOOP;
END;
ORA-01403: no data found
ORA-06512: at line 14
declare
TYPE acctid_tab IS table  OF  varchar2(40);
    acctid       acctid_tab := acctid_tab ();
V_RESULT varchar2(20);
v_input varchar2(40);
i pls_integer;
begin
acctid := acctid_tab('4080402 4093163 64472');
i := acctid.FIRST;
WHILE i IS NOT NULL
LOOP
v_input :=   trim(substr(acctid(i),instr(acctid(i),' ',1),instr(acctid(i),' ',-1,2)));
SElect result into v_result from test
where input = '4093163';
      i := acctid.NEXT (i);
   END LOOP;
END;
PL/SQL procedure successfully completed.Please advise.
Thanks in advance.

I guess you can just do
declare
   v_input varchar2(1000);
begin
   v_input := '4080402 4093163 64472';
   for i in (select input, result
               from test
              where input in (select regexp_substr(v_input, '[^ ]*', 1, level)
                                from dual
                              connect by level <= length(v_input) - length(replace(v_input, ' ')) + 1))
   loop
      dbms_output.put_line(i.input || ' ' || i.result);
   end loop;
end;
/Or even better
declare
   v_input varchar2(1000);
begin
   v_input := '4080402 4093163 64472';
   for i in (select input, result
               from test
              where ' ' || v_input || ' ' like '% ' || input || ' %')
   loop
      dbms_output.put_line(i.input || ' ' || i.result);
   end loop;
end;

Similar Messages

  • Help with Nested Table

    Hello All
    I have a task about insert data into a nested table. First I will explain the scenario.
    I have 2 table (patients) and (tumors) that contain medical data about cancer patients.
    CREATE TABLE "DSS2_MINING"."PATIENTS"
       (     "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE,
         "REGISTRY_ID" NUMBER(10,0),
         "RACE" VARCHAR2(2 BYTE),
         "SEX" VARCHAR2(1 BYTE),
         "BIRTHDATE_YEAR" NUMBER(4,0),
         "NUMBER_OF_PRIMARIES" NUMBER(1,0),
         "VITAL_STATUS_RECORD" VARCHAR2(1 BYTE),
         "CAUSE_OF_DEATH" VARCHAR2(5 BYTE),
         "SURVIVAL_TIME" VARCHAR2(4 BYTE),
         "SURVIVAL_TIME_FINAL" NUMBER,
         "SURVIVAL_VARIABLE" VARCHAR2(1 BYTE),
          CONSTRAINT "PATIENTS_PK" PRIMARY KEY ("PATIENT_ID");
    CREATE TABLE "DSS2_MINING"."TUMORS"
       (     "TUMOR_ID" NUMBER NOT NULL ENABLE,
         "PATIENT_ID" VARCHAR2(10 BYTE),   -- FK
         "SEER_RECORD_NUMBER" NUMBER,       -- This column contain a sequance number of the records for each patients
         "MARITAL_STATUS" VARCHAR2(1 BYTE),
         "AGE" NUMBER,
         "DATE_OF_DIAGNOSIS" DATE,
         "HISTOLOGY_GROUP" VARCHAR2(2 BYTE),
         "BEHAVIOR" VARCHAR2(1 BYTE),
         "GRADE" VARCHAR2(1 BYTE),
         "DERIVED_AJCC_STAGE_GROUP" VARCHAR2(2 BYTE),
         "STAGE_OF_CANCER" VARCHAR2(2 BYTE),
         "RADIATION" VARCHAR2(1 BYTE),
         "CS_SCHEMA" VARCHAR2(2 BYTE),
         "FIRST_PRIMARY_IND" VARCHAR2(1 BYTE),
         "TUMOR_SIZE" NUMBER(4,1),
         "TUMOR_EXTENSION" VARCHAR2(2 BYTE),
         "LYMPH_NODES" VARCHAR2(1 BYTE),
         "NODES_POSITIVE" NUMBER,
         "ESTROGEN" VARCHAR2(3 BYTE),
         "PROGESTERONE" VARCHAR2(3 BYTE),
         "SURGERY" VARCHAR2(2 BYTE),
          CONSTRAINT "TUMORS_PK" PRIMARY KEY ("TUMOR_ID");The table (patients) contain the basic information about the patients. The table (tumors) contain information about the tumors. each record in the (patients) table can have one or more records in the (tumors) table using the (patient_id) column. I wanna move the data from the (patients) and (tumors) tables to a new table (cancer_patients) that contain a nested table column. so I did the following code
    create or replace type tumor_object AS
    object(
    tumor_id VARCHAR2(1),  
    marital_status VARCHAR2(1),  
    age NUMBER(3),  
    date_of_diagnosis DATE, 
    cs_schema VARCHAR2(2),  
    histology_group VARCHAR2(2),  
    behavior VARCHAR2(1),  
    grade VARCHAR2(1),  
    first_primary_ind VARCHAR2(1),  
    tumor_size NUMBER(4,   1),  
    tumor_extension VARCHAR2(2),  
    lymph_nodes VARCHAR2(1),  
    nodes_positive NUMBER(4),  
    surgery VARCHAR2(2),
    radiation VARCHAR2(1)
    create or replace type tumor_table as table of tumor_object;
      CREATE TABLE "DSS2_MINING"."CANCER_PATIENTS"
       (     "PATIENT_ID" VARCHAR2(10 BYTE) NOT NULL ENABLE,
         "RACE" VARCHAR2(2 BYTE),
         "SEX" VARCHAR2(1 BYTE),
         "NUMBER_OF_PRIMARIES" NUMBER(1,0),
         "TUMORS" "DSS2_MINING"."TUMOR_TABLE" ,
         "VITAL_STATUS_RECORD" VARCHAR2(1 BYTE),
         "CAUSE_OF_DEATH" VARCHAR2(5 BYTE),
         "SURVIVAL_TIME_FINAL" NUMBER,
         "SURVIVAL_VARIABLE" VARCHAR2(1 BYTE),
          CONSTRAINT "CANCER_PATIENTS_PK" PRIMARY KEY ("PATIENT_ID")
       NESTED TABLE "TUMORS" STORE AS "TUMORS_STOR_TABLE"
    So my problem about how to transfer and insert the data, I tried to use the associative array to hold the rows of the tumors table but it didn't work out. I think the main issue is that each record in the patients table have multiple records in the tumors table.
    I hope if anybody can help in this case or I you know any reference about similar cases
    Thanks
    A.L
    Edited by: user9003901 on Nov 26, 2010 2:48 AM

    Something like:
    INSERT
      INTO CANCER_PATIENTS
      SELECT  PATIENT_ID,
              RACE,
              SEX,
              NUMBER_OF_PRIMARIES,
               SELECT  CAST(
                            COLLECT(
                                    TUMOR_OBJECT(
                                                 TUMOR_ID,
                                                 MARITAL_STATUS,
                                                 AGE,
                                                 DATE_OF_DIAGNOSIS,
                                                 CS_SCHEMA,
                                                 HISTOLOGY_GROUP,
                                                 BEHAVIOR,
                                                 GRADE,
                                                 FIRST_PRIMARY_IND,
                                                 TUMOR_SIZE,
                                                 TUMOR_EXTENSION,
                                                 LYMPH_NODES,
                                                 NODES_POSITIVE,
                                                 SURGERY ,
                                                 RADIATION
                            AS TUMOR_TABLE
                 FROM  "TUMORS" T
                 WHERE T.PATIENT_ID = P.PATIENT_ID
              VITAL_STATUS_RECORD,
              CAUSE_OF_DEATH,
              SURVIVAL_TIME_FINAL,
              SURVIVAL_VARIABLE
        FROM  PATIENTS P
    /SY.
    P.S. This site has censorship. It replaces word S E X with ***, so change it back when testing.

  • [SOLVED :)] Need help with adf table row selection

    Hi,
    In my application I am displaying results in a table. The DisplayRow property of table is set to Selected
    There are Next and Back buttons which help user to view details associated to the next/previous rows.
    I am using ADF 11g
    When user clicks Next or Previous button, then the selection of the row should also gets updated
    To achieve this i wrote below piece of code:
    this.tblS.getSelectedRowKeys().clear();+
    this.tblS.setRowIndex(count);+
    RowKeySet rks =  tblS.getSelectedRowKeys();+
    rks.add(tblS.getRowKey());+
    rks =  tblS.getSelectedRowKeys();+
    ISSUE:_
    When i run application and click Next/Previous Button, all functionalities do take place properly, but a null pointer exception is also thrown._+
    If i remove DisplayRow property of table from Selected to Default, every thing works good and no Exception is thrown_+       
    But as records in my table are going to be around 50-60 everytime, i need to set DisplayRow property of table to Selected.
    Is there any way to achieve this? Solve this problem?
    Some more details:_
    I am using a POJO class to create DataController. This DataController is having a view Object which is used to create results table.
    I have defined Primary key for my POJO Data Controller.
    Here is code of xml file:*
    +<?xml version="1.0" encoding="UTF-8" ?>+
    +<JavaBean xmlns="http://xmlns.oracle.com/adfm/beanmodel" version="11.1.1.52.5"+
    id="ProductListBean" Package="xxadf.mm.resources"
    BeanClass="xxadf.mm.resources.ProductListBean"
    isJavaBased="true">
    +<Attribute Name="Product" Type="java.lang.String" PrimaryKey="true"/>+
    +<Attribute Name="Stock" Type="java.lang.String"/>+
    +<Attribute Name="Rate" Type="java.lang.String"/>+
    +<Attribute Name="Accuracy" Type="java.lang.String"/>+
    +<Attribute Name="Details" Type="java.lang.String"/>+
    +<ConstructorMethod IsCollection="true"+
    Type="xxadf.mm.resources.ProductListBean"
    BeanClass="xxadf.mm.resources.ProductListBean"
    id="ProductListBean"/>
    +</JavaBean>+
    Error Log:*
    SEVERE: Server Exception during PPR, #1
    java.lang.NullPointerException
    at oracle.adfinternal.view.faces.model.binding.RowDataManager.getRowIndex(RowDataManager.java:200)
    at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.getRowIndex(FacesCtrlHierBinding.java:506)
    at org.apache.myfaces.trinidad.component.UIXIterator._fixupFirst(UIXIterator.java:414)
    at org.apache.myfaces.trinidad.component.UIXIterator.__encodeBegin(UIXIterator.java:392)
    at org.apache.myfaces.trinidad.component.UIXTable.__encodeBegin(UIXTable.java:168)
    at org.apache.myfaces.trinidad.component.UIXCollection.encodeBegin(UIXCollection.java:517)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeHorizontalChild(PanelGroupLayoutRenderer.java:458)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$100(PanelGroupLayoutRenderer.java:30)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:618)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:560)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:125)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:201)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:167)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:317)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer._encodeChild(PanelGroupLayoutRenderer.java:392)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.access$300(PanelGroupLayoutRenderer.java:30)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:641)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer$EncoderCallback.processComponent(PanelGroupLayoutRenderer.java:560)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:125)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:201)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:167)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelGroupLayoutRenderer.encodeAll(PanelGroupLayoutRenderer.java:317)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
    at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer.access$100(ShowDetailItemRenderer.java:31)
    at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer$ChildEncoderCallback.processComponent(ShowDetailItemRenderer.java:491)
    at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer$ChildEncoderCallback.processComponent(ShowDetailItemRenderer.java:464)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:125)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:201)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:167)
    at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer._encodeChildren(ShowDetailItemRenderer.java:406)
    at oracle.adfinternal.view.faces.renderkit.rich.ShowDetailItemRenderer.encodeAll(ShowDetailItemRenderer.java:114)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
    at oracle.adf.view.rich.render.RichRenderer.encodeStretchedChild(RichRenderer.java:1523)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer.access$500(PanelTabbedRenderer.java:38)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer$BodyEncoderCallback.processComponent(PanelTabbedRenderer.java:969)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer$BodyEncoderCallback.processComponent(PanelTabbedRenderer.java:920)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:125)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:201)
    at org.apache.myfaces.trinidad.component.UIXComponent.processFlattenedChildren(UIXComponent.java:167)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer._renderTabBody(PanelTabbedRenderer.java:519)
    at oracle.adfinternal.view.faces.renderkit.rich.PanelTabbedRenderer.encodeAll(PanelTabbedRenderer.java:233)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
    at oracle.adfinternal.view.faces.renderkit.rich.FormRenderer.encodeAll(FormRenderer.java:221)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:415)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:432)
    at oracle.adfinternal.view.faces.renderkit.rich.DocumentRenderer.encodeAll(DocumentRenderer.java:820)
    at oracle.adf.view.rich.render.RichRenderer.encodeAll(RichRenderer.java:1187)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:335)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:751)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.__encodeRecursive(UIXComponentBase.java:1494)
    at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeAll(UIXComponentBase.java:771)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
    at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:202)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:685)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:261)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:193)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:191)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:85)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:54)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:420)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:247)
    at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:157)
    at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.wls.JpsWlsFilter$1.run(JpsWlsFilter.java:96)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
    at oracle.security.jps.wls.util.JpsWlsUtil.runJaasMode(JpsWlsUtil.java:146)
    at oracle.security.jps.wls.JpsWlsFilter.doFilter(JpsWlsFilter.java:140)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:70)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:159)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.wls.DMSServletFilter.doFilter(DMSServletFilter.java:202)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3588)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2200)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2106)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1428)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    Please Help I have been struggling with this issue for long.
    Thanks and Regards
    Manav Ratra
    Edited by: user11255144 on Feb 8, 2010 5:33 AM

    Hi Arun,
    Thanks for replying.
    Actually in my application there is one result table and a section that is displaying complete details of the product selectd in result table.
    The next/previous buttons are not binded with result table.
    What I am doing is, I am puuliing data from VO and displaying it on form, whenever any of these buttons is clicked.
    As soon as these buttons are clicked data is coming up, but selection state of table is not getting updated.
    So to update selection state i wrote piece of code described in my previous post.
    Everything works fine if displayRow property of table is not set to selected.
    If i set display row property of table to selected, then i get a null pointer exception with message log defined in previous post.
    Although NPE is thrown, yet all data is properly fetched and table selection is also updated. But am not able to get how this NPE is coming and hpw to fix it .
    (I need to keep displayRow = selected, for all other cases NPE is not thrown)
    Please help..
    Thanks and Regards
    Manav Ratra

  • Need help with JSF table and scrollable pages

    I need help regarding usage of <t:dataTable>
    I have a List on my managed bean. It has 50 records.
    I am displaying the first 10 records and need to implement paging.
    I hear that there is a faces taglibrary called tomahawk which provides a <t:dataTable> and a <t:dataScroller> to implement scrolling.
    Is there a sample implentation that I can take a look at to see how I can solve my problem??
    Any help is highly appreciated.
    Thanks
    Amol

    Check here: http://www.irian.at/myfaces/dataScroller.jsf;jsessionid=F3F50A51583FEEF38D968A4AF5DC949C

  • URGENTLY NEED HELP WITH NESTED REPEAT REGION

    Im using dreamweaver to deevelop a page that displays questions in ann assessment to the user. First of all the page shows the assessment name to the user and then it gets some information about the questions in the assessment from the table called Item. It gets the Question_ID and then there is a repeat region which uses the Question_ID to display the questions in the assessment. There is a nested repeat region inside this which displays the possible answers the user can respond to the question with It gets this information from a table called outcome. The page should display each question and then all the possible answers but i am having problems and im not sure wether i am doing this in the correct way. What is wrong with my code? PLEASE HELP! can someone tell me what is going wrong and how i can fix this problem thamks.
    here is my code.
    Driver DriverassessmentRecordset = (Driver)Class.forName(MM_connAssessment_DRIVER).newInstance();
    Connection ConnassessmentRecordset = DriverManager.getConnection(MM_connAssessment_STRING,MM_connAssessment_USERNAME,MM_connAssessment_PASSWORD);
    PreparedStatement StatementassessmentRecordset = ConnassessmentRecordset.prepareStatement("SELECT Assessment_ID, Assessment_Name, Time_Limit, Display_Random, Record_Answers FROM Assessment.assessment WHERE Assessment_ID = '" + session.getValue("AssessmentID") + "' ");
    ResultSet assessmentRecordset = StatementassessmentRecordset.executeQuery();
    boolean assessmentRecordset_isEmpty = !assessmentRecordset.next();
    boolean assessmentRecordset_hasData = !assessmentRecordset_isEmpty;
    Object assessmentRecordset_data;
    int assessmentRecordset_numRows = 0;
    %>
    <%
    Driver DriveritemRecordset = (Driver)Class.forName(MM_connAssessment_DRIVER).newInstance();
    Connection ConnitemRecordset = DriverManager.getConnection(MM_connAssessment_STRING,MM_connAssessment_USERNAME,MM_connAssessment_PASSWORD);
    PreparedStatement StatementitemRecordset = ConnitemRecordset.prepareStatement("SELECT Question_ID, Assessment_ID FROM Assessment.item WHERE Assessment_ID = '" + session.getValue("AssessmentID") + "' ");
    ResultSet itemRecordset = StatementitemRecordset.executeQuery();
    boolean itemRecordset_isEmpty = !itemRecordset.next();
    boolean itemRecordset_hasData = !itemRecordset_isEmpty;
    Object itemRecordset_data;
    int itemRecordset_numRows = 0;
    %>
    <%
    Driver DriverquestionRecordset = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
    Connection ConnquestionRecordset = DriverManager.getConnection(MM_connAnswer_STRING,MM_connAnswer_USERNAME,MM_connAnswer_PASSWORD);
    //PreparedStatement StatementquestionRecordset = ConnquestionRecordset.prepareStatement("SELECT Question_Type, Number_Outcomes, Question_Wording FROM Answer.question WHERE Question_ID = '" + (((itemRecordset_data = itemRecordset.getObject("Question_ID"))==null || itemRecordset.wasNull())?"":itemRecordset_data) +"' ");
    //ResultSet questionRecordset = StatementquestionRecordset.executeQuery();
    %>
    <%
    Driver DriveroutcomeRecordset = (Driver)Class.forName(MM_connAnswer_DRIVER).newInstance();
    Connection ConnoutcomeRecordset = DriverManager.getConnection(MM_connAnswer_STRING,MM_connAnswer_USERNAME,MM_connAnswer_PASSWORD);
    PreparedStatement StatementoutcomeRecordset = ConnoutcomeRecordset.prepareStatement("SELECT Outcome_Number, Outcome_Text, Score, Feedback FROM Answer.outcome WHERE Question_ID = '" +itemRecordset.getObject("Question_ID")+ "' ");
                     ResultSet outcomeRecordset = StatementoutcomeRecordset.executeQuery();
                     boolean outcomeRecordset_isEmpty = !outcomeRecordset.next();
                    boolean outcomeRecordset_hasData = !outcomeRecordset_isEmpty;Object outcomeRecordset_data;
                  int outcomeRecordset_numRows = 0;
    %>
    <%
    int Repeat1__numRows = -1;
    int Repeat1__index = 0;
    itemRecordset_numRows += Repeat1__numRows;
    %>
    <%
    int Repeat2__numRows = -1;
    int Repeat2__index = 0;
    assessmentRecordset_numRows += Repeat2__numRows;
    %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/assessment.dwt.jsp" codeOutsideHTMLIsLocked="false" -->
    <head>
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Assessment</title>
    <!-- InstanceEndEditable -->
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <!-- InstanceBeginEditable name="head" -->
    <!-- InstanceEndEditable -->
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <table width="1000" border="0" cellpadding="0" cellspacing="0">
      <!--DWLayoutTable-->
      <tr>
        <td height="190"><img src="../img/assessment_login.png" alt="" name="navigation" width="1000" height="190" border="0" id="navigation" /></td>
      </tr>
      <tr>
        <td height="19"><!--DWLayoutEmptyCell--> </td>
      </tr>
      <tr>
        <td height="19"><!-- InstanceBeginEditable name="main" -->
        <table>
          <tr>
            <td width="990">Assessment Name:<%=(((assessmentRecordset_data = assessmentRecordset.getObject("Assessment_Name"))==null || assessmentRecordset.wasNull())?"":assessmentRecordset_data)%> </td>
            </tr>
          <tr>
            <td><% int count = 1; %> </td>
          </tr>
          <tr>
            <td valign="top"><table>
                <% while ((itemRecordset_hasData)&&(Repeat1__numRows-- != 0)) { %>
    <tr>
                  <td width="21"> 
                     </td>
                  <td width="86">Question:<%= count %></td>
                </tr>
                <tr>
                  <td></td>
                  <td>
                     <% 
                     PreparedStatement StatementquestionRecordset = ConnquestionRecordset.prepareStatement("SELECT Question_Type, Number_Outcomes, Question_Wording FROM Answer.question WHERE Question_ID = '" +itemRecordset.getObject("Question_ID")+"' ");
                     ResultSet questionRecordset = StatementquestionRecordset.executeQuery();
                  boolean questionRecordset_isEmpty = !questionRecordset.next();
                  boolean questionRecordset_hasData = !questionRecordset_isEmpty;
                  Object questionRecordset_data;
                  int questionRecordset_numRows = 0;
                     %> <%= questionRecordset.getObject("Question_Wording") %></td>
                </tr>
                <tr>
                  <td></td>
                  <td>
                     </td>
                </tr>
                <tr>
                  <td></td>
                  <td> 
                    <table>
                      <% while ((outcomeRecordset_hasData)&&(Repeat2__numRows-- != 0)) {%>
                      <tr>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                      </tr>
                      <%
      Repeat2__index++;
      outcomeRecordset_hasData = outcomeRecordset.next();
    %>
                    </table>
                    <table>
                      <tr> </tr>
                      <tr> </tr>
                    </table></td>
                </tr>
                <%
      Repeat1__index++;
      itemRecordset_hasData = itemRecordset.next();
      count++;
    //questionRecordset.close();
    //StatementquestionRecordset.close();
    //ConnquestionRecordset.close();
    %>
    Here is the exception i am gettingorg.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 115 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:220: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 116 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:223: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 117 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:226: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 118 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:229: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java:232: cannot find symbol
    symbol : variable outcomeRecordsetRecordset_data
    location: class org.apache.jsp.delivery.session_jsp
    out.print((((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data));
    ^
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    Note: C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java uses or overrides a deprecated API.
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    Note: Recompile with -Xlint:deprecation for details.
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    Note: C:\Servers\Tomcat 5.0\work\Catalina\localhost\assessment\org\apache\jsp\delivery\session_jsp.java uses unchecked or unsafe operations.
    An error occurred at line: 119 in the jsp file: /delivery/session.jsp
    Generated servlet error:
    Note: Recompile with -Xlint:unchecked for details.
    5 errors
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)     org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
    org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

    Hi,
    Dont have much time to go through your code, but apparently i can see the error is becoz of the following reason.
    In the following code, you have used "outcomeRecordset_data ", but its not declared. You need to declare the variable first before you can use it.
    <% while ((outcomeRecordset_hasData)&&(Repeat2__numRows-- != 0)) {%>
                      <tr>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Number"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Outcome_Text"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Score"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Feedback"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                        <td><%=(((outcomeRecordset_data = outcomeRecordset.getObject("Question_ID"))==null || outcomeRecordset.wasNull())?"":outcomeRecordsetRecordset_data)%></td>
                      </tr>
                      <%
      Repeat2__index++;
      outcomeRecordset_hasData = outcomeRecordset.next();
    %>Try declaring the "outcomeRecordset_data " on top as an object
    Hope it helps

  • Need help with a Table with one image in it.

    I am attempting to design a site in Dreamweaver CS 4, I have Master Suite.  I would like to use a header Logo already created in photoshop and made web ready in .jpg format.
    I  am looking at inserting a single cell table across the top of page set at a percentage so it appears uniform on more browsers.
    The only problem is that there is no way to make (link) the picture to the tables scalibility feature. The table scales up or down, but
    the picture remains the set size of the image.
    Do I need to attempt to create this some other way?
    I like the essence of the above, I created it in Flash and would like to use it or something close in the design and creation of my web site.
    A Veteran, Thank You for any help or suggestions.      Ken

    Images are static.  They don't resize.
    Put image in a table cell or CSS division with a compatible Background-Color to fill in the empty regions on super wide displays.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    http://alt-web.com/
    http://twitter.com/altweb
    http://alt-web.blogspot.com

  • Need Help with Unusual Table Behavior

    I've been asked to create a table with unusual behaviors, and I'm a little stuck on how to implement it. The table has cells with dates and blanks in it. The following rules need to work:
    1. If the cell has a date in it, then:
    a. If the user single-clicks on the cell, the cell should be selected. At most, the date could be highlighted and copied, but not changed
    b. If the user double-clicks on the cell, a popup window should appear that allows entry of detailed data about the date. This overrides the default behaviors of entering edit mode on double-click.
    c. If the user presses F2, the cell should enter edit mode and allow the user to edit or remove the date. This prevents the user from accidently changing an existing date, which is supposed to be a rare occurance anyway.
    2. If the cell has no date, then:
    a. If the user single-clicks a cell, double-clicks a cell, or uses the keyboard to navigate to a cell and then begins typing, the cell should enter edit mode and allow the user to enter a date. Once a valid date has been entered, the rules for #1 apply.
    Optional:
    The user can remove a date by clearing the date, but it would be nice if they could select multiple dates for deletion.
    Any ideas would be appreciated. Right now, I'm stuck on how to make the cell editable with a single click depending on whether there is a date already in it.

    Torgil wrote:
    PatrickRThomas wrote:
    Fair enough, but in all the topics I've seen on this site, I almost never see someone respond once they've been given an answer to their question. Why call me out on it and not everyone else?It's not just you. It's becoming more and more common actually. Here's an example from only yesterday (reply 3):
    [http://forums.sun.com/thread.jspa?threadID=5340766]
    Now, you may not like this, but the fact remains that this is how this particular forum works, and if you want help from the regulars here it's in your best interest to stick to the forum rules. Arguing about it almost never helps your case. (Personally I don't care much either way, but that's just me and as you can see from my posting history I'm not here very often so my opinion doesn't matter much.)
    Finally, if you want help on JTables in particular, camickr is your man, so you might want to stay on his good side :-)In that thread you cited, it's fair to point out that the person never responded, but calling him a louse, etc. was uncalled for and unprofessional. If someone had politely said that I should reply to my other threads, I would have apologized and moved on. However, that's not what happened. I was called out in a way intended to humiliate me for 2 instances, not for my failure to reply, but for failing to reply quickly enough. That's what I found to be so ridiculous, and hence, my sarcasm. In the third instance, perhaps I should have responded with a "thank you" to the second response that I received. I'll take my lumps for that one. I also took offense to the suggestion that I only replied to my previous thread because I wanted help on this one. That was just a baseless accusation.
    And for the record, the reason that I'm responding to this topic so quickly is that my email notifications are working this time. I do check my watchlist when I have a question that needs answering, but if I get pulled off onto another task, I may not check it for a while. I can't help that.

  • Need help with creating table that automatically inserts rows depending on the amount of data

    Hi there,
    I'm trying to create a table for supervisors to enter in their subordinates information and will automatically insert rows for supervisors with multiple subordinates.  This form will not be connected to a data source, the supervisors will simply fill in the form and print out.  I want it to kind of look like this:
    Name
    Position #
    Classification
    Hours
    I really appreciate any help.  Thanks!

    Hi Niall,
    You figured it out!  I didn't have javascript turned on.  Now it is working perfectly.  I think this will help me tremendously.  Thanks so much for your help!!!!!
    Laura

  • Need help with physical table

    Hello All,
    I have a table in Oracle database which stores the results of the financial report. Let's call it table R.
    I imported the table R into physical layer of Administration Tool.
    The data is stored in the following format: multiple departments in the same column with accounts.
    Marketing - - -
    act 123- Adv $100
    act 124- Desc $50
    Marketing Total $150
    Sales
    act 125-Exp $30
    act 126-Depr $20
    Sales Total $50
    and etc...
    I need to build a hierarchy so that users can drill down to detail level of data.
    In the dashboard display results summary and allow users to drill down to category/department details.
    How do I do that? Should I create a new table/view and assign departments to all appropriate rows? Or there is a way to do this at the Physical/Logical Levels?
    Thank you,
    Sonya

    Iakov Qvaz wrote:
    Steve,
    A non-repeating(static) table automatically names its rows, Row1, Row2,... RowN.  Is there a clean way to sum them?
    I have Row1 + Row2 +.. RowN  for 21 rows.
    It works, but is very tedious (and unsightly).  Is there a cleaner way to sum them?
    To make use of FormCalc wildcards I go in and rename the rows to have the same so that they gain instance numbers.

  • Need Help With Shifting Table Cells

    Hi --
    I was asked to take a look at this page and fix the cell that have shifted down:  http://www.moore-engineers.com/contact/contact.html.  It's been quite a while since I've really worked with tables, and I'm having a hard time figuring this out.
    Can someone take a look and let me know what's going on?  I'd appreciate any help.
    Thanks,
    John

    Hi Osgood --
    Thanks for taking a look.  You're comments validated what I thought.  And you're right...that's not my work.  If you ever see me produce work like this, please have Adobe revoke my DW license!
    I spend about an hour with it yesterday and no matter what I did, either the problem went uncorrected or the entire table was blown apart.  I eventually gave up.
    I think my client suspects he's been "stitched-up" by the person who built the site which is why he contacted me.  I've recommended that the site be totally rewritten.
    Thanks again for your comments.
    John

  • Need help with nested loop (c:forEach) tags. Can I break from inner loop?

    Hi all, I have this annoying problem and I am looking for any suggestions.
    I have 2 select boxes. One is for all available users, and second - for selected users (designated as admins). The list of all users is available in a collection (2 properties userId and userName displayed in the code below). The list of admins contains only userId (as strings).
    I have no problem with populating selected users (admins) list, reusing pretty much the same logic below, but I cannot find a way to break out from the nested loop once the match is found, to avoid repetitions leading to incorrect display of results.
    <select name=available>
    <c:forEach items="${users}" var="user" varStatus="outer">
        <c:forEach items="${adminIds}" var="adminId" varStatus="inner">
            <c:if test="${user.userId!=adminId">
                 <option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
            </c:if>
        </c:forEach>
    </c:forEach>
    </select>
    <select name=selected>
    <c:forEach items="${users}" var="user" varStatus="outer">
        <c:forEach items="${adminIds}" var="adminId" varStatus="inner">
            <c:if test="${user.userId==adminId">
                 <option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
            </c:if>
        </c:forEach>
    </c:forEach>
    </select>Can anyone help, please? I am also restricted to JSP 1.2

    Double post: http://forum.java.sun.com/thread.jspa?threadID=707950&tstart=0

  • Proc help with nested table

    Hi all,
    My proc gives an error 'PLS-00801: internal error [20605]' at line 5 of the proc ...
    Create or replace procedure P_cleanse as
    type ty_num is table of number;
    PID ty_num;
    BEGIN
         PID():=('907084','807081','807082','807083','907082','907083','907081');
         for t in PID.first .. PID.last
         loop
         delete from stg_participant where rowid in
         (select min(rowid) from stg_participant group by participant_id having participant_id=pid(t));
         DBMS_OUTPUT.PUT_LINE('Total delete = '||sql%rowcount);
         commit;
         update stg_participant
         set status='FROM_SUGAR'
         where participant_id=pid(t);
         DBMS_OUTPUT.PUT_LINE('Total update = '||sql%rowcount);
         commit;
         END LOOP;
    END;
    any clue ?
    Thanks in advance !
    null

    figured it out ...
    Create or replace procedure P_cleanse as
    type ty_num is table of number;
    PID ty_num;
    BEGIN
         PID:= ty_num('907084','807081','807082','807083','907082','907083','907081');
         for t in PID.first .. PID.last
         loop
         delete from stg_participant where rowid in
         (select min(rowid) from stg_participant group by participant_id having participant_id=pid(t));
         DBMS_OUTPUT.PUT_LINE('Total delete = '||sql%rowcount);
         commit;
         update stg_participant
         set status='FROM_SUGAR'
         where participant_id=pid(t);
         DBMS_OUTPUT.PUT_LINE('Total update = '||sql%rowcount);
         commit;
         END LOOP;
    END;
    thz !

  • Please I need some help with a table

    Hi All
    I need some help with a table.
    My table needs to hold prices that the user can update.
    Also has a total of the column.
    my question is if the user adds in a new price how can i pick up the value they have just entered and then add it to the total which will be the last row in the table?
    I have a loop that gets all the values of the column, so I can get the total but it is when the user adds in a new value that I need some help with.
    I have tried using but as I need to set the toal with something like total
        totalTable.setValueAt(total, totalTable.getRowCount()-1,1); I end up with an infinite loop.
    Can any one please advise on some way I can get this to work ?
    Thanks for reading
    Craig

    Hi there camickr
    thanks for the help the other day
    this is my full code....
    package printing;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.text.DecimalFormat;
    public class tablePanel
        extends JDialog  implements Printable {
      BorderLayout borderLayout1 = new BorderLayout();
      private boolean printing = false;
      private Dialog1 dialog;
      JPanel jPanel = new JPanel();
      JTable table;
      JScrollPane scrollPane1 = new JScrollPane();
      DefaultTableModel model;
      private String[] columnNames = {
      private Object[][] data;
      private String selectTotal;
      private double total;
      public tablePanel(Dialog1 dp) {
        dp = dialog;
        try {
          jbInit();
        catch (Exception exception) {
          exception.printStackTrace();
      public tablePanel() {
        try {
          jbInit();
        catch (Exception exception) {
          exception.printStackTrace();
      private void jbInit() throws Exception {
        jPanel.setLayout(borderLayout1);
        scrollPane1.setBounds(new Rectangle(260, 168, 0, 0));
        this.add(jPanel);
        jPanel.add(scrollPane1, java.awt.BorderLayout.CENTER);
        scrollPane1.getViewport().add(table);
        jPanel.setOpaque(true);
        newTable();
        addToModel();
        addRows();
        setTotal();
    public static void main(String[] args) {
      tablePanel tablePanel = new  tablePanel();
      tablePanel.pack();
      tablePanel.setVisible(true);
    public void setTotal() {
      total = 0;
      int i = table.getRowCount();
      for (i = 0; i < table.getRowCount(); i++) {
        String name = (String) table.getValueAt(i, 1);
        if (!"".equals(name)) {
          if (i != table.getRowCount() - 1) {
            double dt = Double.parseDouble(name);
            total = total + dt;
      String str = Double.toString(total);
      table.setValueAt(str, table.getRowCount() - 1, 1);
      super.repaint();
      public void newTable() {
        model = new DefaultTableModel(data, columnNames) {
        table = new JTable() {
          public Component prepareRenderer(TableCellRenderer renderer,
                                           int row, int col) {
            Component c = super.prepareRenderer(renderer, row, col);
            if (printing) {
              c.setBackground(getBackground());
            else {
              if (row % 2 == 1 && !isCellSelected(row, col)) {
                c.setBackground(getBackground());
              else {
                c.setBackground(new Color(227, 239, 250));
              if (isCellSelected(row, col)) {
                c.setBackground(new Color(190, 220, 250));
            return c;
        table.addMouseListener(new MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
            if (e.getClickCount() == 1) {
              if (table.getSelectedColumn() == 1) {
       table.setTableHeader(null);
        table.setModel(model);
        scrollPane1.getViewport().add(table);
        table.getColumnModel().getColumn(1).setCellRenderer(new TableRenderDollar());
      public void addToModel() {
        Object[] data = {
            "Price", "5800"};
        model.addRow(data);
      public void addRows() {
        int rows = 20;
        for (int i = 0; i < rows; i++) {
          Object[] data = {
          model.addRow(data);
      public void printOut() {
        PrinterJob pj = PrinterJob.getPrinterJob();
        pj.setPrintable(tablePanel.this);
        pj.printDialog();
        try {
          pj.print();
        catch (Exception PrintException) {}
      public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
        Graphics2D g2 = (Graphics2D) g;
        g2.setColor(Color.black);
        int fontHeight = g2.getFontMetrics().getHeight();
        int fontDesent = g2.getFontMetrics().getDescent();
        //leave room for page number
        double pageHeight = pageFormat.getImageableHeight() - fontHeight;
        double pageWidth =  pageFormat.getImageableWidth();
        double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
        double scale = 1;
        if (tableWidth >= pageWidth) {
          scale = pageWidth / tableWidth;
        double headerHeightOnPage = 16.0;
        //double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
        //System.out.println("this is the hedder heigth   " + headerHeightOnPage);
        double tableWidthOnPage = tableWidth * scale;
        double oneRowHeight = (table.getRowHeight() +  table.getRowMargin()) * scale;
        int numRowsOnAPage = (int) ( (pageHeight - headerHeightOnPage) / oneRowHeight);
        double pageHeightForTable = oneRowHeight *numRowsOnAPage;
        int totalNumPages = (int) Math.ceil( ( (double) table.getRowCount()) / numRowsOnAPage);
        if (pageIndex >= totalNumPages) {
          return NO_SUCH_PAGE;
        g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
    //bottom center
        g2.drawString("Page: " + (pageIndex + 1 + " of " + totalNumPages),  (int) pageWidth / 2 - 35, (int) (pageHeight + fontHeight - fontDesent));
        g2.translate(0f, headerHeightOnPage);
        g2.translate(0f, -pageIndex * pageHeightForTable);
        //If this piece of the table is smaller
        //than the size available,
        //clip to the appropriate bounds.
        if (pageIndex + 1 == totalNumPages) {
          int lastRowPrinted =
              numRowsOnAPage * pageIndex;
          int numRowsLeft =
              table.getRowCount()
              - lastRowPrinted;
          g2.setClip(0,
                     (int) (pageHeightForTable * pageIndex),
                     (int) Math.ceil(tableWidthOnPage),
                     (int) Math.ceil(oneRowHeight *
                                     numRowsLeft));
        //else clip to the entire area available.
        else {
          g2.setClip(0,
                     (int) (pageHeightForTable * pageIndex),
                     (int) Math.ceil(tableWidthOnPage),
                     (int) Math.ceil(pageHeightForTable));
        g2.scale(scale, scale);
        printing = true;
        try {
        table.paint(g2);
        finally {
          printing = false;
        //tableView.paint(g2);
        g2.scale(1 / scale, 1 / scale);
        g2.translate(0f, pageIndex * pageHeightForTable);
        g2.translate(0f, -headerHeightOnPage);
        g2.setClip(0, 0,
                   (int) Math.ceil(tableWidthOnPage),
                   (int) Math.ceil(headerHeightOnPage));
        g2.scale(scale, scale);
        //table.getTableHeader().paint(g2);
        //paint header at top
        return Printable.PAGE_EXISTS;
    class TableRenderDollar extends DefaultTableCellRenderer{
        public Component getTableCellRendererComponent(
          JTable table,
          Object value,
          boolean isSelected,
          boolean isFocused,
          int row, int column) {
            setHorizontalAlignment(SwingConstants.RIGHT);
          Component component = super.getTableCellRendererComponent(
            table,
            value,
            isSelected,
            isFocused,
            row,
            column);
            if( value == null || value .equals("")){
              ( (JLabel) component).setText("");
            }else{
              double number = 0.0;
              number = new Double(value.toString()).doubleValue();
              DecimalFormat df = new DecimalFormat(",##0.00");
              ( (JLabel) component).setText(df.format(number));
          return component;
    }

  • Need help with saving data and keeping table history for one BP

    Hi all
    I need help with this one ,
    Scenario:
    When adding a new vendor on the system the vendor is suppose to have a tax clearance certificate and it has an expiry date, so after the certificate has expired a new one is submitted by the vendor.
    So i need to know how to have SBO fullfil this requirement ?
    Hope it's clear .
    Thanks
    Bongani

    Hi
    I don't have a problem with the query that I know I've got to write , the problem is saving the tax clearance certificate and along side it , its the expiry date.
    I'm using South African localization.
    Thanks

  • Partition exchange error on table with nested table

    On Oracle 11.2.0.1, I have a partitioned table with some partitions that need to be 'archived' (in terms of moving partitions to an 'archive' table).
    I have a source table like:
    CREATE TABLE IS_PODACI245
      ID_OBJEKTA_IDENTIFIKACIJA  NUMBER(10),
      ID_OBJEKTA                 NUMBER(20),
      DATUM                      TIMESTAMP(6)       NOT NULL,
      TZ                         NUMBER(3),
      DATA1                      NUMBER(10),
      DATA2                      NUMBER(6),
      DATA3                      NUMBER(10),
      DATA4                      NUMBER,
      DATA5                      T_NTCIP_CLIMATE_TABLE
    NESTED TABLE DATA5 STORE AS IS_PODACI245_STORE_TABLE
    TABLESPACE DATA
    PARTITION BY RANGE (DATUM)
      PARTITION P_201107 VALUES LESS THAN (TIMESTAMP' 2011-08-01 00:00:00')
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA, 
      PARTITION P_MAXVALUE VALUES LESS THAN (MAXVALUE)
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA
    NOCOMPRESS
    NOCACHE
    NOPARALLEL
    MONITORING;
    CREATE INDEX IDX_IS_PODACI245_KOMPLEKS ON IS_PODACI245
    (ID_OBJEKTA_IDENTIFIKACIJA, ID_OBJEKTA, DATUM)
      TABLESPACE DATA
    LOCAL ( 
      PARTITION P_201107
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA, 
      PARTITION P_MAXVALUE
        LOGGING
        NOCOMPRESS
        TABLESPACE DATA
    NOPARALLEL;
    CREATE OR REPLACE TYPE t_ntcip_climate_table as table of t_ntcip_climate_fmt;
    CREATE OR REPLACE TYPE t_ntcip_climate_FMT as object
    (  dev_index number(6)
    ,   dev_description varchar2(512)
    ,   dev_type number(10)
    ,   dev_status number(10)
    ,   dev_mfr_status varchar2(512)
    ,   dev_active number(3)
    ,   dev_test_activation number(10)
    /I would like to make exchange partition using stage table, and everything is going fine on all tables, but only on a few of them (listed source is one of them, and they're only tables with nested tables wihin), where I get an error.. but sometimes ;)
    on a statement like:
    ALTER TABLE IS_PODACI245_ARH EXCHANGE PARTITION P_201106  WITH TABLE IS_PODACI245_STAGE EXCLUDING INDEXES  WITHOUT VALIDATION;I got an error:
    ORA-00001: unique constraint (TXV.SYS_C0032911) violated
    it's an unique index between parent and nested table.
    what could cause that problem?

    Dear,
    I suppose that the unique constraint
    ORA-00001: unique constraint (TXV.SYS_C0032911) violatedis the one you 've created on the nested table IS_PODACI245_STORE_TABLE
    If so, why not disable that constraint and try again.
    I have never exchanged such a kind of partitioned table having a nested table in it. But, I could imagine that the cloned non partitioned table IS_PODACI245_STAGE should at least be the exact image of the partitioned table IS_PODACI245_ARH (of course without the partition part) but with the nested table part and including all indexes
    In addition, if you have a parent/child relationship between your partitioned tables, then there is a chronological order of exchange starting by the child and then finishing by the parent
    see the following link for more information about this order of exchange (and comment 2 for an example also)
    http://jonathanlewis.wordpress.com/2006/12/10/drop-parent-partition/#more-65
    Hope this helps
    Mohamed Houri

Maybe you are looking for

  • How to find out how much space is left

    Hi, I know Oracle XE has a 4GB user data limit, and a 5GB overall limit. Using APEX you can find out how much space is left via the administration section. I'm going to upgrade to APEX 3.0 for testing. However APEX 3.0 will not show me how much space

  • How to set group contacts in nokia asha 305

    how to  set group contacts  in nokia asha 305....thank u......

  • InDesign CS6 (Mac) will not package fonts

    I have hundreds of fonts on my machine and have never had any issues with packaging fonts until CS6. CS5.5 works great, even today with the same files that will not package in CS5.5. However, I cannot use 5.5 due to the other 7 designers all using CS

  • Upgrade to EHP1 java (Portal) alone from NW 7.0 SP12

    Hi We are in the process of upgrading our portal NW 7.0 SP12 to EHP1 SP06. Java FAQs says that we can use just JSPM to deploy as its just a java standalone. Has anyone used JSPM to upgrade to EHP1 from NW7.0? instead of EHPi? Thanks

  • Document Properties versus Form Properties

    Hello, I was searching this forum and the knowledgebase to find an answer on how to populate the Document Properties visible in Acrobat/Reader 7 with the values from the Form Properties of a XFA form created with Designer 7.1. Unfortunately I was not