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

Similar Messages

  • Set maximum matrix row and column size

    I hope someone can help me with this. Is there any way to set the row and column size of a matrix control? I have not been able to find a solution. The only way I've been able to set the size is by resetting matrix to its previous state if the user inputs a value outside of the bounds I would like to set. This is done in the 'value changed' event case.
    The matrix is large and therefore I cannot increase the size of the control to be the maximum size and then hide the row and column index controls. These have to be displayed.
    Any suggestions or help would be greatly appreciated. Thanks in advance.

    Here's a quick and dirty way.
    Simply hide the index controls and replace them with some fake numeric controls and set the data range accoding to your requirements.
    In the attached example (LV8.0), the fake index controls are limited to 0..2, the array size is 5x5 and the displayed array portion is 3x3. Seems to work fine.
    (Of course you could add a bit more code to set the limits automatically based on the various sizes.)
    You could also make it more fancy and turn the entire thing into an Xcontrol.
    Message Edited by altenbach on 06-06-2007 05:32 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    LimitArrayControl.vi ‏18 KB

  • 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

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

  • 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

  • Hi Expert, Matrix row enable false

    Hi ,
    I Want to enable false matrix row for my some condition.
    If u have any idea share with me.
    thanks in adva.
    Regards
    Rajkumar Gupta

    Hi Rujkumar,
    You need to catch the GotFocus ItemEvent, for the matrix, and in the pVal.BeforeAction, check if the row should be enable or not. If it should not be enabled, you cancel the event (GotFocus) by setting BubbleEvent = False.
    Regards,
    Vítor Vieira

  • Matrix Row Status

    Hi
    I have a UDForm whith a Matrix in it.
    And i need to close the matrix row's as sales order
    are generated for the row data 1 sale order per row
    like for example a sales order when it is pratialy ivoiced
    Can i dataBind the row status to a UDF in a UDT
    some thing like the LineStatus in the RDR1 system table 'Sales Order lines'
    Thanks for any help you can provied
    Pedro Gomes

    If you mean that you want to gray out (disable) a line in a matrix, then I would say that it is not possible. But you can catch events on the matrix and prevent editing of your closed lines (if you forsee a 'state' field in your UDT).
    Maybe you can do something with the grid object, and use the collapselevel to visualize the difference between closed and open lines.
    regards,
    Jurgen

  • Get matrix row data and put it into header field with formatted search ???

    Hi All,
    I ask your help concerning the following:
    On an invoice matrix I want to check all Itemgroup Codes of all items in the rows, if there are some rows' items with ItemGroupcode 101 and some others with anything else, then header field should be Y, otherwise N.
    My main problem is: how do I put a matrix row data to a header data with checking all rows in the matrix?
    A minor problem is that I can't get the formatted search to work on all rows when the formatted search is assigned to the user field in header.
    If I put the formatted search to a row field then the row field is filled with the proper value, but the same query assigned to the user field in header works only on the first row.
    What am I doing wrong?
    SELECT USEDPROD= CASE T0.ItmsGrpCod  WHEN 101 THEN Y ELSE N END FROM .[OITM] T0 WHERE T0.ItemCode = $[$38.1.0]
    (SBO 7.6)
    Any suggestions are welcome.
    Thanks.
    Bálint

    Dear Adele,
    Thanks for the answer. The major one cannot be solved. OK, I'll try to get a workaround.
    However I still do not understand why my query does not work in all selected rows, just in the first row, i.e. if I assign the query to a header field and I'm positioned in the first row it's OK, but when I add a new item to the second row or any of the next rows, the header field is not updated at all.
    Why is that so? Do you have any idea?
    Bálint

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

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

  • Checking status of matrix row

    Greetings All,
    Does anyone know how i can check if a matrix row is enabled or disabled prior to updating the field? I need to know because my add on is throwing an exception stating invalid form item if the matrix row is disabled.
    Any ideas?

    Hi Curtis
    I'm not aware if you can make a row enabled or disabled...never seen it. I know you can make a whole matrix enabled or disabled. Also if you want an extra line in the matrix you add a extra one and that then becomes available. When you say disabled is this when you haven't said you want an extra row and it doesn't allow to add the row details?
    Well, to check if a matrix is enabled you do something like
    Dim item As SAPbouiCOM.Item
    item = oForm.Items.Item("matrixID")
    If item.Enabled = False Then item.Enabled = True
    Then to see how many records are in your matrix use
    oMatrix.RowCount
    It will return the number of records in the matrix. But remeber if its your own matrix you should always add a line omatrix.addrow before specifying the row contents.
    Hope this helps

  • How to reset a row count based on a column value?

    OracleBI Discoverer 10g (10.1.2.3)
    Oracle Business Intelligence Discoverer Plus 10g (10.1.2.55.26)
    I've got a Discoverer Plus report that shows item receipts, receipt dates, and if the receipt was inspected. I've got items that should be inspected every 5th receipt. There's got to be a handy-dandy function I can use to do this, right?
    Item        Receipt Date      Inspected         
    Bracket     1/1/2009               Y
    Bracket     2/1/2009               N
    Bracket     3/1/2009               N
    Bracket     4/1/2009               Y <--let's assume someone didn't follow the instructions
    Bracket     5/1/2009               N
    Bracket     6/1/2009               N
    Bracket     7/1/2009               N
    Bracket     8/1/2009               N
    Bracket     9/1/2009     I'm looking to count the receipts and reset the counter when Inspected = Y
    Item        Receipt Date      Inspected     Inspect_Count       
    Bracket     1/1/2009               Y                  0
    Bracket     2/1/2009               N                  1
    Bracket     3/1/2009               N                  2
    Bracket     4/1/2009               Y                  0
    Bracket     5/1/2009               N                  1
    Bracket     6/1/2009               N                  2
    Bracket     7/1/2009               N                  3
    Bracket     8/1/2009               N                  4
    Bracket     9/1/2009                                  5 <-- receiver should inspect on this receipt I'm open to other methods if mine seems like a dud.
    -Tracy

    Hi,
    You can use this query for achieve your requierment in your view or you can include in your etl .
    REgards salim.
    SELECT item, receipt_date, inspected
      FROM table_inspect;
    ITEM    RECEIPT_DA INSPECTED                    
    Bracket 01/01/2009 Y                            
    Bracket 02/01/2009 N                            
    Bracket 03/01/2009 N                            
    Bracket 04/01/2009 Y                            
    Bracket 05/01/2009 N                            
    Bracket 06/01/2009 N                            
    Bracket 07/01/2009 N                            
    Bracket 08/01/2009 N                            
    Bracket 09/01/2009                              
    9 rows selected.Solution
    SELECT item,receipt_date,inspected,inspect_count
    from table_inspect
    model
    partition by (item)
    dimension by( row_number()over(partition by item order by receipt_date) rn)
    measures(receipt_date,inspected,0 Inspect_Count )ignore nav
    (Inspect_Count[rn]= case when inspected[cv()]='Y' then 0 else Inspect_Count[cv()-1]+1 end)
    order by receipt_date;
    ITEM    RECEIPT_DA INSPECTED  INSPECT_COUNT
    Bracket 01/01/2009 Y                      0
    Bracket 02/01/2009 N                      1
    Bracket 03/01/2009 N                      2
    Bracket 04/01/2009 Y                      0
    Bracket 05/01/2009 N                      1
    Bracket 06/01/2009 N                      2
    Bracket 07/01/2009 N                      3
    Bracket 08/01/2009 N                      4
    Bracket 09/01/2009                        5
    9 rows selected.Edited by: Salim Chelabi on 2010-03-03 07:49

  • How to calculate a percentage in a Matrix row SSRS

    HI All,
    I have the following data in a SSRS Matrix. I want the data to reflect as 'B' but I constantly get data reflected as a total.(C)
    I need the percentage per row and not the whole total value.
    this is my expression =count(Fields!Rejection_Reason.Value)/sum(Fields!ClaimCount.Value, "DataSet1")
    A
    Dealer
    Total Sold
              VW
              Mercrcedez
            Honda
    Dealer1
    10
    2
    5
    3
    Dealer2
    20
    5
    10
    5
    Dealer3
    30
    10
    5
    15
    B
    Dealer
    Total Sold
    VW
    Mercedez
    Honda
    Dealer1
    10
    20.00%
    50.00%
    30.00%
    Dealer2
    20
    25.00%
    50.00%
    25.00%
    Dealer3
    30
    33.33%
    16.67%
    50.00%
    C
    Dealer
    Total Sold
    VW
    Mercedez
    Honda
    Dealer1
    10
    3.33%
    8.33%
    5.00%
    Dealer2
    20
    8.33%
    16.67%
    8.33%
    Dealer3
    30
    16.67%
    8.33%
    25.00%
    60
    Thank you for your help.

    Hi Andrevw23,
    Just as michlimes suggested, we should sum the value of ClaimCount field in the Dealer group region, other than the dataset. Because the sum function sum all non-null numeric values in the specified scope. So in your scenario, we can try to use the function
    below to achieve your requirement (“Dealer” means the name of Dealer group):
    =count(Fields!Rejection_Reason.Value)/sum(Fields!ClaimCount.Value, "Dealer")
    If you have any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Matrix row grand total, column grand total

    matrix report layout in sql 2008
    report shows     column a   column b    column c    total
              row 1           4              5             
    8             17
              row 2           3              5             
    2             10
              row 3           2              7             
    6             15
    total                      9              17           
    16      grand total column 42
    grand total row 42
    How do I define the grand total cells to use column totals or row totals?  Not just the sum of field in dataset?
    Accounting wants justification that column totals add up to row totals.

    Hi JimHoopsDSC,
    Based on my understanding, you want to show grand total columns and grand total rows in the report.
    For your requirement, you can create a matrix and add total for row groups and column groups. Then you can add an additional row and populate the total value. Please refer to screenshots below:
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Matrix row focus

    Hey All,
    Can anyone tell me how I can set the focus of my matrix to the most recent row that was added to my UDO? I have a UDO that could have a few hundred line items and I want to move the screen to the most recent line item so that the user does not have to scroll all the way every time they open the record?
    If this is not possible does anyone know how I can reverse the order of the line items in the matrix based on the docentry or date or something like that?

    > Can anyone tell me how I can set the focus of my
    > matrix to the most recent row that was added to my
    > UDO? I have a UDO that could have a few hundred line
    > items and I want to move the screen to the most
    > recent line item so that the user does not have to
    > scroll all the way every time they open the record?
    This should do it:
    oMatrix.Columns.Item("colUid").Cells.Cell.Item(rowIndex).Click(BoCellClickType.ct_Regular,0)
    If you can't get it working for a normal cell, do it for the rowsheader and set the matrix so rows can be selected (BoMatrixSelect.Single)
    > If this is not possible does anyone know how I can
    > reverse the order of the line items in the matrix
    > based on the docentry or date or something like that?
    Can't be done... sorry... Matrix sorting is (still) not supported... Rumors is that it will be supported from SBO2006A (But it was also a rumor for SBO2005A )

Maybe you are looking for

  • Vendor master data file structure

    Hello Guys, I want to knw the flat file strucute of vendor master data (specially vendor with multiple banks) pls let me knw tht thnks sunny

  • SYNC Key

    To whom it may concern, I'm currently trying to log in to the Firefox Sync and according to your systems, this SYNC Key is not a good key. The left side of your screen is the saved copy of the Key when I have re-created one. Please verify the server

  • Clearing documents with no document currency

    Have a balance on a acct that is to be written off.   Balance only appears on acct as when document currencies is *.  When creating GL entry to clear acct we end up with a balance on the acct in whatever currency was used in the clearing document. Th

  • Validate XML and ignore the errors

    Hi All- I am using validateXML as the property on file adapter, It fails the whole file if it is not valid against schema even if one record is wrong. Is it possible that I can use the rejection handler which will trap errors against the schema valid

  • SALES ORDER CAN NOT BE LESSER THEN POSTING DATE

    Hi everyone Can any one tell how can I restrict sales delivery date less then posting date. Like if user create a sales order on 22,03.14 then delivery date should not be before 22.03.14. I saw in system if I enter sales delivery date before 22.03.14