Matrix  Row delete

Hi
I have been observing that my matrix row deleted before executing my code for delete the matrix row. I write my code in BeforeAction=False and I use the menu id to delete the row in matrix.
Some code snap
If pval.BeforeAction = False Then
                Select Case pval.MenuUID
                    Case MenuID.Add_Row
                        BubbleEvent = Me.AddRow
                    Case MenuID.Delete_Row
                        BubbleEvent = Me.DeleteRow
                    Case MenuID.Duplicate_Record
                        'oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE
                End Select
            Else
And My Delete Row logic is
Private Function DeleteRow() As Boolean
        If iRow <= 0 Then
            Return False 'If no row selected
        End If
        'oSIONMstDtl = oForm.DataSources.DBDataSources.Item("@INCM_SIONDTL")
        oExeMatDtl.Clear()
        Try
            oMatrix = oForm.Items.Item("MtxExeMat").Specific
            oMatrix.DeleteRow(iRow)
            ' oForm.DataSources.DBDataSources.Item("@INCM_SIONDTL").RemoveRecord(iRow)
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        For i As Integer = oMatrix.RowCount To 1 Step -1
            oEdit = oMatrix.Columns.Item("ColSr").Cells.Item(i).Specific
            oEdit.Value = i
            oMatrix.GetLineData(i)
        Next
        If oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE Then
            oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
        End If
        Return False
    End Function
Edited by: Manmath Das on Feb 10, 2010 1:26 PM
Edited by: Manmath Das on Feb 10, 2010 1:28 PM

I use this code in deleting row. and it works fine in all may addon. I use C# in my development.
public virtual void menuevent(string FormUID, ref SAPbouiCOM.MenuEvent pVal, ref bool BubbleEvent)
            if (pVal.BeforeAction)
               switch (pVal.MenuUID)
                  case "1293":     // deleterow
                        ondeleterow(is_CurrentMatrixUID, il_CurrentMatrixRow, ref BubbleEvent, false);
                        break;
  public override void ondeleterow(string matrixuid, int row, ref bool BubbleEvent, bool innerevent)
            base.ondeleterow(matrixuid, row, ref BubbleEvent, innerevent);
            int li_rowcount;
            SAPbouiCOM.Matrix oMatrix;
            GC.Collect();
            oForm.Freeze(true);
            oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item(matrixuid).Specific;
            oForm.DataSources.DBDataSources.Item("@FAIAC1").RemoveRecord(row - 1);
            oMatrix.DeleteRow(row);
            li_rowcount = oMatrix.RowCount;
            for (int li_row = 1; li_row <= li_rowcount; li_row++)
                setColumnString(matrixuid, "LineId", li_row, li_row.ToString());
            oForm.Freeze(false);
            BubbleEvent = false;
Hope this will help you.
Regards
John Wilson de los Santos

