Can't delete row

Hi,
i am trying to implement page 664 of dev guide which is delete row of table.
My page shows the data of one row.
I added a delete submitbutton to my page.
Here is my code :
int idi = Integer.parseInt(id.toString());
XxVOImpl vo = getXxVO1();
XxVORowImpl row = null;
int fetchedRowCount = vo.getFetchedRowCount();
boolean rowFound = false;
RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");
if (fetchedRowCount > 0)
deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++)
row = (XxVORowImpl)deleteIter.getRowAtRangeIndex(i);
oracle.jbo.domain.Number primaryKey = row.getId();
if (primaryKey.compareTo(idi) == 0)
row.remove();
rowFound = true;
getTransaction().commit();
break;
deleteIter.closeRowSetIterator();
my problem is that fetchedRowCount is 0. But there are about 100 rows in my table.
And my VO is just a simple select * from mytable.
So i do not understand why fetchedRowCount is still 0 ?
Help thanks
Dan

Dan
You need to create a dialog page with yes no button when you click on delete icon. Please refer dev guide for dialog page or you ma refer below code snippet that you may need to change little bit
   else if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
// The user has clicked a "Delete" icon so we want to display a "Warning"
// dialog asking if she really wants to delete the employee. Note that we
// configure the dialog so that pressing the "Yes" button submits to
// this page so we can handle the action in this processFormRequest( ) method.
String employeeNumber = pageContext.getParameter("empNum");
String employeeName = pageContext.getParameter("empName");
MessageToken[] tokens = { new MessageToken("EMP_NAME", employeeName)};
OAException mainMessage = new OAException("AK",
"FWK_TBX_T_EMP_DELETE_WARN", tokens);
// Note that even though we're going to make our Yes/No buttons submit a
// form, we still need some non-null value in the constructor's Yes/No
// URL parameters for the buttons to render, so we just pass empty
// Strings for this.
OADialogPage dialogPage = new OADialogPage(OAException.WARNING,
mainMessage, null, "", "");
// Always use Message Dictionary for any Strings you want to display.
String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
// We set this value so the code that handles this button press is
// descriptive.
dialogPage.setOkButtonItemName("DeleteYesButton");
// The following configures the Yes/No buttons to be submit buttons,
// and makes sure that we handle the form submit in the originating
// page (the "Employee" summary) so we can handle the "Yes"
// button selection in this controller.
dialogPage.setOkButtonToPost(true);
dialogPage.setNoButtonToPost(true);
dialogPage.setPostToCallingPage(true);
// Now set our Yes/No labels instead of the default OK/Cancel.
dialogPage.setOkButtonLabel(yes);
dialogPage.setNoButtonLabel(no);
// We need to keep hold of the employeeNumber, and the OADialogPage gives us a
// convenient means of doing this. Note that the use of the Hashtable is
// really more appropriate for passing multiple parameters, but we've used
// it here for illustration purposes. See the OADialogPage javadoc for an
// alternative when dealing with a single parameter.
java.util.Hashtable formParams = new java.util.Hashtable(1);
formParams.put("empNum", employeeNumber);
formParams.put("empName", employeeName);
dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);
else if (pageContext.getParameter("DeleteYesButton") != null)
// User has confirmed that she wants to delete this employee.
// Invoke a method on the AM to set the current row in the VO and
// call remove() on this row.
String employeeNumber = pageContext.getParameter("empNum");
String employeeName = pageContext.getParameter("empName");
Serializable[] parameters = { employeeNumber };
OAApplicationModule am = pageContext.getApplicationModule(webBean);
am.invokeMethod("deleteEmployee", parameters);
// Now, redisplay the page with a confirmation message at the top. Note
// that the deleteEmployee() method in the AM commits, and our code
// won't get this far if any exceptions are thrown.
MessageToken[] tokens = { new MessageToken("EMP_NAME", employeeName) };
OAException message = new OAException("AK",
"FWK_TBX_T_EMP_DELETE_CONFIRM", tokens, OAException.CONFIRMATION, null);
pageContext.putDialogMessage(message);
}Thanks
AJ

