Update a row in af:table in different pagesandselection isby using checkbox

Hi all,
I am very new to adf. I have requirement where af:table should have a check box and on selection of checkbox and clicking on update button it should redirect to a new page which contains the af:form of the selected row and the user should be able to update the values. with out check box i was able to do by setting the setcurrentrowwithkeyvalue to the button.
how can i set setcurrentrowwithkeyvalue.
i am using two .jsff pages and a taskflow for those two pages.
i am using jdev11.1.1.5.0
Thanks In advance
Edited by: 926968 on Apr 16, 2012 6:10 AM

af:BooleanCheckbox has a valueChangeListener which can be called in a managedBean bound to your taskflow.Inside this method write code to set the current row of the table and then navigate to the new page.
Basically use something like this ->
In the jspx
<af:selectBooleanCheckbox label="Label:"
                          textAndAccessKey="checkbox"
                          accessKey="2"
                          *valueChangeListener="#{pageFlowScope.myBean.onClickOfCheckbox}"*
                          id="sb1"/>
In the bean
public void onClickOfCheckBox(ValueChangeEvent vc) {
    //code to set the currentRowof the iterator - you can refer this http://neeraj-soa-tips.blogspot.com/2010/01/setting-current-row-of-view-object-with.html
}Edited by: Sudipto Desmukh on Apr 16, 2012 3:39 PM

