How To Delete a row from view object

Hi
I have a table whose data is populated based on the view object... and for each row i have a delete icon...
when i press on this delete icon i want to delete that particular row from the view object only..but not from the data
base..please help me in this issue
Thanks

Hi,
as per krishna priya says u can delete .
-----1st one thing let me know vo is eo based .???.
If not here is the sample code to delete a row not from the data base.:
public void Deleterow(OAPageContext pageContext, OAWebBean webBean,String prjid)
int idtodelete;
int fetchedrowcount;
Number prjojectid;
RowSetIterator deleteIter;
prjidtodelete=Integer.parseInt(prjid);
OADBTransaction tr = getOADBTransaction();
ProjectsVORowImpl row=null;
ProjectsVOImpl vo= getProjectsVO1();
fetchedrowcount=vo.getRowCount();
deleteIter = vo.createRowSetIterator("deleteIter");
deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedrowcount);
for(int i=0;i<fetchedrowcount;i++)
row= (ProjectsVORowImpl)deleteIter.getRowAtRangeIndex(i);
prjojectid=(Number)row.getAttribute("ProjectId");
if (prjojectid.compareTo(prjidtodelete)==0)
row.remove();
break;
deleteIter.closeRowSetIterator();
Regards
Meher Irk
Edited by: Meher Irk on Nov 2, 2010 12:42 AM