Similar Messages

  • 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.

  • 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.

  • Another Delete matrix row thread

    I have read some threads with Q&A on the delete matrix row subject but I cant make it work properly. Deleted rows have a tendency to return.
    I first tried to make my own:
    If pVal.MenuUID = "RmLine" And pVal.BeforeAction = True Then
    Set oMatrix = m_oForm.Items("MatrixM").Specific
    i = 1
    While i <= oMatrix.RowCount
      If oMatrix.IsRowSelected(i) Then
       If oMatrix.RowCount = 1 Then
         oMatrix.AddRow
       End If
       oMatrix.DeleteRow i
       m_oForm.DataSources.DBDataSources("@ITCCR_DM").Clear
       oMatrix.LoadFromDataSource
       m_oForm.Mode = fm_UPDATE_MODE
      End If
      i = i + 1
    Wend
    End If
    Problem here is that I cant remove last row without having it return right after.(Thats why I tried the addrow)
    Then I tried using SAP's function:
        m_oForm.EnableMenu "1293", True
    But as soon I hit "Update" the row returns so what do I need to add to the menu event to make it work?

    I use the two following standard methods for add and delete of rows... so far no problems with them (½ a year)
    (Please not that I've have wrapped the entire UI for faster use, so not every method in here are core SDK, but hope you get the idea for the approach)
    public int Add(B1ItemEvent pVal,B1DBDatasource Dbds, bool SwitchToUpdateMode, string ColumnToSelect) {
      InnerMatrix.FlushToDataSource();
      if(Dbds.GetValue_String(0,0)!="" || InnerMatrix.RowCount!=0) {
        Dbds.InsertRecord(Dbds.Size);     
      Dbds.SetValue_String(0,Dbds.Size-1,"");
      InnerMatrix.LoadFromDataSource();
      InnerMatrix.Update();
      if(SwitchToUpdateMode) {
        if(pVal.IsFormModeOK) {
          InnerForm.SwitchToUpdate();
      InnerMatrix.Columns[ColumnToSelect].Focus  (InnerMatrix.RowCount);
      return Dbds.Size-1;
    public bool RemoveSelected(B1ItemEvent pVal, B1DBDatasource Dbds, bool SwitchToUpdateMode, string WarningIfNoRowsSelected) {
      InnerMatrix.FlushToDataSource();
      int row = InnerMatrix.GetNextSelectedRow(0,BoOrderType.ot_RowOrder);
      if(row!=-1) {
        InnerForm.Freeze(true);
        while(row != -1) {
          InnerMatrix.DeleteRow(row);
          if(InnerMatrix.RowCount==0) {
            Dbds.BlankRecord(0);
          row = InnerMatrix.GetNextSelectedRow(0,BoOrderType.ot_RowOrder);
       InnerForm.Freeze(false);
       InnerMatrix.FlushToDataSource();
       InnerMatrix.Update();
       if(SwitchToUpdateMode) {
         if(pVal.IsFormModeOK) {
           InnerForm.SwitchToUpdate();
       return true;
      else {
      Notification.Statusbar_Warning (WarningIfNoRowsSelected);
       return false;

  • Resetting matrix rows

    Hello,
    My form is in ADD Mode and i'm deleting some rows from it thru my code using the following code:
    matItems = SBO_Application.Forms.ActiveForm.Items.Item("38").Specific
    matItems.DeleteRow(intMatRow)
    Now,
    This deletes the row at intMatRow, but the matrix row numbers do not reset as they do when we select and delete a row manually.
    For. eg.: if there are 3 rows in my matrix and i delete the first row, then the row numbers remain 2 and 3 for the remaining rows.
    I want them to change to 1 and 2 as there are only 2 rows now.
    Please help me with this.

    Hi Rohan
    try This
    in menu event pval before action false
    If pVal.MenuUID = "1293" Then
                    If objForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
                        For intCurrentRow = 1 To objMatrix.VisualRowCount
                            objMatrix.Columns.Item("V_-1").Cells.Item(intCurrentRow).Specific.Value = intCurrentRow
                        Next
                    End If
                End If
    in item event for any validation regarding matrix use visualrowcount
    ex code:
      If objMatrix.Columns.Item(1).Cells.Item(objMatrix.VisualRowCount).Specific.Value = "" Then
                                Call objMain.objUtilities.MatrixDeleteRow(FormUID, "11", objMatrix.VisualRowCount)
                            End If
    Rgds
    Micheal
    Edited by: micheal willis on Aug 11, 2009 8:06 PM

  • How to Display Number of Rows Deleted/Inserted etc... in PL/SQL

    In Oracle 10g PL/SQL, I have a delete statement in a stored procedure. It is not in a cursor. I want to see the number of rows I've deleted. I can use the dbms_output.put_line package. I should know this, but I don't have time to perfect the syntax. How would I get the number of rows that get deleted and display it via dbms_output.put_lline?

    No time to google either I guess.
    http://www.google.co.uk/search?q=number+of+rows+deleted+oracle&rls=com.microsoft:en-gb&ie=UTF-8&oe=UTF-8&startIndex=&startPage=1&rlz=&redir_esc=&ei=Qi5qToGyGYqw8QOGzf3nAg
    SQL> create table dt_del_ex(id number);
    Table created.
    SQL> set serveroutput on
    SQL> BEGIN
      2
      3      INSERT INTO dt_del_ex VALUES(1);
      4
      5      DBMS_OUTPUT.put_line(TO_CHAR(SQL%ROWCOUNT)||' rows inserted');
      6
      7      INSERT INTO dt_del_ex select rownum from dual connect by level <=10;
      8
      9      DBMS_OUTPUT.put_line(TO_CHAR(SQL%ROWCOUNT)||' rows inserted');
    10
    11      UPDATE dt_del_ex SET id = id + 3 WHERE id >= 9;
    12
    13      DBMS_OUTPUT.put_line(TO_CHAR(SQL%ROWCOUNT)||' rows updated');
    14
    15      DELETE FROM dt_del_ex WHERE id <= 10;
    16
    17      DBMS_OUTPUT.put_line(TO_CHAR(SQL%ROWCOUNT)||' rows deleted');
    18
    19  END;
    20  /
    1 rows inserted
    10 rows inserted
    2 rows updated
    9 rows deleted
    PL/SQL procedure successfully completed.

  • Instead of delete trigger rows deleted

    Hi All.
    Im using a few instead of triggers over a view. The view selects data from other tables and merges them together. This view essentially forms the parent of a few one2one relationships with other tables.
    However my application doesnt know its a view (im using hibernate orm framework) - so when I delete this object which is mapped to a view, I get an error saying that no records where deleted. Also, if i test in sqlplus, i get "0 rows deleted" in response to a delete - which of course is true, but i want it to say 1 or some number of my choice.
    How can i modify my "instead of delete" trigger so that the number for records deleted count returned to caller is 1, or some number i can define?
    Here is my current trigger...
    create or replace
    trigger product_view_delete_trigger
    instead of delete
    on product_view1
    for each row
    begin
    null;
    end;
    Thanks.

    In regards to why Im using a view - its discussed here...
    Crazy Union across 3 tables
    The view im using is not updatable - it uses a union. I use "instead of triggers" to trick my application into thinking its a real table which is insertable. And this works fine.
    Im having trouble tricking my application into think that the delete was successful, because the "instead of delete" trigger doesnt actually delete anything - which is what i wnat - but i want it to report back to the caller that a delete occurred.
    I want the SQL%ROWCOUNT to be set to 1 or whatever. Perhaps this is not hte variable, but im hoping there is some variable I can set which is used to report back to the client as to how many records were deleted.
    thx.

  • Problem with multi row delete

    Hi, I'm new in apex and I tried to build master detail report on some view. Everything is cool but "delete checked" doesn't work.
    "ORA-20001: Error in multi row delete operation: row= , ORA-06502: PL/SQL: numeric or value error: NULL index table key value,"
    the problem is that I don't know what is wrong :), I have a special trigger "instead of delete on MY_VIEW", but in this error problem is not explained.
    Anybody knows what can be wrong? It is probably a problem with trigger or multi row doesn't work with views? I couldn't find how MRD knows what kind of statement use to delete rows so I don't know if the statement that program used is correct. In debug it lokks that:
    0.32: ...Do not run process "ApplyMRU", process point=AFTER_SUBMIT, condition type=REQUEST_IN_CONDITION, when button pressed=
    0.32: ...Process "ApplyMRD": MULTI_ROW_DELETE (AFTER_SUBMIT) #OWNER#:MY_VIEW:ITEM1:ITEM2
    0.33: Show ERROR page...
    0.33: Performing rollback...
    thanks for any help
    //sorry for english mistakes
    edit: it doesn't matter if I use in trigger delete from ... where item1=:OLD.item1 ; or if I use item1=:P4_item1 (which actually saves correct values)
    Edited by: user5931224 on 2009-06-13 08:55

    I realised that this is not a problem with trigger, I changed trigger to "NULL;" and problem is the same. Maybe sb used master detail on view not only on tables and know what can be wrong in this situation?

  • Tabular form - Multi row delete error

    Apex 4.0.2
    We have a simple CRUD type of application on a bunch of tables built using Apex v1.6 that has, over the years, been upgraded to v4.0.2 and it is working mostly fine. It uses all out-of-the-box standard components, forms, classic reports, nothing too fancy. Recently one of the tabular forms started to misbehave, the multi-row-delete process raises a No Data Found error. The tabular form is based on a view with a INSTEAD OF trigger to handle the DML. Manually deleting the row in SQL*Plus works fine delete from mytab here pk_id = :pk_id but selecting the same row in Apex and clicking Delete raises the error.
    How does one go about troubleshooting & fixing this sort of thing? I tried re-saving the region in the Builder, exporting/importing the entire app, nothing. Running in Debug mode doesn't really provide any additional information, just that the MRD process failed. Tabular forms are the most frustrating, opaque component in Apex, wish they were easier to troubleshoot.
    Any ideas?

    Hello Vikas,
    >> How does one go about troubleshooting & fixing this sort of thing?
    By given us a bit more information :)
    • Is it a manual Tabular Form (using the ITEM API) or a wizard created one?
    • Are the Insert/Update operations work correctly? If not, what is the type of your PK column(s)?
    • If the problem is limited to the Delete operation, maybe the problem lies with the checkbox column. Are you sure that on page it is rendered as the f01 column?
    • As triggers are involved, can you save the PK that the trigger sees? Is it the expected value?
    • Are there any other processes that are fired before the DML process? If so, maybe the problem is with them. You can temporarily disable them and see if it change anything.
    >> Tabular forms are the most frustrating, opaque component in Apex, wish they were easier to troubleshoot
    Yes, I agree. However, I believe that 4.1 made some serious advancement where Tabular Form is concerned. Having simplified Tabular Form related Validations and Process should make things easier, and as a result, prone to less errors. Still, the main problem is that the type of error you are talking about is usually the result of metadata problems and these are indeed very hard to track.
    Regards,
    Arie.
    &diams; Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.
    &diams; Author of Oracle Application Express 3.2 – The Essentials and More

  • Multi-row Delete (MRD) on a view?

    All,
    I created a tabular form on a view, using an instead of trigger to encapsulate the logic for the data manipulations. Works great--until someone checks a row and hits the delete button, at which point APEX throws this error:
    ORA-20001: Error in multi row delete operation: row= 107970-18527, ORA-06502: PL/SQL: numeric or value error: character to number conversion error,
    Error     multi row operation failedAs far as I can tell, it's not even getting to the trigger; I commented out the body of the instead of delete trigger (replacing it with null), and I'm still getting the same error. I have no validations or processes on the page at this point.
    The underlying data of the view requires three columns for a unique identifier, so I've concatenated two of them together as an extra column in the view (creating a varchar2 column), and told the MRD to use the calculated column and the third column as the primary key columns. But even using two of the three numeric columns (tweaking the trigger to use a hard-coded value for the third) as an ID fails miserably.
    Any idea what's going on?
    Thanks,
    -David
    (In case it makes a difference, we're on APEX 4.0.1.)

    Hi David,
    This might help:
    http://oraclequirks.blogspot.com/2011/07/ora-20001-error-in-multi-row-delete.html
    Hope it helps!
    Regards,
    Kiran

  • Validation in a Multi Row Delete

    Hi all,
    i made a page with an updateable report region - all works fine.
    But now i want to do a validation in the process 'Multi Row Delete'.
    The aim is to guarantee that the specific row is not deleted if the validation for that row fails.
    How can i achieve that?
    Any feedback is welcome.
    Best regards
    Martin

    Hi,
    many thanks for your reply.
    Yes in my case it is a tabular form and the validation should be done vor 'multi row delete'. Accordingly to the article you mentioned i created a validation with the following PL/SQL code:
    DECLARE
    vRow PLS_INTEGER;
    BEGIN
    FOR i in 1..apex_application.g_f01.COUNT LOOP
    IF apex_application.g_f01(i) IS NOT NULL THEN
    vRow := TO_NUMBER(apex_application.g_f01(i));
    IF lpkom_api.checkPersonAssigned(apex_application.g_f03(vRow)) THEN
    RETURN 'Delete is not allowed for this row.';
    END IF;
    END IF;
    END LOOP;
    END;
    Best regards
    Martin

  • ORA-20001: Error in multi row delete operation: ORA-01403: no data

    Whenever I attempt a multi-row delete on my master detail page, I recieve the error:
    ORA-20001: Error in multi row delete operation: ORA-01403: no dataI have seen in other threads that the primary key attribute of the underlying table needs to be set to 'Show' in the report attributes. I have tried this both with it displaying as 'Hidden' ('Show' is unchecked) and with it displaying as text. Either way still gives me the same error.
    Is there anything else not mentioned in the other threads that could be causing this error for me?
    Thanks.
    BoilerUP

    Jimmy,
    In your multi row delete process you specify schema name, table and column name. Your report needs to be of type “SQL query (Updateable report)”. And your report needs to include the primary key column of your table. The column or alias name of that report column needs to correspond with the actual column name of your table.
    Marc

  • How to re-order automatically the number of primary key column in MySql that has been set as auto_increment if one of the row deleted?

    Hello,
    Can anyone show me the way how to re-oder automatically the number of primary key that has been set as auto_increment in mysql database when the row deleted?
    example:
    No (primary key=auto increment)|
    Name |
    AGE |
    1
        | JO
    | 21
    |
    2
        | Kyle
    | 25
    |
    3
        | Macy
    | 30
    |
    When delete 1 row:
    No (primary key=auto increment)|
    Name |
    AGE |
    1
        | JO
    | 21
    |
    2
        | Macy
    | 30
    |

    Hello,
    This is not a VB.NET question, best to ask this question in
    MySQL forum.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • JTable row deletion deleting valuable information  --need HELP

    Hi Experts and Java Programmers,
    I am posting the code that works 99% of the time. It basically creates a JTable and has row insertion and row deletion methods. The row insertion works fine. However, when a row N is deleted it causes the loss of data in the row N+1's cell in whichever cell the cursor is blinking. In other words, when cursor is in cell M of row N, row deletion sets the cell M of row N+1 to blank. So if the cursor is on the 2nd cell of 1st row and if 1st row is deleted, the data in the 2nd cell of 2nd row (now moved to 1st row) is lost.
    Thanks for your help.
    Murthy
    package trunkxref;
    *  Copyright 1999-2002 Matthew Robinson and Pavel Vorobiev.
    *  All Rights Reserved.
    *  ===================================================
    *  This program contains code from the book "Swing"
    *  2nd Edition by Matthew Robinson and Pavel Vorobiev
    *  http://www.spindoczine.com/sbe
    *  ===================================================
    *  The above paragraph must be included in full, unmodified
    *  and completely intact in the beginning of any source code
    *  file that references, copies or uses (in any way, shape
    *  or form) code contained in this file.
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import java.text.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.net.*;
    public class trnk
    //extends JFrame
      public JTable m_table;
      public TrunkReportData m_data;
      public JLabel m_title;
      public JLabel m_title2;
      public InputStream is;
      Image imginsert, imgdel, imgup, imgdown, imgsav;
      URL jspURL;
      JApplet applet;
      public trnk ( JApplet applet,InputStream is, Image imginsert, Image imgdel, Image imgup, Image imgdown, Image imgsav, URL jspURL)
        //super ("Trunks Data");
        //setSize (600, 300);
        this.applet=applet;
        this.is=is;
        this.imginsert=imginsert;
        this.imgdel=imgdel;
        this.imgup=imgup;
        this.imgsav=imgsav;
        this.imgdown=imgdown;
        this.jspURL=jspURL;
        UIManager.put("Table.focusCellHighlightBorder",
                new LineBorder(Color.black, 0));
        m_data = new TrunkReportData (this,imgup, imgdown);
        m_title = new JLabel(m_data.getTitle(),
                    null, SwingConstants.LEFT);
        m_title2 = new JLabel("(Please make sure to hit TAB or ENTER after making changes to a cell)",
                    null, SwingConstants.LEFT);
        m_title.setFont(new Font("Helvetica",Font.PLAIN,24));
        m_title2.setFont(new Font("Helvetica",Font.PLAIN,12));
               Color bg=new Color(200,100,30);
               //setBackground(header.getBackground());
               m_title.setBackground(bg);
               m_title.setForeground(Color.white);
               m_title2.setBackground(bg);
               m_title2.setForeground(Color.yellow);
        //getContentPane().add(m_title, BorderLayout.NORTH);
        m_table = new JTable ();
         m_table.putClientProperty( "JTable.autoStartsEdit", new Boolean( false ) );
         //m_table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
        m_table = new JTable () {
              public boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {     
                   if (e.getKeyChar()==KeyEvent.CHAR_UNDEFINED)
                        return false;     
                   return super.processKeyBinding(ks,e,condition,pressed);             }
        m_table = new JTable () {
         protected void processKeyEvent(KeyEvent e)     {     
               if ( (e.getKeyCode() == KeyEvent.VK_ENTER ||
                   e.getKeyCode() == KeyEvent.VK_TAB) &&  
                   e.getID() == KeyEvent.KEY_PRESSED ){
                        if(m_table.isEditing()) {
                             m_table.getCellEditor().stopCellEditing();
                             int row = m_table.getEditingRow();
                             int col = m_table.getEditingColumn();
                             col++; // actually check col > number of columns
                             m_table.editCellAt(row,col);
                             //m_table.transferFocus();
                        } else {
                             int col = m_table.getSelectedColumn() + 1;
                             int row = m_table.getSelectedRow();
                             m_table.clearSelection();
                             col++; // actually check col > number of columns
                             m_table.editCellAt(row,col);
                             //m_table.transferFocus();
                                //m_table.setRowSelectionInterval(row, row);
                                //m_table.setColumnSelectionInterval(column, column);               
                             //m_table.scrollRectToVisible( m_table.getCellRect(row, column, true) );          
              }     else           {               
                   super.processKeyEvent(e);           
         //m_table.setSurrendersFocusOnKeystroke(true);
         //m_table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
         m_table.addFocusListener(new FocusListener() {
              public void focusGained(FocusEvent e){
              public void focusLost(FocusEvent e){
                        if(m_table.isEditing()) {
                             m_table.getCellEditor().stopCellEditing();
        m_table.setAutoCreateColumnsFromModel (false);
        m_table.setModel (m_data);
        m_table.setSelectionMode (ListSelectionModel.SINGLE_SELECTION);
        for (int k = 0; k < m_data.getColumnCount (); k++)
         TableCellRenderer renderer = null;
         TableCellEditor editor = null;
         renderer = new TextAreaCellRenderer ();     // NEW
         editor = new TextAreaCellEditor (m_table, m_data);
         TableColumn column = new TableColumn (k,
                                   TrunkReportData.m_columns[k].m_width,
                                   renderer, editor);
         column.setHeaderRenderer(createDefaultRenderer());
         m_table.addColumn (column);
        JTableHeader header = m_table.getTableHeader ();
        header.setUpdateTableInRealTime (false);
        header.addMouseListener(new ColumnListener());
        header.setReorderingAllowed(true);
        //JScrollPane ps = new JScrollPane ();
        //ps.getViewport ().setBackground (m_table.getBackground ());
        //ps.setSize (550, 150);
        //ps.getViewport ().add (m_table);
        //getContentPane ().add (ps, BorderLayout.CENTER);
        //JToolBar tb = createToolbar ();
        //getContentPane ().add (tb, BorderLayout.NORTH);
        //JPanel p = new JPanel (new GridLayout (1, 2, 5, 5));
        //getContentPane ().add (p, BorderLayout.SOUTH);
      } //constructor trnk
      protected TableCellRenderer createDefaultRenderer() {
        DefaultTableCellRenderer label = new DefaultTableCellRenderer()
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
           if (table != null) {
             JTableHeader header = table.getTableHeader();
             if (header != null) {
               //setForeground(header.getForeground());
               setForeground(Color.white);
               Color bg=new Color(200,100,30);
               //setBackground(header.getBackground());
               setBackground(bg);
               setFont(header.getFont());
           setText((value == null) ? "" : value.toString()) ;
           setBorder(UIManager.getBorder("TableHeader.cellBorder"));
           return this;
        label.setHorizontalAlignment(JLabel.CENTER);
        return label;
      } //table cell renderer
      public JToolBar createToolbar ()
        JToolBar tb = new JToolBar ();
        tb.setFloatable (false);
               Color bg=new Color(200,100,30);
               //setBackground(header.getBackground());
               tb.setBackground(bg);
        JButton bt = new JButton (new ImageIcon (imginsert));
        //JButton bt = new JButton ("Insert");
        bt.setToolTipText ("Insert Row");
        bt.setRequestFocusEnabled (false);
        ActionListener lst = new ActionListener (){
          public void actionPerformed (ActionEvent e) {
         int nRow = m_table.getSelectedRow() + 1;
         m_data.insert (nRow);
         m_table.tableChanged (new TableModelEvent
                         (m_data, nRow, nRow, TableModelEvent.ALL_COLUMNS,
                          TableModelEvent.INSERT));
         m_table.setRowSelectionInterval (nRow, nRow);
        bt.addActionListener ((ActionListener)lst);
        tb.add (bt);
        bt = new JButton (new ImageIcon (imgdel));
        //bt = new JButton ("Delete");
        bt.setToolTipText("Delete Row");
        bt.setRequestFocusEnabled(false);
        lst = new ActionListener ()
         public void
           actionPerformed
           (ActionEvent e)
             int nRow = m_table.getSelectedRow();
              if (nRow  < 0)
               JOptionPane.showMessageDialog( null,  "Please select a row to delete",  "Error", JOptionPane.ERROR_MESSAGE);
              else
              if (JOptionPane.showConfirmDialog(null, "Do you want to delete the selected row?", "Delete a Row", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
             if (m_data.delete (nRow))
              m_table.getCellEditor().stopCellEditing();
              m_table.tableChanged
                (new TableModelEvent
                 (m_data, nRow, nRow,
                  TableModelEvent.ALL_COLUMNS,
                  TableModelEvent.DELETE));
              //m_table.clearSelection();
        bt.addActionListener(lst);
        tb.add (bt);
        bt = new JButton (new ImageIcon (imgsav));
        //bt = new JButton ("Save");
        bt.setToolTipText("Save");
        bt.setRequestFocusEnabled(false);
        lst = new ActionListener ()
         public void
           actionPerformed
           (ActionEvent e)
             m_table.tableChanged (new TableModelEvent
                          (m_data));
             //m_data.fireTableDataChanged();
             //System.out.println("beginning to write data to" + jspURL.toString());
             //code to save data to file
              //final Component top=(trnk)this.getTopLevelAncestor();
              //final Component top=(trnk)super.;
              //final Cursor lOrigCursor =(Cursor) super.getCursor();
              //final Cursor lOrigCursor = getCrsr();
              //top.setCursor( Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR ) );
              setWaitCursor();
              Thread lSavThread= new Thread() {
                   public void run()
                        savefile(m_data, jspURL);
                        //top.setCursor( lOrigCursor );
                        setNormalCursor();
              lSavThread.start();
        bt.addActionListener(lst);
        tb.add (bt);
        return tb;
      } //create tool bar
      public void setWaitCursor()
              applet.getGlassPane().setVisible(false);
              applet.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
      public void setNormalCursor()
              applet.getGlassPane().setVisible(true);
              applet.getGlassPane().setCursor(Cursor.getDefaultCursor());
      public void savefile(TrunkReportData m_data, URL jspURL)
             String txt="";
             Enumeration enum=m_data.m_vector.elements();
             while(enum.hasMoreElements())
              TrunkData trnk = (TrunkData)enum.nextElement();
              txt += trnk.m_sysname + " , "
    + trnk.m_clli + " , "
    + trnk.m_tg + " , "
    + trnk.m_member.intValue() + " , "
    + trnk.m_trunk_type + " , "
    + trnk.m_lata + " , "
    + trnk.m_lata_name + " , "
    + trnk.m_prospect_server + " , "
    + trnk.m_tgroupid + " , "
    + trnk.m_ctg + " , "
    + trnk.m_augmen.intValue() + " , "
    + trnk.m_vendor + "\n";
             try {
               URLConnection jspCon=jspURL.openConnection();
               jspCon.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
               jspCon.setUseCaches(false);
               jspCon.setDoOutput(true);
               PrintStream out = new PrintStream(jspCon.getOutputStream());
               String postData= "Text=" + URLEncoder.encode(txt, "UTF-8");
               out.println(postData);
               out.flush();
               out.close();
               InputStreamReader in=new InputStreamReader(jspCon.getInputStream());
               int chr;
               while((chr=in.read()) != -1) {}
               in.close();
             } catch (Exception e2) {
               System.out.println (" exception in writing data out "
    + e2.toString());
             //System.out.println("done write data");
      // NEW
      class ColumnListener extends MouseAdapter {
        public void mouseClicked(MouseEvent e) {
          TableColumnModel colModel = m_table.getColumnModel();
          int columnModelIndex = colModel.getColumnIndexAtX(e.getX());
          int modelIndex = colModel.getColumn(columnModelIndex).getModelIndex();
          if (modelIndex < 0)
         return;
          if (m_data.m_sortCol == modelIndex)
         m_data.m_sortAsc = !m_data.m_sortAsc;
          else
         m_data.m_sortCol = modelIndex;
          for (int i=0; i < m_data.getColumnCount(); i++) {
         TableColumn column = colModel.getColumn(i);
         int index = column.getModelIndex();
         JLabel renderer = (JLabel)column.getHeaderRenderer();
         renderer.setIcon(m_data.getColumnIcon(index));
          m_table.getTableHeader().repaint();
          m_data.sortData();
          m_table.tableChanged(new TableModelEvent(m_data));
          m_table.repaint();
      } //column listener
    } //class trnk
    class TextAreaCellRenderer extends JTextArea implements TableCellRenderer
      protected static Border m_noFocusBorder    =    new
      EmptyBorder (1,           1,           1,           1);
      protected static    Border    m_focusBorder =
      UIManager.getBorder("Table.focusCellHighlightBorder");
      public
      TextAreaCellRenderer
        setEditable
          (false);
        setLineWrap
          (true);
        setWrapStyleWord
          (true);
        setBorder
          (m_noFocusBorder);
      public Component
      getTableCellRendererComponent
      (JTable table,
       Object value,
       boolean
       isSelected,
       boolean
       hasFocus,
       int nRow, int nCol)
        Color fg=new Color(255,0,0);
        //ColorData cvalue = new ColorData(value);
        setForeground(fg);
        if (value       instanceof       String)
          setText ((String) value);
        else if (value instanceof Integer)
          setText((String)value.toString());
         setBackground
          (isSelected && !hasFocus ?      table.getSelectionBackground() : table.getBackground ());
        //setForeground (isSelected && !hasFocus ?
        //      table.getSelectionForeground() : table.getForeground ());
        setFont (table.getFont ());
        setBorder (hasFocus ? m_focusBorder : m_noFocusBorder);
         causes looping and stops rendering the components surrounding
         the cells
        // Adjust row's
        // height
        //int width =
         // table.getColumnModel().getColumn(nCol).getWidth ();
        //setSize (width,
    //          1000);
        int rowHeight =     getPreferredSize().height;
        if (table.getRowHeight(nRow) <  rowHeight)
          table.setRowHeight (nRow,  rowHeight);
         //table.setRowHeight(nRow, 20);
        return this;}
      // To fix JDK bug
      public String getToolTipText (MouseEvent event)
        return null;
    } //class text area cell renderer
    // NEW
    class TextAreaCellEditor extends AbstractCellEditor implements
    TableCellEditor
      public static int CLICK_COUNT_TO_EDIT = 1;
      protected JTextArea m_textArea;
      protected JScrollPane m_scroll;
      public TextAreaCellEditor (JTable t_table, TrunkReportData t_tablemodel)
         final JTable table=t_table;
         final TrunkReportData tablemodel =t_tablemodel;
        m_textArea = new JTextArea () {
         protected void processKeyEvent(KeyEvent e)     {     
                   //if (e.getKeyChar()==KeyEvent.CHAR_UNDEFINED)
                   // return ;
               if ( (e.getKeyCode() == KeyEvent.VK_ENTER ||
                   e.getKeyCode() == KeyEvent.VK_TAB)&&  
                   e.getID() == KeyEvent.KEY_PRESSED ){
                   int row = table.getEditingRow();
                   int col = table.getEditingColumn();
                   col++; // actually check col > number of columns
                   if (col == tablemodel.getColumnCount())
                        row++;
                        if (row == tablemodel.getRowCount())
                        row=0;
                        col=0;
                   stopCellEditing();
                   table.editCellAt(row,col);
                   table.transferFocus();
              }     else if ( (e.getKeyCode() == KeyEvent.VK_DOWN ||
                   e.getKeyCode() == KeyEvent.VK_UP ) &&
                   e.getID() == KeyEvent.KEY_PRESSED ){
                   int row = table.getEditingRow();
                   int col = table.getEditingColumn();
                   if ( e.getKeyCode() == KeyEvent.VK_UP)
                   row--;
                   if ( e.getKeyCode() == KeyEvent.VK_DOWN)
                   row++;
                   if (col == tablemodel.getColumnCount())
                        row++;
                        if (row == tablemodel.getRowCount())
                        row=0;
                        col=0;
                   stopCellEditing();
                   table.editCellAt(row,col);
                   table.transferFocus();
              }     else
                   super.processKeyEvent(e);           
        m_textArea.setLineWrap (true);
        m_textArea.setWrapStyleWord (true);
        m_scroll = new JScrollPane (m_textArea,
                        //JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                        JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                        //JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      public Component
      getTableCellEditorComponent
      (JTable table,
       Object value,
       boolean
       isSelected,
       int nRow, int nCol)
        //m_textArea.setBackground(table.getBackground());
        m_textArea.setBackground(Color.green);
        //m_textArea.setForeground(table.getForeground());
        m_textArea.setForeground(Color.black);
        m_textArea.setFont (table.getFont());
        m_textArea.setText (value   ==   null ?   "" :  value.toString());
        return m_scroll;
      public Object getCellEditorValue ()
        return       m_textArea.getText ();
      JTextArea getCellEditor ()
        return       m_textArea;
      public boolean isCellEditable (EventObject anEvent)
        if (anEvent   instanceof         MouseEvent)
         int click = ((MouseEvent) anEvent).getClickCount();
         return click >= CLICK_COUNT_TO_EDIT;
        return true;
    } //class text area cell editor
    class TrunkData
      public String    m_sysname;
      public String    m_clli;
      public String    m_tg;
      public Integer     m_member;
      public String    m_trunk_type;
      public String    m_lata;
      public String    m_lata_name;
      public String    m_prospect_server;
      public String    m_tgroupid;
      public String    m_ctg;
      public Integer   m_augmen;
      public String    m_vendor;
      public TrunkData ()
        m_sysname = "";
        m_clli = "";
        m_tg = "";
        m_member =     new Integer (0);
        m_trunk_type =     "";
        m_lata = "";
        m_lata_name =       "";
        m_prospect_server       = "";
        m_tgroupid = "";
        m_ctg = "";
        m_augmen = new Integer(0);
        m_vendor = "";
      public
      TrunkData
      (String sys,
       String clli,
       String tg,
       String member,
       String ttyp,
       String lata,
       String latanm,
       String pserver,
       String tgrpid,
       String ctg,
       String aug,
       String vend)
        m_sysname = sys;
        m_clli = clli;
        m_tg = tg;
        try {
          if (member.trim().equals(""))
         m_member=new Integer(0);
          else
         m_member =     new Integer(member.trim());
        } catch (Exception e) {
          System.out.println("can't parse member " + e.toString());
        m_trunk_type =     ttyp;
        m_lata = lata;
        m_lata_name =     latanm;
        m_prospect_server     = pserver;
        m_tgroupid =     tgrpid;
        m_ctg = ctg;
        if (aug.trim().equals(""))
          m_augmen=new Integer(0);
        else m_augmen=new Integer(aug.trim());
        m_vendor = vend;
    } //class trunkd data
    class ColumnData
      public String    m_tolatLbl;
      int m_width;
      int m_alignment;
      public    ColumnData    (String title,     int width,     int alignment)
        m_tolatLbl =     title;
        m_width = width;
        m_alignment =     alignment;
    } //class column data
    class  TrunkReportData  extends  AbstractTableModel
      public static ImageIcon COLUMN_UP;
      public static ImageIcon COLUMN_DOWN;
      public int               m_sortCol = 0;
      public boolean m_sortAsc = true;
      public static      final ColumnData      m_columns[] =
        new      ColumnData      ("System", 200,       JLabel.LEFT),
        new      ColumnData      ("CLLI", 200,       JLabel.LEFT),
        new      ColumnData      ("Trunk Group",       200,       JLabel.LEFT),
        new      ColumnData      ("Members", 200,       JLabel.LEFT),
        new      ColumnData      ("Trunk Type",       200,       JLabel.LEFT),
        new      ColumnData      ("LATA ", 200,       JLabel.LEFT),
        new      ColumnData      ("LATA Name",       200,       JLabel.LEFT),
        new      ColumnData      ("Prospect Server",       200,       JLabel.LEFT),
        new      ColumnData      ("Trunk Group ID",       200,       JLabel.LEFT),
        new      ColumnData      ("CTG", 200,       JLabel.LEFT),
        new      ColumnData      ("Augments", 200,       JLabel.LEFT),
        new      ColumnData      ("Vendor", 200,       JLabel.LEFT)
      protected      trnk m_parent;
      protected Vector      m_vector;
      public TrunkReportData (trnk parent , Image imgup, Image imgdown)
        this.COLUMN_UP=new ImageIcon(imgup);
        this.COLUMN_DOWN=new ImageIcon(imgdown);
        m_parent = parent;
        m_vector = new Vector ();
        setDefaultData (parent.is);
      public void setDefaultData (InputStream is)
        m_vector =  new Vector ();
        int numFields =       0;
        try
         BufferedReader
           br =new     BufferedReader(new InputStreamReader(is));
         String inline ="";
         while ((inline =  br.readLine()) != null)
             if (inline.indexOf('#') > -1)
              continue;
             StringTokenizer st = new StringTokenizer (inline, ",");
             String nsys=st.nextToken ().trim(); //sys
             String nclli=  st.nextToken().trim() ;     // clli
             String ntg= st.nextToken ().trim();     // tg
             String nmemb=  st.nextToken().trim();     // members
             String nttyp=   st.nextToken ().trim();     // trunktype
             String nlata= st.nextToken ().trim();     // lata
             String nlataname=  st.nextToken ().trim();     // lata  name
             String npros=    st.nextToken ().trim();     // prospect  server
             String ntgrpid=st.nextToken().trim();      //tgroupid
             String nctg=st.nextToken().trim();      //ctg
             String naug=st.nextToken().trim();      //augments
             String nvend=st.nextToken().trim();      //vendor
             m_vector.addElement(new TrunkData(nsys,nclli, ntg,
                                   nmemb, nttyp, nlata, nlataname, npros, ntgrpid, nctg,
                                   naug,nvend));
         br.close ();}
        catch (Exception e)
         System.out.println("Error in file reader 2 "+ e.toString ());
        sortData();
      public Icon getColumnIcon(int column) { // NEW
        if (column==m_sortCol)
          return m_sortAsc ? COLUMN_UP : COLUMN_DOWN;
        return null;
      // NEW
      public void sortData() {
        Collections.sort(m_vector, new
                   TrunkComparator(m_sortCol, m_sortAsc));
      public int getRowCount ()
        return m_vector == null ? 0 : m_vector.size ();
      public int getColumnCount ()
        return    m_columns.length;
      public String getColumnName(int nCol)
        return    m_columns[nCol]. m_tolatLbl;
      public boolean isCellEditable
      (int nRow, int nCol)
        return true;
      public Object getValueAt (int         nRow,         int nCol)
        if (nRow < 0 || nRow >=getRowCount())
          return "";
        TrunkData row = (TrunkData) m_vector.elementAt(nRow);
        switch (nCol)
          case 0:
         return row.m_sysname;
          case 1:
         return row.m_clli;
          case 2:
         return row.m_tg;
          case 3:
         return row.m_member;
          case 4:
         return row.m_trunk_type;
          case 5:
         return row.m_lata;
          case 6:
         return row.m_lata_name;
          case 7:
         return row.m_prospect_server;
          case 8:
         return row.m_tgroupid;
          case 9:
         return row.m_ctg;
          case 10:
         return row.m_augmen;
          case 11:
         return row.m_vendor;
        return "";
      public void setValueAt (Object value, int nRow, int nCol)
        if (nRow < 0
         || nRow >=
         getRowCount
         || value ==
         null)
          return;
        System.out.println("setting nrow=" + nRow + " nCol=" + nCol + " to value=" + (String) value);
        TrunkData row = (TrunkData) m_vector.elementAt (nRow);
        String svalue = value.toString ();
        switch (nCol)
          case 0:
         row.m_sysname = svalue; break;
          case 1:
         row.m_clli = svalue; break;
          case 2:
         row.m_tg = svalue; break;
          case 3:
         if (svalue.trim().equals(""))
           row.m_member=new Integer(0);
         else
             try {
               row.m_member = new Integer(svalue.trim());
             } catch (NumberFormatException e) {
               JOptionPane.showMessageDialog( null,  "Please enter integer valuesonly.",  "Error", JOptionPane.ERROR_MESSAGE);
           break;
          case 4:
         row.m_trunk_type = svalue; break;
          case 5:
         row.m_lata = svalue; break;
          case 6:
         row.m_lata_name = svalue; break;
          case 7:
         row.m_prospect_server = svalue; break;
          case 8:
         row.m_tgroupid = svalue; break;
          case 9:
         row.m_ctg = svalue; break;
          case 10:
              if (svalue.trim().equals("")) {
                   row.m_augmen = new Integer(0);
              } else {
                       try {
                        row.m_augmen = new Integer(svalue.trim());
                       } catch (NumberFormatException e) {
                              JOptionPane.showMessageDialog( null,  "Error", "Please enter only integer values.",  JOptionPane.ERROR_MESSAGE);
              break;
          case 11:
         row.m_vendor = svalue; break;}
        fireTableCellUpdated(nRow,nCol);
      public void insert (int nRow)
        if (nRow < 0)
          nRow = 0;
        if (nRow >     m_vector.size ())
          nRow  =
         m_vector. size ();
        m_vector.insertElementAt
          (new
           TrunkData (),
           nRow);
      public boolean delete (int nRow)
        if (nRow < 0
         || nRow >=
         m_vector.size
         ())return
              false;
        m_vector.remove (nRow);
        return true;
      public String getTitle() {
        return "Verizon Trunk Table";
    } //class trunk report data
    class TrunkComparator implements Comparator {
      protected int            m_sortCol;
      protected boolean m_sortAsc;
      public TrunkComparator(int sortCol, boolean sortAsc) {
        m_sortCol = sortCol;
        m_sortAsc = sortAsc;
      public int compare(Object o1, Object o2)
        if (!(o1 instanceof TrunkData) || !(o2 instanceof TrunkData))
          return 0;
        TrunkData s1=(TrunkData)o1;
        TrunkData s2=(TrunkData)o2;
        int result=0;
        String str1="", str2="";
        int i1=0, i2=0;
        switch(m_sortCol) {
        case 0: //sysname
          str1=(String)s1.m_sysname;
          str2=(String)s2.m_sysname;
          result=str1.compareTo(str2);
          break;
        case 1: // clli
          str1=(String)s1.m_clli;
          str2=(String)s2.m_clli;
          result=str1.compareTo(str2);
          break;
        case 2: //TG
          str1=(String)s1.m_tg;
          str2=(String)s2.m_tg;
          result=str1.compareTo(str2);
          break;
        case 3: //member
          i1 =s1.m_member.intValue();
          i2 =s2.m_member.intValue();
          result = i1 < i2 ? -1 : (i1 > i2 ? 1 : 0);
          break;
        case 4: //trunk type
          str1=(String)s1.m_trunk_type;
          str2=(String)s2.m_trunk_type;
          result=str1.compareTo(str2);
          break;
        case 5: //lata
          str1=(String)s1.m_lata;
          str2=(String)s2.m_lata;
          result=str1.compareTo(str2);
          break;
        case 6: //lata name
          str1=(String)s1.m_lata_name;
          str2=(String)s2.m_lata_name;
          result=str1.compareTo(str2);
          break;
        case 7: //prospect server
          str1=(String)s1.m_prospect_server;
          str2=(String)s2.m_prospect_server;
          result=str1.compareTo(str2);
          break;
        case 8: //tgroup id
          str1=(String)s1.m_tgroupid;
          str2=(String)s2.m_tgroupid;
          result=str1.compareTo(str2);
          break;
        case 9: //ctg
          str1=(String)s1.m_ctg;
          str2=(String)s2.m_ctg;
          result=str1.compareTo(str2);
          break;
        case 10: //augments
          i1 =s1.m_augmen.intValue();
          i2 =s2.m_augmen.intValue();
          result = i1 < i2 ? -1 : (i1 > i2 ? 1 : 0);
          break;
        case 11: //vendor
          str1=(String)s1.m_vendor;
          str2=(String)s2.m_vendor;
          result=str1.compareTo(str2);
          break;
        if (!m_sortAsc) result = -result;
        return result;
      public boolean equals(Object obj) {
        if (obj instanceof TrunkComparator) {
          TrunkComparator compObj=(TrunkComparator) obj;
          return (compObj.m_sortCol == m_sortCol) &&
         (compObj.m_sortAsc==m_sortAsc);
        return false;
    } //class trunk comparator

    Problem resolved by modifying the code to this:
    bt.setToolTipText("Delete Row");   
    bt.setRequestFocusEnabled(false);   
    lst = new ActionListener ()      {     
    public void       actionPerformed       (ActionEvent e)       {       
    int nRow = m_table.getSelectedRow();          
    if (nRow  < 0)           
    JOptionPane.showMessageDialog( null,  "Please select a row to delete",  "Error", JOptionPane.ERROR_MESSAGE);          
    else if (JOptionPane.showConfirmDialog(null, "Do you want to delete the selected row?", "Delete a Row", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
    m_table.getCellEditor().stopCellEditing();   
    if (m_data.delete (nRow))           {          
         m_table.tableChanged            (new TableModelEvent             (m_data, nRow, nRow,              TableModelEvent.ALL_COLUMNS,              TableModelEvent.DELETE));          //m_table.clearSelection();       
       };

  • Udo matrix rows saving problem

    Hi,
    i am creating a form by using UDO form generator.
    in that documet and doucument rows are existed. if user select the combobox value from the form, by taking that value and i am generating a query, i am generating a recordset. by using Userdatasources i am binding each column in matrix.
    i binded all values to the matrix successfully. but
    but when i press Add button, this matrix rows are not getting saved. and also if i have two rows, when i press add, in database only one row is adding with NULL values. how to save that matrix data?
    i am sending my code here. plz help me
    ds = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    ds.DoQuery("select a.code as Code,b.Itemname as Desc1,a.quantity as Quantity from itt1 a,oitm b where a.code=b.Itemcode and a.code=' " & oComboBox.Selected.Value & ' "")
    'User datasources creation
    oForm = SBO_Application.Forms.Item("TBL_JOBWORK_")
    oUserDataSource = oForm.DataSources.UserDataSources.Add("dsItemcode", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
    oUserDataSource = oForm.DataSources.UserDataSources.Add("dsItemdesc", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
    oUserDataSource = oForm.DataSources.UserDataSources.Add("dsQuantity", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
    ds.MoveFirst()
    oForm = SBO_Application.Forms.Item("TBL_JOBWORK_")
    oItem = oForm.Items.Item("mtx_0")
    oMatrix = oItem.Specific
    oColumns = oMatrix.Columns
    Dim oColumn1 As SAPbouiCOM.Column
    Dim oColumn2 As SAPbouiCOM.Column
    Dim oColumn3 As SAPbouiCOM.Column
    ' Dim oColumn4 As SAPbouiCOM.Column
    oColumn1 = oColumns.Item("col_0")
    oColumn2 = oColumns.Item("col_1")
    oColumn3 = oColumns.Item("col_2")
    ' oColumn3 = oColumns.Item("col_3")
    While Not ds.EoF
    oMatrix.FlushToDataSource()
    oForm.DataSources.UserDataSources.Item("dsItemcode").Value = ds.Fields.Item("Code").Value
    oColumn1.DataBind.SetBound(True, "", "dsItemcode")
    oForm.DataSources.UserDataSources.Item("dsItemdesc").Value = ds.Fields.Item("Desc1").Value
    oColumn2.DataBind.SetBound(True, "", "dsItemdesc")
    oForm.DataSources.UserDataSources.Item("dsquantity").Value = ds.Fields.Item("Quantity").Value
    oColumn3.DataBind.SetBound(True, "", "dsQuantity")
    oMatrix.AddRow()
    ds.MoveNext()
    End While
    plz help me any suggesions. in that. i want to save that matrix data in to tables. plz help me   urgent asap
    regards,
    nagababu.

    Hi,
    UDOs don't save data from UserDataSources (UDS) (and BTW: your code is wrong: you mustn't bind the UDSs to to columns time after time in the loop; that's just wrong). YOu have to handle such data in your code.
    Regards,
    Frank

Maybe you are looking for

  • Reports work in Crystal Server XI, but not in XI Rel 2.

    Hello All. <br><br> We have recently migrated Crystal Reports Server from 11.0 to 11.5 (Release 2). While most of the reports work okay, there are some that generate an error message when we try to run them from Infoview or the Central Management Con

  • How can I input my regular school schedule into iCal?

    I'm a student, and I want to make my regular school schedule appear as a sort of default event in iCal's day view. Is there any way to specify what my schedule is for the week, and have iCal propagate it to the rest of my calendar?

  • IPhoto 9.2 crash after lion update

    iPhoto won't start up after recent update. error message log below, any ideas? Process:         iPhoto [2144] Path:            /Applications/iPhoto.app/Contents/MacOS/iPhoto Identifier:      com.apple.iPhoto Version:         9.2 (9.2) Build Info:    

  • External Hard Drive Fails to Mount

    I have a 1TB external hard drive disk2 below, that fails to mount. I have run Utilities/Disk Utility and completed first aid successfully (verifying and repairing) but I am still unable to Mount the drive. I have also tried mounting the drive from th

  • .app file not installing in Applications folder

    Hi. I have created a package installer using Xcode's PackageMaker. I want to install a .app file into the applications folder, but when i am running installer package, it's showing that the software is installed succesfully. When i checked the applic