Similar Messages

  • How to Update Particular row in a table from OAF page

    Hi Can anyone please help me on the following requirement:
    In my oaf page i am displaying table values(supplier site details from base tables) with update and delete icons . When i click on update button a new page opens in which we used to update the values and click on apply button which again comes back to the original page.
    So when i click on apply button on update page i have to first search for the site in the site table whether it exists or not, if not exists i have to create a new row and save the data, if site exists in the table i have to update the row of a table for that particular site. I have written code for this but unable to achive the requirement, it is not updating the existing row of the table. And i am doing all this on the Temp tables.
    So now when i save, previous transaction is also updating along with the current transaction. That means when i m trying to save 2nd transaction values , 1st transactions values are getting updated with the 2nd transaction values(2 rows are getting updated)
    Can anyone help me with the code used for updating the current row of the table. Please correct me if i m doing anyting wrong in code.
    following is the current code i m using and which is failing :
    Controller Code
    if(pcontactaction.equals("createECdetailsEvent")) {
    String currentSiteName=pageContext.getParameter("SiteName");
    System.out.println("Selected Site Name is : " + currentSiteName);
    Serializable x[]={reqNum,suppId,currentSiteName,pnotifMethod,pfaxNum};
    System.out.println("Invoking AM Method.........");
    am.invokeMethod("initCreateECDetails",x);
    System.out.println("initCreateECDetails Method Executed. ");
    //am.invokeMethod("save");
    localOAApplicationModule.getTransaction().commit();
    pageContext.setForwardURL(
    "OA.jsp?page=/oracle/apps/floaf/flpos/supregister/webui/ECDetailsPG"
    , null //not needed as we are retaining menu context
    ,OAWebBeanConstants.KEEP_MENU_CONTEXT
    , null //not needed as we are retaining menu context
    ,null // no parameters are needed
    ,true //retain AM
    ,OAWebBeanConstants.ADD_BREAD_CRUMB_NO
    ,OAWebBeanConstants.IGNORE_MESSAGES);
    AM Code
    public void initUpdateECDetails(String request_number,String supplier_id,String site_name,String site_id,String notification_method,String fax_number)
    OADBTransaction localOADBTransaction = getOADBTransaction();
    String siteToUpdate;
    siteToUpdate=site_name;
    String siteidToUpdate;
    siteidToUpdate=site_id;
    System.out.println("Site Name to Update or Create is : " + siteToUpdate);
    System.out.println("Site Id to Update or Create is : " + siteidToUpdate);
    System.out.println("Inside Update EC Details MEthod.");
    OAViewObject suppSiteDetVO = getFLPOSSuppSiteDetailsVO1();
    FLPOSSuppSiteDetailsVORowImpl sro=null;
    String existingWhereClause = suppSiteDetVO.getWhereClause();
    suppSiteDetVO.setWhereClause(null);
    suppSiteDetVO.setWhereClauseParams(null);
    suppSiteDetVO.setWhereClause("SUPPLIER_ID = :1 AND REQUEST_NUMBER = :2 AND SITE_ID = :3 ");
    suppSiteDetVO.setWhereClauseParam(0, supplier_id);
    suppSiteDetVO.setWhereClauseParam(1, request_number);
    suppSiteDetVO.setWhereClauseParam(2, site_id);
    suppSiteDetVO.executeQuery();
    suppSiteDetVO.setWhereClauseParams(null);
    suppSiteDetVO.setWhereClause(existingWhereClause);
    int rowcount = suppSiteDetVO.getRowCount();
    System.out.println("Fetched Rows : " + rowcount);
    if (rowcount == 0) {
    Row row = suppSiteDetVO.createRow();
    System.out.println("Row is : " +row);
    suppSiteDetVO.insertRow(row);
    String siteId = getOADBTransaction().getSequenceValue("FLPOS_SITE_ID_SEQ").toString();
    System.out.println("New Site ID : " + siteId);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    row.setAttribute("RequestNumber", request_number);
    row.setAttribute("SupplierId", supplier_id);
    row.setAttribute("SiteName", site_name);
    row.setAttribute("SiteId", siteId);
    row.setAttribute("FaxNo",fax_number);
    row.setAttribute("NotificationMethod",notification_method);
    System.out.println("New Row Created for Supplier Site.");
    System.out.println("Data Saved to table.");
    else{
    System.out.println("Inside Else Block ");
    try {
    System.out.println("Inside Try Block ");
    Row[] row = suppSiteDetVO.getAllRowsInRange();
    for (int i = 0; i < rowcount; i++) {
    sro = (FLPOSSuppSiteDetailsVORowImpl)row;
    String psiteName=sro.getSiteName();
    Number psiteid=sro.getSiteId();
    System.out.println(" p Site Name is : " +psiteName);
    System.out.println(" p site id is " +psiteid);
    if(psiteid.equals(siteidToUpdate) ) {
    sro.setAttribute("FaxNo",fax_number);
    sro.setAttribute("NotificationMethod",notification_method);
    //getOADBTransaction().commit();
    break;
    catch (Exception e) {
    System.out.println("Exception in update : " + e);
    }

    Please answer following:
    1. Are you using EO based VOs or ReadOnly VO?
    2. What is your VO Query for the search and update?
    3. Why have you based your logic on site_name; you should have used site_id?
    4.Are you getting correct site name in handling createECdetailsEvent event in CO?
    5. In case of update are you getting correct values on the Update Site Details?
    6. On coming back from Update page to Supplier Site Search page, do you see old values of the site or the new values in the results table?
    Please share the screenshot if possible.
    -Prince
    [email protected]
    http://princekapoor82.blogspot.com

  • Need help in SQL Query: Update a row in a table & insert the same row into another table

    I want to update a row in a table say Table A and the updated row should be inserted into another table say Table B. I need to do it in a single SQL query and i don't want to do it in PL/SQL with triggers. And i tried with MERGE statement but its working with this scenario. (Note: I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0).
    Thanks in Advance.

    Using Sven's code as an example, you could save the updated row in a sql plus variable. (also untested):
    SQL> var v_id number
    update tableA  
    set colB='ABC' 
    where colC='XYZ' 
    returning id into :v_id;
    insert into table A_History (ID, colA, colB, ColC)  
    select id, ColA, ColB, ColC  
    from tableA  
    where id = :v_id;   

  • Update all rows in a table which has 8-10 million rows take for ever

    Hi All,
    Greetings!
    I have to update 8million rows on a table. Basically have to reset the batch_id with the current batch number. it contains 8-10 million rows and i have tried with bulk update and then also it takes long time. below is the table structure
    sales_stg (it has composite key of product,upc and market)
    =======
    product_id
    upc
    market_id
    batch_id
    process_status
    I have to update batch_id,process_status to current batch_id (a number) and process_status as zero. I have to update all the rows with these values for batch_id = 0.
    I tried bulk update an it takes more than 2hrs to do. (I limit the update to 1000).
    Any help in this regard.
    Naveen.

    The fastest way will probably be to not use a select loop but a direct update like in William's example. The main downside is if you do too many rows you risk filling up your rollback/undo; to keep things as simple as possible I wouldn't do batching except for this. Also, we did some insert timings a few years ago on 9iR1 and found that the performance curve on frequent commits started to level off after 4K rows (fewer commits were still better) so you could see how performance improves by performing fewer commits if that's an issue.
    The other thing you could consider if you have the license is using the parallel query option.

  • Updating a row of a table using rowid

    Hi folks,
    I am trying to update some rows in a table using rowid of the corresponding rows.Sometimes this updates wrong rows. This is because ORACLE by itself makes some statistics on the particular table using "Analyze table..." statement and it changes the order of the rowids. But if I delete the statistics,the updation works fine. Is there any way to update the correct rows and also to keep the statistics created by ORACLE? P.s: I am using ORACLE thin Driver to connect to Oracle 8.1.6
    Thanks,
    Karthi.

    First make it clear: analyze table command never changes ROWIDs. Actually, the ROWID of a row never changes untill it's deleted from its table. So make sure if you are using the correct ROWID.
    Thnx

  • Best way to update individual rows of a Table?

    I've taken a look at some examples, though haven't gotten any clarification on this.  I am looking to have something close to a listbox or table to where I can update just a single column of row values at a 1 time per second pace.  I am looking to display our data-acquisition values in a table or listbox.  The single listbox seemed to work good for this, but I was unable to use row headers to list the channel names next to the channel values.  I was thinking about connecting the cursor values of two list-boxes to do this, but didn't find any info on this for the single list-box.
    I have a few questions:
    1) I have a 1D array to where I want to use that array of data to constantly update the first column (with a multitude of rows) of a table.  I am looking for the best route so as not to take up too much processing time in doing this.
    What is the best way to update individual rows of a table?   Invoke Node "Set Cell Value" ... or is there another method?
    2) Why is it that after every other iteration the row values are erased? 
    Also, for adding additional strings to the original arrray ... is it best to use the "Array Subset" and then the "Build Array" function, or the "Array Subset" and "Insert Into Array" function?
    See the attached example.
    Thanks.
    Solved!
    Go to Solution.
    Attachments:
    Table Example.vi ‏19 KB

    Jeff·Þ·Bohrer wrote:
    2) Why is it that after every other iteration the row values are erased?
    Classic race condition.  dump the for loop and p-node and just wire the 2D array to the table terminal.!
    I'm not seeing the race condition.  What I am seeing is the table emptying after the last element was written to it on every other run.  I saw watched this with highlight execution on.
    But I'm in full agreement with just writing to the terminal.  It is a 1D array, so you will need to use a build array and transpose 2D array in order for it to write properly.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • URGENT:Update multiple rows of a table as a transaction

    Hi,
    I am trying to update mutliple rows in one table as a transaction, but only update on the last row is commited to database. Updates on the previous rows is not committed.
    I must be missing some thing which is obvious. Has any got a clueeeeeeeeeee?
    code:
    for (int i = 0; i < selectedFaultNumbers.length; i++) {
    String nationalFaultNumber = selectedFaultNumbers;
    String fault = nationalFaultNumber.substring(0,13);
    national_faultsRowSet2.setCommand("SELECT national_faults.national_fault_number, national_faults.status_id, national_faults.master_fault_number FROM national_faults WHERE national_faults.national_fault_number= '"+fault+"'");
    national_faultsRowSet2.execute();
    if (national_faultsRowSet2.next()) {
    national_faultsRowSet2.updateInt("status_id", FAULT_STATUS_ASSOCIATED);
    national_faultsRowSet2.updateString("master_fault_number",nationalfltno);
    national_faultsRowSet2.updateRow();
    national_faultsRowSet2.execute();
    Any help wil be GREATLY appreciated.
    Cheers
    kush

    Hi Giri,
    Thanks for getting back to me.
    If I understood correct, sample example updates a rowset which is bound to datatable and changes are committed to database using datatablemodel.
    In my case rowset is not bound to a datatable and user is not updating the rowset.
    PageBean has to update few rows in a table when a new row is inserted in to that table.
    Please correct me if I got it wrong. Is there any other solution ???
    Thanks very much
    kush

  • Updating multiple rows in a table in ADF

    Hi
    How do we update multiple rows in a table.
    Onclicking a update button the changed rows must be updated.

    Hi Prince,
    currently I am selecting one row from the table and rendering a region at the top of the table and capturing the user entered data with the following code:
    ViewObjectVOImpl vo = getViewObjectVO1();
    Row CurrentRow = vo.getCurrentRow();
    //After this I perform the checks like user entered value is not null or check input as per business logic.
    if(CurrentRow.getAttribute("attributeName") ==null){
    //Add what message you want to display
    //Add other business logic.
    After making all the checks, i commit it.
    getOADBTransaction().commit();
    Now in my new page I am capturing the user input in the table itself like an excel sheet. Suppose there are ten rows in my advanced table on my page, and each row has one editable field. I have one save button at the bottom of the table.
    Now on clicking the save button I have to capture the user input, check whether there is any null value and if all the entered data is correct then only I should commit it.
    Can you please let me know how we can accomplish that.
    Regards
    Hawker

  • How to compare two rows from two table with different data

    how to compare two rows from two table with different data
    e.g.
    Table 1
    ID   DESC
    1     aaa
    2     bbb
    3     ccc
    Table 2
    ID   DESC
    1     aaa
    2     xxx
    3     ccc
    Result
    2

    Create
    table tab1(ID
    int ,DE char(10))
    Create
    table tab2(ID
    int ,DE char(10))
    Insert
    into tab1 Values
    (1,'aaa')
    Insert
    into tab1  Values
    (2,'bbb')
    Insert
    into tab1 Values(3,'ccc')
    Insert
    into tab1 Values(4,'dfe')
    Insert
    into tab2 Values
    (1,'aaa')
    Insert
    into tab2  Values
    (2,'xx')
    Insert
    into tab2 Values(3,'ccc')
    Insert
    into tab2 Values(6,'wdr')
    SELECT 
    tab1.ID,tab2.ID
    As T2 from tab1
    FULL
    join tab2 on tab1.ID
    = tab2.ID  
    WHERE
    BINARY_CHECKSUM(tab1.ID,tab1.DE)
    <> BINARY_CHECKSUM(tab2.ID,tab2.DE)
    OR tab1.ID
    IS NULL
    OR 
    tab2.ID IS
    NULL
    ID column considered as a primary Key
    Apart from different record,Above query populate missing record in both tables.
    Result Set
    ID ID 
    2  2
    4 NULL
    NULL 6
    ganeshk

  • How do you join two tables from different Oracle schemas using a subquery

    I am trying to join two tables from different Oracle schemas using a subquery. I can extract data from each of the tables without a problem. However, when I combine the select statements using a subquery I get the Oracle error *'ORA-00936: missing expression'*. Since each SELECT statement executes on its own without error I don't understand what is missing. The result set I am trying to get is to match up the LINE_ID from PDTABLE_12_1 in schema DD_12809 with the MAT_DESCRIPTION from table PDTABLE_201 in schema RA_12809.
    The query is as follows:
    sql = "SELECT [DD_12809].[PDTABLE_12_1].LINE_ID FROM [DD_12809].[PDTABLE_12_1] JOIN " _
    + "(SELECT [RA_12809].[PDTABLE_201].MAT_DESCRIPTION " _
    + "FROM [RA_12809].[PDTABLE_201]) AS FAB " _
    + "ON [DD_12809].[PDTABLE_12_1].PIPING_MATER_CLASS = FAB.PIPING_MATER_CLASS"
    The format of the query is copied from a SQL programming manual.
    I also tried executing the query using a straight JOIN on the two tables but got the same results. Any insight would be helpful. Thanks!
    Edited by: user11338343 on Oct 19, 2009 6:55 AM

    I believe you are receiving the error because you are trying to JOIN on a column that doesn't exist. For example you are trying to join on FAB.PIPING_MATER_CLASS but that column does not exist in the subquery.
    If you want to do a straight join without a subquery you could do the following
    SELECT  DD_12809.PDTABLE_12_1.LINE_ID
    ,       FAB.MAT_DESCRIPTION
    FROM    DD_12809.PDTABLE_12_1
    JOIN    RA_12809.PDTABLE_201    AS FAB ON DD_12809.PDTABLE_12_1.PIPING_MATER_CLASS = FAB.PIPING_MATER_CLASS  HTH!

  • Connect role allows user to update/delete row of a table of another schema

    I am using oracle 9i r2, I created a user and only give him CONNECT role. Then I opened the sqlplus and found that he could query table of another schema which doesn't belong to the new user, but the thing which scares me most is that when I tried to update/delete a row from a table of another schema, it succeeded. Also, I created a new role with system priviledges CREATE_SESSION and SELECT_ANY_TABLE then granted to new user and revoked the CONNECT role but the same thing happened like before. What I am doing wrong? By the way, I am trying to create a read only user. Any help is greatly appreciated.

    Thanks guys for the tips. I have forgotten to mention that this situation happened only in a new created schema which has only a table and the table was exported from another oracle db( I pre-created the user with connect role and assign the tablespace etc), the import worked fine. Then I used a read only user(in different schema) to update/delete row to the imported table.The read only user can't update/delete other schemas besides from the new one. Is that I missed something when importing the table or pre-create user, tablespace, etc? Thanks in advance.

  • Update random rows in sql table

    Do not ask me why but I have to do it and I would greatly appreciate any help.
    Let us say that I want to update column foo_column of a table foo. The selection criteria is foo_selection_criteria. So my sql to update would be something like:
    update foo set foo_column='some value' where <foo_selection_criteria>
    Foo_selection_criteria can be any logical expression based on the value of columns in table foo. For example foo_selection_criteria could be foo.columna != '1';
    There are m rows in the table that meet the foo_selection_criteria. I want to update only randomly selected 1/n (eg., 0.5 , 083 etc) of these m rows.
    I tried using dbms_random.value procedure to update my sql above so that it reads something like
    update foo set foo_column='some value' where <foo_selection_criteria> and dbms_random.value <= 1/n;
    However it seems that dbms_random is evaluated only once in the update sql above. Is there any way I can avoid that dbms_value is calculated once and stick in the sql above ? Or is someone aware of another way to randomly update a random fraction of m rows that meed an update selection criteria ?
    I would be grateful for any help/

    Tubby wrote:
    Why not just
    ROWNUM = 1
    that's random....I disagree. Rownum = 1 will in general return the first inserted row into a table.
    There is no guarantee that it is the first inserted row, but in 99% of all cases it will be so ( i just made this statistic up, but prove me to be wrong ;)) .
    And an 99% chance is not very random for me.

  • Updating one row updates every row in the table

    I'm having a weird problem in which I insert a row into a table, select that row, and update its columns, and all the rows in the table end up with those columns all set to the new value. Like this:
    A B C
    1 4 7
    2 3 8
    9 6 7
    Statement s1 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    s1.execute("INSERT INTO table (A) VALUES (5)");
    Statement s2 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    RecordSet rs = s2.executeQuery("SELECT * FROM table WHERE A=5");
    if (rs.next()) {
      rs.updateInt("B", 4);
      rs.updateInt("C", 6);
      rs.updateRow();
    A B C
    1 4 6
    2 4 6
    9 4 6
    5 4 6I'm using Mac OS X 10.4.9, OpenBase Solo 10.0.5, and Java 1.5. I hope someone has experienced this before because it has me befuddled.
    Here is the actual code from my program:
    Statement st;
    ResultSet rs;
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs = st.executeQuery("SELECT * FROM characters WHERE UniqueID=\""+uid+"\"");
    if (rs.next()) {
         JOptionPane.showMessageDialog(this, "The Unique ID \""+uid+"\" is already taken by "+com.kreative.mccm.Character.flName(rs)+".", "", JOptionPane.ERROR_MESSAGE);
         return false;
    rs = st.executeQuery("SELECT * FROM characters WHERE CodePoint="+cp);
    if (rs.next()) {
         JOptionPane.showMessageDialog(this, "The code point "+h(cp,4)+" is already taken by "+com.kreative.mccm.Character.flName(rs)+".", "", JOptionPane.ERROR_MESSAGE);
         return false;
    st.close();
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    st.execute("INSERT INTO characters (UniqueID, CodePoint) VALUES (\""+uid+"\", "+cp+")");
    st.close();
    this.uid = uid;
    this.cp = cp;
    this.ch.setUniqueIDString(uid);
    this.ch.codePoint = cp;
    st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs = st.executeQuery("SELECT * FROM characters WHERE UniqueID=\""+ch.getUniqueIDString()+"\"");
    if (rs.next()) {
         ch.writeResultSet(rs, false, false); /* (this does the updates) */
         rs.updateRow();
         charSaveChanges.setEnabled(false);
    } else {
         throw new SQLException();
    rs.close();
    st.close();

    OpenBase powers Apple's online store, so I wouldn't think that's the problem. I'm placing all the blame on the JDBC driver.
    Funnily, I started updating ResultSets that way because executing UPDATE statements directly gave me this problem before. Doing it this way made the problem go away, until now.
    I tried replacing the INSERT with two fields with one with all the fields, and now it throws a SQL error that is most definitely bogus:
    java.sql.SQLException: SQL ERROR - [position 569, near '' in ', 0, 0, 0, ''] insert error: comma expected but not found in data.
    SQL: INSERT INTO characters (UniqueID, CodePoint, NameFirst, NameMiddle, NameLast, NameMaiden, NameCommFirst,
    NameCommMiddle, NameCommLast, NameCommFull, Title, Classification, Subclassification, Considerable, SexString,
    TransitionString, GenderString, OrientationString, TitleString, PronounString, SGO, BirthDay, BirthMonth, BirthYear,
    Generation, FirstOfSet, ParentBio, Parent1, Parent2, Parent3, ParentBioType, Parent1Type, Parent2Type, Parent3Type)
    VALUES ('bomb', 123, 'Ziggy', 'Boogy', 'Doog', '', '', '', '', '', '', -1, -1, 1, '', '', '', '', '', '', 0, 0, 0, 0, 0, '', '', '', '', '', 0, 0, 0, 0)Bogus because there are the same number of data items as field names, and position 569 is a comma.
    At this point I have to ask myself why I ever chose OpenBase in the first place. (That's right, I had a RealBasic plugin for it. shudders) I'm sure OpenBase itself is fine, but its JDBC driver is trash. MySQL here I come.
    (Message was edited to prevent looooong horizontal scrolling)

  • Information on who has updated a row in a table

    i need to check who has updated a row in my schema,
    including its username,
    time log on
    and ip address - most important
    is it possible for me to track ? in oracle ?

    You need to turn on auditing to log such information.
    Logminer is another option, however you won't have all needed information unless you have turned on SUPPLEMENTAL Logging.
    ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;

  • Create tables in different database schemas using EJB 3 Entity Persistent

    Hi All,
    I would like to find out how to get the following tasks done using EJB 3.0 Java Entity Persistent:
    ( i ) Create tables in different schemas such as STUDENT under EDUCATION schema and table PATIENT in HOSPITAL schema. We can then reference them in SQL as EDUCATION.STUDENT and HOSPITAL.PATIENT.
    ( ii ) Reference these tables uniquely once they are created.
    There are no pre-existing tables or naming conventions that needs to be adhere to in this situation.
    I have no problem creating tables on the current schema in EJB 3.0 Java Entity Persistent.
    Any suggestions would be appreciated.
    Thanks,
    Jack

    Use the schema attribute of the Table annotation:
    package javax.persistence;
    @Target({TYPE}) @Retention(RUNTIME)
    public @interface Table
       String name( ) default "";
       String catalog( ) default "";
       String schema( ) default "";
       UniqueConstraint
    uniqueConstraints( ) default {};
    }

Maybe you are looking for