Similar Messages

  • How to get first row from View Object cache.

    hi,
    I am using Jdeveloper 11.1.1.6
    can we get first row from View Object cache??
    Thanks in Advance.
    Best
    Shashidhar

    Hi Frank,
    Thanks for reply!!
    My case is:
    I have a Query based ViewObject.
    One of the field is LOV and remaining fields are in ADF table. the LOV field is out side ADF table when i insert first record in ADF table and i choose LOV  filed the value is selected.
    when i create second row LOV value got refreshed because both are in same VO.
    I need to get the LOV value of first row and set same value to second Row.
    Shashidhar

  • How to delete multiple rows from ADF table

    How to delete multiple rows from ADF table

    Hi,
    best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
    Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
    Frank

  • How To Delete a Row From a TableView !!!!

    Hi,
    Does any know how to delete a row from a table view model.
    I have a TableViewModel being displayed, when the user select the particular row and click delete i want that particular row to be deleted.
    Any Suggestions How.
    Thanks,
    Emmanuel.

    If u want to delete single row, then set the property of TableView - selectionMode="SINGLESELECT". Select the radio button and click on delete button. In the main program, you can get the row value like...
    public void onDeleteButtonClicked(Event event) throws PageException {
    TableView table = (TableView) this.getComponentByName ("idTableView");
    DefaultTableViewModel dmodel = myBean.beanModel;
    String pid = "", row_selected;
    // Get the first visible row
    int firstVisibleRow = table.getVisibleFirstRow();
    // Get the last visible row
    int lastVisibleRow = table.getVisibleLastRow();
    for (int i = firstVisibleRow; i <= lastVisibleRow; i++) {
    if (table.isRowSelected(i)) {
      row_selected = i;
      pid = dmodel.getValueAt(i, 1).toString();
    "i" will give you the row no, pid has the value of the row at first column.
    Hope this helps.
    Thanks,
    Praveen

  • HOW TO DELETE THE ROW FROM DATABASE

    hI,
    Iam pasting my code below.My problem isi retrieve rows from database and display them in jsp page in rows.For each row there is delete hyperlink.Now when i click that link i should only delete the row corresponding to that delete link temporarily but it should not delete the row from database now.It should only delete the row from database when i click the save button.How can i do this can any one give some code.
    thanks
    naveen
    [email protected]
    <%@ page language="java" import="Utils.*,java.sql.*,SQLCon.ConnectionPool,java.util.Vector,java.util.StringTokenizer" %>
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>Item Details</title>
    <script>
    function submitPage()
    document.details.action = "itemdetails.jsp" ;
    document.details.submit();
    </script>
    </head>
    <body>
    <form name="details" action="itemdetails.jsp" method="post">
    <%
    ConnectionPool pool;
    Connection con = null;
    Statement st;
    ResultSet rs =null;
    %>
    <table border="0" cellpadding="0" cellspacing="0" width="328">
    <tr>
    <td width="323" colspan="4"><b>Reference No :</b> <input type="text" name="txt_refno" size="14">
    <input type="submit" value="search" name="search" ></td>
    </tr>
    <tr>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item Code</b></font></td>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item No</b></font></td>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Amount </b></font></td>
    <td width="80" bgcolor="#000099"> </td>
    </tr>
    <%
    pool= new ConnectionPool();
    Utils utils = new Utils();
    double total =0.00;
    String search =utils.returnString(request.getParameter("search"));
    if(search.equals("search"))
    try
    String ref_no =utils.returnString(request.getParameter("txt_refno"));
    String strSQL="select * from ref_table where refno='" + ref_no + "' ";
    con = pool.getConnection();
    st=con.createStatement();
    rs = st.executeQuery(strSQL);
    while(rs.next())
    String itemcode=rs.getString(2);
    int item_no=rs.getInt(3);
    double amount= rs.getDouble(4);
    total= total + amount;
    %>
    <tr>
    <td width="81"><input type=hidden name=hitem value=<%=itemcode%>><%=itemcode%></td>
    <td width="81"><input type=hidden name=hitemno value=<%=item_no%>><%=item_no%></td>
    <td width="81"><input type=hidden name=hamount value=<%=amount%>><%=amount%></td>
    <td width="80"><a href="delete</td>
    </tr>
    <%
    }catch(Exception e){}
    finally {
    if (con != null) pool.returnConnection(con);
    %>
    <tr>
    <td width="323" colspan="4">
    <p align="right"><b>Total:</b><input type="text" name="txt_total" size="10" value="<%=total%>"></td>
    </tr>
    <tr>
    <td width="323" colspan="4">                   
    <input type="button" value="save" name="save"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    You mean when you click on the hyperlink you want that row to disappear from the page, but not delete the row from the database until a commit/submit button is pressed?
    Personally, I think I'd prefer that you have a delete checkbox next to every row and NOT remove them from the display if I was a user. You give your users a chance to change their mind about their choice, and when they're done they can see exactly which rows will be deleted before they commit.
    You know your problem, of course, so you might have a good reason for designing it this way. But I'd prefer not removing them from the display. JMO - MOD

  • How to delete certain rows from Table view

    Hi Experts,
    I need to display result on the basis of certain process type. So i have used code like below.
           lv_iterator =   me->typed_context->searchresult->collection_wrapper->get_iterator( ).
           lv_entity = lv_iterator->get_first( ).
           WHILE lv_entity IS BOUND.
             CLEAR:lv_object.
             lv_object = lv_entity->get_property_as_string( iv_attr_name = 'PROCESS_TYPE' ).
             IF lv_object <> 'XXX'.
               lr_entity ?= lv_entity.
              me->typed_context->searchresult->collection_wrapper->remove( lv_entity ).
              lr_entity->delete( ).
             ENDIF.
             lv_entity = lv_iterator->get_next( ).
           ENDWHILE.
    But only some of the entities from the collection are getting removed. Still some wrong entities exists which i cant even able to delete it by using ,
              me->typed_context->searchresult->collection_wrapper->remove( lv_entity ).
              lr_entity->delete( ).
    Am i missing anything here?
    Regards,
    Santhosh

    Hi Santhosh,
    Maybe that is happening because you're removing elements from an object (collection_wrapper) inside your loop.
    Can you try to create an collection wrapper copy by using GET_COPY method, and then use and loop the iterator on your copied object, and remove the unwanted entities on your main object?
    Kind regards,
    Garcia

  • How to Delete certain rows from table view collection

    Hi Experts,
    I need to display result on the basis of certain process type. So i have used code like below.
           lv_iterator =   me->typed_context->searchresult->collection_wrapper->get_iterator( ).
           lv_entity = lv_iterator->get_first( ).
           WHILE lv_entity IS BOUND.
             CLEAR:lv_object.
             lv_object = lv_entity->get_property_as_string( iv_attr_name = 'PROCESS_TYPE' ).
             IF lv_object <> 'XXX'.
               lr_entity ?= lv_entity.
              me->typed_context->searchresult->collection_wrapper->remove( lv_entity ).
              lr_entity->delete( ).
             ENDIF.
             lv_entity = lv_iterator->get_next( ).
           ENDWHILE.
    But only some of the entities from the collection are getting removed. Still some wrong entities exists which i cant even able to delete it by using ,
              me->typed_context->searchresult->collection_wrapper->remove( lv_entity ).
              lr_entity->delete( ).
    Am i missing anything here?
    Regards,
    Santhosh

    Hi Santhosh,
    Maybe that is happening because you're removing elements from an object (collection_wrapper) inside your loop.
    Can you try to create an collection wrapper copy by using GET_COPY method, and then use and loop the iterator on your copied object, and remove the unwanted entities on your main object?
    Kind regards,
    Garcia

  • Deleting a row from View Dynamically

    Hi Experts,
    I am working with dynamic programming... there is Add button Once I press Add it will create  the 3 input fileds and one button (its for Delete ) in one row.
    If press the Button( Delete )  it should delete the respective row ( 3 input fileds and the button ( delete) ).
    Please help me with the solution.
    Thanks,
    Anil

    Thanks Trond for your reply.
    I used below code and when I am click on the delete button its deleting the top row on the view.
    Its not deleting the respective row...
    Ex if i have 4 rows on view and I am pressing on second row delete button but still its deleting the top row.
    I changed index of Remove_child and tried..
    I used index = 0 , index = 1 and i am not passed any index still its not deleting the respective row.
    CALL METHOD lr_container->remove_child
            EXPORTING
              index = 1
              id    = gv_char.
    Please let me know how can i do this.

  • How to populate transient attribute from view object dynamically

    I have three 4 tables named as "employee,event,event_progress,and checklist progress". i have created a view object using the first three tables . i ahave also created 5 transient variables in to the same view object.when i dragged the view object in to my page as a table i want to populate those transient attribute.
    i have 5 transient attribute which are present as a column value named as chechlist_name in another table "checklist".those all transient attribute also having two sub rows whose data should be populated from the checklist progress table.

    Hi
    Please post your question on this forum, your question belong to this forum.
    JDeveloper and ADF
    Muhammad Nasir

  • How to delete a row from AbstractTableModel

    my table is using an object to populate the data.
    static Object[][] data = new Object[LineCount()][5];
    So when I delete a row, I should delete from the model or the object?
    Rgds

    When you populate your table with a two dimensional array, the table actually creates a DefaultTableModel (which extends AbstractTableModel). The DefaultTableModel has methods which allow you to add/remove row from the data model. Read the DefaultTableModel API for more information.

  • How to delete single row from multiple

    Hi:l
    This is my query which provides duplicate rows in my table:
    select count(*),CUSTMAST_REQUEST_SRNO,ACTIVITYMAST_SRNO,STATUSMAST_SRNO from REQUEST_TRANS having count(*)>1 group by CUSTMAST_REQUEST_SRNO,ACTIVITYMAST_SRNO,STATUSMAST_SRNO;
    O/p:
    2 |M984 | 74 |M6
    2 |M985 | 74 |M6
    2 |M987 | 74 |M6
    2 |M992 | 74 |M6
    2 |M995 | 74 |M6
    2 |M998 | 74 |M6
    Here output shows that CUSTMAST_REQUEST_SRNO M984 having two same rows. And now i want
    to delete any one of row from that. So, how can i apply it for multiple rows ?
    Can any body help-out me in that?
    Thank You,
    Anup Desai
    Edited by: user11688398 on Feb 13, 2013 10:39 PM

    If you want to delete all Duplicates and retain Only One row then Below:
    delete from REQUEST_TRANS a
    where rowid < ( select max(rowid) from REQUEST_TRANS b where a.CUSTMAST_REQUEST_SRNO = b.CUSTMAST_REQUEST_SRNO and a.ACTIVITYMAST_SRNO = b.ACTIVITYMAST_SRNO ... )

  • How to delete zero rows from a matrix?

    Hi,
    I have a 2D datamatrix and there are some zero rows. My original program should recognize all zero rows and delete them. How to do that?
    I have tried with the Delete From Array function but no success. I also tried with the OpenG array functions but...no.
    I attached a vi which simulates my problem. There is one zero row and I want to delete it and have a matrix without zero rows.
    Kudos for any good help!
    Solved!
    Go to Solution.
    Attachments:
    DeleteZeroRows.vi ‏19 KB

    Christian_M wrote:
    The idea was to give a hint that people try using their brain....
    Stilll, I think your code is fundamentally flawed and will thus lead the student into a deep swamp.
    Have you actually tried it with multiple rows of zeroes?
    Since "delete from array" rearranges the array indices with each deletion, the code will break if there is more than one row to be deleted. For example if a row is already deleted and it needs to also delete the last row, it would try to delete a row that no longer exists. If a later row still exists, it will delete the wrong row.
    Also, since NaN gets coerced to a valid index (2147483647), it's probably not such a good idea. "-1" would be a better choice. (Well, it's an unlikely implossible possibility in LabVIEW 32 bit, but still....)
    I also don't understand your logic with "search array". You need to test all elements for zero.
    LabVIEW Champion . Do more with less code and in less time .

  • How to delete a row from a SQL Server CE Table with multiple JOINs?

    I want to delete a record from a SQL Server CE table.
    There are 3 tables scripts, options and results. I would like to remove a record from the results table. The where clause contains dynamic information which retrieved via other queries to different tables in the same database. These queries work fine and deliver
    the desired data.
    The Compact server is a clone of a remote table created using the sync framework. The same query to the remote table works fine.
    The error I get is:
    There was an error parsing the query. [ Token line number = 1,Token line offset = 10,Token in error = from ]
    The code that throws the exception is as follows:
    Dim connLoc As SqlCeConnection = New SqlCeConnection(My.Settings.ConnectionString)connLoc.Open()     Dim strDel As String = "Delete r from ResultsTable r inner join OptionsTable o ON o.TestName=r.TestName inner join ScriptTable c ON r.TestName=c.TestName WHERE r.TestName = '" & ds1Loc.Tables(0).Rows(0)(1) & "' AND [Index] = '" & lstIndex & "'"Dim cmdDel As SqlCeCommand = New SqlCeCommandcmdDel.CommandText = strDelcmdDel.Connection = connLoccmdDel.ExecuteNonQuery()
    The values held in ds1Loc.Tables(0).Rows(0)(1) and lstIndex are
    correct so should not be the problem.
    I also tried using parameterised queries
    Dim strDel As String = "Delete r from [ResultsTable] r inner join [OptionsTable] o ON o.TestName=r.TestName inner join [ScriptTable] c ON r.TestName=c.TestName WHERE r.TestName = @TestName AND [Index] = @lstIndex"
    Dim cmdDel As SqlCeCommand = New SqlCeCommand        cmdDel.CommandText = strDel       
    With cmdDel.Parameters           
    .Add(New SqlCeParameter("@TestName", ds1Loc.Tables(0).Rows(0)(1)))           
    .Add(New SqlCeParameter("@lstIndex", lstIndex))       
    End With 
    cmdDel.Connection = connLoc        cmdDel.ExecuteNonQuery()
    I have tried replacing the "=" with "IN" in the the WHERE clause but this has not worked.
    Is it the join that is causing the problem? I can do a select with the same search criteria and joins from the same database.
    Also this query works with SQL Server. Is it perhaps that SQL CE does not support the Delete function the same as SQL Server 2008? I have been looking at this for a while now and cannot find the source of the error. Any help would be greatly appreciated.

    Hello,
    In SQL Server Compact, we can use join in FROM clause. The DELETE statement fail may be caused by the FOREIGN KEY constraint.
    Please refer to:
    DELETE (SQL Server Compact)
    FROM Clause (SQL Server Compact)
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • How to delete the row from the ADF table using popup box

    Hi,
    I have one requirement like need to delete a record from the table, but that time need to show one popup window for confirmation of the deletion. I am using Delete buttom from the vo operations. I am able to delete the row with out popup but when i used the popup that time deletion is not happening.
    Can any one help me in this.
    Regards,

    Issue was resolved.

  • How to delete one row from sequence

    Hi,
    i have created one table and using sequence for automatically generating id.
    i have successfully entered 5 rows....
    my problem is when i delete 3rd row, the order is changed like 1,2,4,5 but
    i want to get the data order like 1,2,3,4.
    Is it possible....plz help me...i am novice to PL/SQL

    Hi I totally agree with Satyaki_De's comment, but I still like to give the possible way....which may be trivial....
    Please follow the example.
    SQL> create table seq1(n number, a char) ;
    Table created.
    SQL> create sequence seq1seq1
    2 start with 1
    3 ;
    Sequence created.
    SQL> insert into seq1 values (seq1seq1.nextval, '&ccc');
    Enter value for ccc: a
    old 1: insert into seq1 values (seq1seq1.nextval, '&ccc')
    new 1: insert into seq1 values (seq1seq1.nextval, 'a')
    1 row created.
    SQL> /
    Enter value for ccc: b
    old 1: insert into seq1 values (seq1seq1.nextval, '&ccc')
    new 1: insert into seq1 values (seq1seq1.nextval, 'b')
    1 row created.
    SQL> /
    Enter value for ccc: c
    old 1: insert into seq1 values (seq1seq1.nextval, '&ccc')
    new 1: insert into seq1 values (seq1seq1.nextval, 'c')
    1 row created.
    SQL> /
    Enter value for ccc: d
    old 1: insert into seq1 values (seq1seq1.nextval, '&ccc')
    new 1: insert into seq1 values (seq1seq1.nextval, 'd')
    1 row created.
    SQL> /
    Enter value for ccc: e
    old 1: insert into seq1 values (seq1seq1.nextval, '&ccc')
    new 1: insert into seq1 values (seq1seq1.nextval, 'e')
    1 row created.
    SQL> /
    Enter value for ccc: f
    old 1: insert into seq1 values (seq1seq1.nextval, '&ccc')
    new 1: insert into seq1 values (seq1seq1.nextval, 'f')
    1 row created.
    SQL> commit ;
    Commit complete.
    SQL> select * from seq1 ;
    N A
    1 a
    2 b
    3 c
    4 d
    5 e
    6 f
    6 rows selected.
    SQL> delete from seq1 where n = 3 ;
    1 row deleted.
    SQL> commit;
    Commit complete.
    SQL> select * from seq1;
    N A
    1 a
    2 b
    4 d
    5 e
    6 f
    SQL> update seq1 set n = n -1 where n > 2 ;
    3 rows updated.
    SQL> select * from seq1 ;
    N A
    1 a
    2 b
    3 d
    4 e
    5 f
    SQL> drop sequence seq1seq1 ;
    Sequence dropped.
    SQL> create sequence seq1seq1 start with 6 ;
    Sequence created.
    SQL> insert into seq1 values (seq1seq1.nextval, '&ccc')
    2 ;
    Enter value for ccc: g
    old 1: insert into seq1 values (seq1seq1.nextval, '&ccc')
    new 1: insert into seq1 values (seq1seq1.nextval, 'g')
    1 row created.
    SQL> select * from seq1 ;
    N A
    1 a
    2 b
    3 d
    4 e
    5 f
    6 g
    6 rows selected.
    regards
    JC

Maybe you are looking for