Similar Messages

  • Can't delete row in updateable detail report in apex 4.0

    i build a master detail form.i insert record in master form and in detail updatable report. but when i delete record in the updatable report then message display 1 record delete but the record is still display in the updatable detail report.

    I request you not to keep starting new threads for the same problems while igonoring the earlier ones.
    If your question is not answered keep progressing the same thread.
    Your earlier thread on this subject, in case you have forgotten ti , is can't delete record in detail updateable report in apex
    Regards,
    Just in case you have not noticed this already , you can set your posts as "watched" automatically. heres how:
    1. Go to your Control Panel
    2. Click on "Your Settings"
    3. Set the two Radio button for wathc to Yes and save.
    Next time when you login you will be able to see your Watches on your Control Panel and in the main forum Thread List they will appear with binocular icon.
    Regads,
    Edited by: Prabodh on Aug 23, 2010 3:58 PM

  • How can I delete rows in a table from the bottom?

    I have table that I add rows to and I want to remove rows starting with the last row. For example if I have a table with 20 rows how do I remove rows 16-20. I can't figure out how to do this.

    The following script would/should/might delete the last 4 rows of a subform named 'itemsSub' : (or actually deletes the last row 4 times hopefully!)
    for (var f = 0; f<4; f++)
    _itemsSub.removeInstance(itemsSub.all.length - 1);

  • Deleting  rows with missing values in field in start routine of update rule

    Hello experts,
    how can I delet rows with missing values in a specific field in the start routine of update rules?
    I think ABAP code should look something like this:
    delete ...  from DATA_PACKAGE where Z_NO = ''.
    thanks in advance for any suggestions!
    hiza

    Write:
    delete data_package where field = value.
    Hope it helps.
    Regards

  • Deleting rows from very large table

    Hello,
    I need to delete rows from a large table, but not all of them, so I can't use truncate. The delete condition is based on one column, something like this:
    delete from very_large_table where col1=100;
    There's an index (valid, B-tree) on col1, but it still goes very slow. Is there any instruction which can help delete rows faster?
    Txh in adv.
    A.

    Your manager doesn't agree to your running an EXPLAIN PLAN? What is his objection? Sounds like the prototypical 'pointy-hair boss'.
    Take a look at these:
    -- do_explain.sql
    spool explain.txt
    -- do EXPLAIN PLAN on target queries with current index definitions
    truncate table plan_table
    set echo on
    explain plan for
    <insert query here>
    set echo off
    @get_explain.sql
    -- get_explain.sql
    set linesize 120
    set pagesize 70
    column operation     format a25
    column query_plan     format a35
    column options          format a15
    column object_name     format a20
    column order           format a12
    column opt           format a6
    select     lpad(' ',level) || operation "OPERATION",
         options "OPTIONS",
         decode(to_char(id),'0','COST = ' || NVL(to_char(position),'n/a'),object_name) "OBJECT NAME",
         cardinality "rows",     
         substr(optimizer,1,6) "OPT"
    from     plan_table
    start     with id = 0
    connect by prior id = parent_id
    There are probably newer, better ways, but this should work with all living versions of Oracle and is something I've had in my back pocket for several years now. It's not actually executing the query or dml in question, just running an explain plan on it.

  • How can I implement the equivilent of a temporary table with "on commit delete rows"?

    hi,
    I have triggers on several tables. During a transaction, I need to gather information from all of them, and once one of the triggers has all the information, it creates some data. I Can't rely on the order of the triggers.
    In Oracle and DB2, I'm using temporary tables with "ON COMMIT DELETE ROWS" to gather the information - They fit perfectly to the situation since I don't want any information to be passed between different transactions.
    In SQL Server, there are local temporary tables and global.  Local temp tables don't work for me since apparently they get deleted at the end of the trigger. Global tables keep the data between transactions.
    I could use global tables and add some field that identifies the transaction, and in each access to these tables join by this field, but didn't find how to get some unique identifier for the transaction. @@SPID is the session, and sys.dm_tran_current_transaction
    is not accessible by the user I'm supposed to work with.
    Also with global tables, I can't just wipe data when "operation is done" since at the triggers level I cannot identify when the operation was done, transaction was committed and no other triggers are expected to fire.
    Any idea which construct I could use to acheive the above - passing information between different triggers in the same transaction, while keeping the data visible to the current transaction?
    (I saw similar questions but didn't see an adequate answer, sorry if posting something that was already asked).
    Thanks!

    This is the scenario: If changes (CRUD) happen to both TableA and TableB, then log some info to TableC. Logic looks something like this:
    Create Trigger TableA_C After Insert on TableA {
      If info in temp tables available from TableB
            Write info to TableC
       else
           Write to temp tables info from TableA
    Create Trigger TableB_C After Insert on TableB {
      If info in temp tables available from TableA
            Write info to TableC
       else
           Write to temp tables info from TableB
    So each trigger needs info from the other table, and once everything is available, info to TableC is written. Info is only from the current transaction.
    Order of the triggers is not defined. Also there's no gurantee that both triggers would fire - changes can happen only to TableA / B and in that case I don't want to write anything to TableC.
    The part that gets and sets info to temp table is implemented as temp tables with "on commit delete rows" in DB2 / Oracle.
    What do you think? As I've mentioned, I could use global temp tables with a field that would identify the transaction, but didn't find something like that in SQL Server. And, the lifespan of local temp tables is too short.

  • Can't delete newly added row in inner advanced table

    Hi!
    Im using advanced in advanced table and i can't delete a row after i added in detail table, i have to refresh the page in order to delete the row.
    This is what i do.
    execute query from master table
    expand row in master table
    click Add row button in detail table(standard button in footer)
    add data in columns
    click save button
    select row with multiselect and then click delete button but nothing's happend i just can delete older rows
    also i can't edit the new row just older rows.
    i think that is something wrong with the cache :S
    any ideas?
    thanks!
    Edited by: 892088 on 03-nov-2011 16:06

    still no answers, the problem is with the new row created because i cant delete or modify it.
    any comment?

  • Can't catch the matrix row for Deleting Rows

    Hi,
    I've already read related topics but couldn't solve the problem.
    I catch the Delete Row menu event 1293, but then I can't save the deleted row in an array since it's no longer listed as a selected row.
    All the matrix rows return
    oMatrix.IsRowSelected(i) = False after catching that 1293 event.  
    Trying BeforeAction True or false didn't solve that problem.
    What am I missing ?

    it sounds like a bug.
    here is workaround: in oMatrix-itempress event try to store selected rowIndex in your variable - so, when you catch 1293-menuEvent you'll know which row you should save - it'll be value of your variable.

  • Can't delete matrix row in UDO form

    Hi all,
    i have a problem. I've already searched the forum and found a couple of solutions, but they didn't work.
    I can't delete a matrix row. I'm on patch level 39, i've read that patches from 32 to 38 gave some problems with matrix row delete.
    Any one has notice regarding same problems with patch 39?
    I post the code i'm using for the delete.
    matrix.FlushToDataSource()
    dbDataSource.RemoveRecord(row - 1)
    matrix.LoadFromDataSource()
    UIForm.Update()
    'Removes the change trace row
    changeTrace.RemoveAt(row - 1)
    UIForm.Mode = BoFormMode.fm_UPDATE_MODE
    Thanks in advance

    Hi,
    I'm using PL39 and I can delete rows in matrix (you are right in previous patch there was an error, and it´s imposible to delete rows). I saw the code you put and I doesn´t undestand what you are trying to do. I explain what I do:
    - I enable the menu 1293 to delete row in a matrix, in the menu event i put the following code
                         Dim oMtx As SAPbouiCOM.Matrix =
    oMtx.FlushToDataSource()
    This works for me.

  • Hi, when can i get the recently deleted rows

    Hi,
    Where can I get the recently deleted rows after commiting the transactions.
    Thanks in advance.

    To query your table e.g. one hour ago:
    select * from your_table as of timestamp sysdate - 1/24change 1/24 to a number where you think your data were still in the table.

  • How can I delete the last row of a Matrix

    Hi All,
    Does anyone know whether deleting the last row of a matrix controlled by a UDO child table gives problems? I have the strange effect that I cannot delete the very last existing row in the matrix, i.e. after updating the delete the last to-be deleted row comes back into my matrix !!
    I give you a snippet of my code (function getSelectedRow gives the selected row in the matrix):
    ==
    if (evnt.ItemUID.Equals(ViewConstants.Items.DELETEBUTTON))
      if (evnt.EventType == BoEventTypes.et_ITEM_PRESSED)
        if (evnt.BeforeAction)
          form = BusinessOne.Application.Forms.Item(formUID);
          mtx = (Matrix)form.Items.Item(ViewConstants.Items.MATRIX).Specific;
         int numRow = getSelectedRow(mtx);
         if (numRow != -1)
                                            mtx.DeleteRow(numRow);
                                            form.Mode = BoFormMode.fm_UPDATE_MODE;
                                       Item btn = (Item)form.Items.Item(ViewConstants.Items.ADDBUTTON);
                                       btn.Enabled = true;
    ==
    Cheers,
    Marcel Peek
    Alpha One
    Message was edited by: Marcel Peek
    Message was edited by: Marcel Peek

    Yes, there is a problem to delete the last row.
    It is fixed in version 2005.

  • Cannot DELETE rows from LOV on running...is it a bug ??

    One of the features I appreciated in the new version of JHeadstart is that we can now insert, modify and delete rows on LOV (even in the database).
    We have just to check on Lookup properties :
    Multi-row insert allowed
    Multi-row update allowed
    Multi-row delete allowed
    I cheked all of them and on runnig I could insert and update records in LOV.
    When I tried to delete records from LOV the system display information message "nothing to save" and in fact no records were deleted.
    Normally since I checked the delete property it should be possible to delete rows from LOV
    thanks for any Help

    Monta,
    I could reproduce this, it is a bug. Added to the fix list for the next release.
    Thanks for reporting,
    Steven Davelaar,
    JHeadstart Team.

  • Unable to delete rows from Target.

    Hello everyone,
    I am unable to delete rows from target data store. Here is what I have done.
    Source Oracle 10g - staging 11g - Target Oracle 11g
    I have implemented consistent set CDC on data model in staging and added 2 tables to CDC and turned on the journals . Both tables A and B are joined together via Column E (primary key of table A). Table A is the master table(has foreign key). Table B is child table. Target column consists of all the columns of both table A and B.
    Following is what I am able to do and not to do
    ABLE TO DO. If data is inserted into both or any of journalized tables I can successfully load the same in target by performing following steps. 1. Extend the consistency window at model level. Lock subscriber. Run the interface with any source table marked as Journalized data only. Unlock subscriber and purge journal.
    ABLE TO DO. If data is updated in any of the journalized table, along with the steps mentioned above I can execute two interfaces. In one Interface table A marked as journalized data only Joined with table B and in second interface table B marked as Journalized data only joined to table a.
    NOT ABLE TO DO If data is deleted from one or both tables it shows up as journalized data in JV$D<tablename> marked as D with date and subscriber name but when i run the interface by extending the window , locking subscriber executing both interfaces, unlock subscriber purge journals. no change takes place is Target. After unlocking subscriber step, journalized data gets removed from JV$D view. Please let me know what I am doing wrong here. How can rows delted from source can also be deleted from TARGET?
    NOTE : In the flow table SYNC_JRNL_DELETES is YES
    In moel under jounalized table tab Table have following order Table A folloed by Table B
    Thanks in advance
    Greenwich

    Sorry I still do not get it. when you say "Its a legacy app", are you talking about the VB.NET app ?
    If so then I repeat my self :-) Why not to connecting to the SQL server directly?
    * even if you need information from several databases (for example ACCESS + SQL Server), in most cases, it is much better to connect directly and get each information to the app. Then in your app you can combine the information and analyse it
    [Personal Site] [Blog] [Facebook]
    Access app is the legacy app. 

  • Database, Dataset, Table Adaptors Error "Unable to load, Update requires a valid DeleteCommand when passed DataRow collection with deleted row"

    Microsoft Visual Basic 2010 Express.
    I am new to Visual Basic programing and i am trying to understand the relationships between Datasets, database, table Adaptors. I have to following code that is is giving me the following error" Unable to load, Update requires a valid DeleteCommand
    when passed DataRow collection with deleted rows". 
    I can track the error and its located in "OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)" code. What am i missing?
    It seems that i can delete the data on the DataGridView Table and it only displays the correct data. but my database is not updating, even though the data grid displays differently.I can determine this because, when i save the offset database, i have all
    the previous uploads and all the rows that i wanted to delete are still there.
    My final goal is to be able to import offset data from a CSV file, save this data on the pc, send a copy of this data to a NuermicUpDown so the customer can modify certain numbers. From here they download all the date to a controller.  IF the customer
    needs to modify the imported data, they can go to a tab with a data grid view and modify the table. They will also have to option to save the modified data into a csv file.  
    Im not sure if i am making this overcomplicated or if there is a easier way to program this.
    CODE:
    Private Function LoadOffSetData()
            Dim LoadOffsetDialog As New OpenFileDialog 'create a new open file dialog and setup its parameters
            LoadOffsetDialog.DefaultExt = "csv"
            LoadOffsetDialog.Filter = "csv|*.csv"
            LoadOffsetDialog.Title = "Load Offset Data"
            LoadOffsetDialog.FileName = "RollCoaterOffset.csv"
            If LoadOffsetDialog.ShowDialog() = Windows.Forms.DialogResult.OK Then  'show the dialog and if the result is ok then
                Try
                    Dim myStream As New System.IO.StreamReader(LoadOffsetDialog.OpenFile) 'try to open the file with a stream reader
                    If (myStream IsNot Nothing) Then 'if the file is valid
                        For Each oldRow As MaterionOffsetDataSet.OffsetTableRow In MaterionOffsetDataSet.OffsetTable.Rows
                            oldRow.Delete()                       
    'delete all of the existing rows
                        Next
                        'OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)
                        Dim rowvalue As String
                        Dim cellvalue(25) As String
                        'Reading CSV file content
                        While myStream.Peek() <> -1
                            Dim NRow As MaterionOffsetDataSet.OffsetTableRow
                            rowvalue = myStream.ReadLine()
                            cellvalue = rowvalue.Split(","c) 'check what is ur separator
                            NRow = MaterionOffsetDataSet.OffsetTable.Rows.Add(cellvalue)
                            Me.OffsetTableTableAdapter.Update(NRow)
                        End While
                        Me.OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)
                        MainOffset.Value = OffsetTableTableAdapter.MainOffsetValue          'saves all the table offsets
    to the offset numericUpDown registers in the main window
                        StationOffset01.Value = OffsetTableTableAdapter.Station01Value
                        StationOffset02.Value = OffsetTableTableAdapter.Station02Value
                       myStream.Close() 'close the stream
                        Return True
                    Else 'if we were not able to open the file then
                        MsgBox("Unable to load, check file name and location") 'let the operator know that the file wasn't able to open
                        Return False
                    End If
                Catch ex As Exception
                    MsgBox("Unable to load, " + ex.Message)
                    Return False
                End Try
            Else
                Return False
            End If
        End Function

    Hello SaulMTZ,
    >>I can track the error and its located in "OffsetTableTableAdapter.Update(MaterionOffsetDataSet.OffsetTable)" code. What am i missing?
    This error usually shows that you do not initialize the
    DeleteCommand object, you could check this
    article to see if you get a workaround.
    >> Im not sure if i am making this overcomplicated or if there is a easier way to program this.
    If you are working CSV file, you could use OleDB to read it which would treat the CSV file as a Table:
    http://www.codeproject.com/Articles/27802/Using-OleDb-to-Import-Text-Files-tab-CSV-custom
    which seems to be easier (in my opinion).
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Right way to delete row before insert

    I create a new row with method of ViewObject.
    Row row = viewObject.createRow();Then I want to delete this row. I found there are 4 methods. Which is the right answer?
    //1.
    row.remove();
    //2.
    row.refresh(Row.REFRESH_REMOVE_NEW_ROWS);
    //3.
    row.refresh(Row.REFRESH_FORGET_NEW_ROWS);
    //4.
    row.removeFromCollection();Thanks,

    Timo, we're having a problem when deleting as you describe, maybe you can offer some advice?
    We have a button to delete a row from an editable table, this is set to immediate=true (obviously the user should be able to skip validation when doing a delete). After deleting, if the user then clicks another button to add a new row, the values from the deleted row show in the new row :(
    If we set immediate=false this seems to fix the problem, but we then get the undesirable side effect that the user has to make sure all the values in the row are correct before it can be deleted (because the validation is firing). The user experience becomes a bit strange.

Maybe you are looking for

  • List View Missing From Calendar in Yosemite

    The List View has disappeared from the Day View in Calendar since upgrading to Yosemite and I dont like it. Is there any way to get the old diary view back again without having to wind back to the previous version of OSX?  IF IT AINT BROKE THEN DONT

  • Having software problem, Windows 7 Home, how to format and reinstall

    Having software problems, Windows 7.  I have the HP  P6510 desktop. I have backed up my data to ext. drive, and  I have the Windows 7 Home CD which I purchased.  Most of the reading I've done to "format & reinstall" seem to say I don't need to format

  • Regarding Approver agent determination

    Hi,         I am new to SRM and i have a requirement to change the Workflow which is trigerred whenever a shopping cart is created and mail is sent to the approver for approval of the same.        Here on creation of shopping cart i need to do some c

  • Is it possible to have a full page of text?

    I would like to create a book with a page of just text. I cannot find a page layout that will let me do this. Has anyone been able to accomplish this task? IMAC   Mac OS X (10.4.10)  

  • CTAS in Exadata (11.2.0.3) from 10gR2*10.2.0.4) = ORA-03120

    I am doing a CTAS to migrate data from a table in 10gR2 (about 800 million rows) and after about 5 hours I get ORA-03120:two-task conversion routine:integer overflow CREATE TABLE X TABLESPACE Z NOLOGGING AS SELECT /*+ parallel (a,16) */ * from Y@dbli