AddChooseFromList in Matrix

With this code, I create a textbox with search option. But how to do this for all the lines of a column of the Matrix? I want to be able to do this research study in each row of the matrix, Naque column.
        SAPbouiCOM.EditText oEdit = null;
        SAPbouiCOM.FormCreationParams oCP = null;
        oCP = ((SAPbouiCOM.FormCreationParams)   
       (SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)));
        oCP.UniqueID = "CFL1";
        oCP.FormType = "CFL1";
        oCP.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable;
        oForm.DataSources.UserDataSources.Add("EditDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254);
        AddChooseFromList();
        //  Adding a text box
        oItem = oForm.Items.Add("EditTxt", SAPbouiCOM.BoFormItemTypes.it_EDIT);
        oItem.Left = 147;
        oItem.Top = 170;
        oItem.LinkTo = "StaticTxt";
        oEdit = ((SAPbouiCOM.EditText)(oItem.Specific));
        oEdit.DataBind.SetBound(true, "", "EditDS");
        oEdit.ChooseFromListUID = "CFL1";
        oEdit.ChooseFromListAlias = "ItemName";

Hy Harley,
I try to explain better.
Excuse me for my English.
Correct me if I made a mistake.
You want add a ChooseFromList to a Matrix Column. Right?
You also know how create a ChooseFromList. Right? There are another thread owened by you where you learn it. See in the code inside your AddChooseFromList() method.
So the steps are the following:
1) In the form you need to add a Matrix, not an EditText like the first snippet you post.
1.a) with the reference to the form oForm, access to the ItemsCollection oForm.Items and use the method .Add() in order to add the Matrix. This is shown on the first part of my snippet.
oItem = (SAPbouiCOM.Item)(oForm.Items.Add("MTX01", SAPbouiCOM.BoFormItemTypes.it_MATRIX));
oMatrix = (SAPbouiCOM.Matrix)(oItem.Specific);
2) You need to add some columns to the matrix. For example you should add the CardCode, the CardName and other information
oColumn = oMatrix.Columns.Add("CCODE", SAPbouiCOM.BoFormItemTypes.it_EDIT);
oColumn = oMatrix.Columns.Add("CNAME", SAPbouiCOM.BoFormItemTypes.it_EDIT);
2.a) So you have said: "Add two columns of Edit elements and call this columns respectively CCODE and CNAME"
3) Now you need to attach the ChooseFromList you made,  to your column (In SAP B1 you can't attach a ChooseFromList to a single cell so we can dispel you initial doubt).
3.a) Suppose you made two ChooseFromList named CFL01 and CFL02 for the Business Partner. (I suppose they were made in your AddChooseFromList() method), so we need to add just two rows of code for each matrix column.
// THE CODE WE SEEN BEFORE
oColumn = oMatrix.Columns.Add("CCODE", SAPbouiCOM.BoFormItemTypes.it_EDIT);
// THE CODE TO ATTACH THE CHOOSEFROMLIST
oColumn.ChooseFromListUID = "CFL01"; // The unique identifier of the ChooseFromList you want attach to the column
oColumn.ChooseFromListAlias = "CardCode";
// THE CODE WE SEEN BEFORE
oColumn = oMatrix.Columns.Add("CNAME", SAPbouiCOM.BoFormItemTypes.it_EDIT);
// THE CODE TO ATTACH THE CHOOSEFROMLIST
oColumn.ChooseFromListUID = "CFL02";
oColumn.ChooseFromListAlias = "CardName";
There are no difference between creation of ChooseFromList for and EditText and a ChooseFromList for a Column in a Matrix.
In your first snippet the Matrix doesn't appear, the columns didn't appears.
Then in your Item Event Handler, you need only to refers to the cell instead of the EditText.
I think to have give you the necessary code to understand the process and I hope to have well explained it to you. There are also an example on the .chm help files. Please search for the Column object and observe it's Methods and Properties.
In the case my explaination is not clear please excuse me but probably I have not well understand your real difficult.
Hope this helps.
Regards
Carmine
Edited by: Carmine Cairo on Aug 11, 2011 7:34 PM

Similar Messages

  • Add a new  column in a baseform

    Dear All,
    How do I add a new   matrix column in a baseform for a particular panel .
    kindly suggest me the code.
    Edited by: Sanjoy Paul on Jul 3, 2008 1:33 PM

    Hi Sanjoy,
    This is an example that i'm use to add a matrix and some items into a panel in the Item master data form :
                                    SAPbouiCOM.Item oItem;
                                    SAPbouiCOM.Folder oFolder;
                                    oItem = (SAPbouiCOM.Item)oForm.Items.Add("BULL", SAPbouiCOM.BoFormItemTypes.it_FOLDER);
                                    oItem.Left = 535;
                                    oItem.Width = 67;
                                    oItem.Top = 128;
                                    oItem.Height = 21;
                                    oItem.Visible = true;
                                    oItem.Enabled = true;
                                    oItem.AffectsFormMode = false;
                                    oFolder = (SAPbouiCOM.Folder)oItem.Specific;
                                    oFolder.Caption = "Folder";
                                    oFolder.ValOff = "0";
                                    oFolder.ValOn = "8";
                                    oFolder.DataBind.SetBound(true, "", "IFCFolder");
                                    oFolder.GroupWith("9");
    Création du label "Bulletin répartition" -
                                    oItem = oForm.Items.Add("LAB1", SAPbouiCOM.BoFormItemTypes.it_STATIC);
                                    oItem.Left = 17;
                                    oItem.Height = 19;
                                    oItem.Top = 167;
                                    oItem.Width = 100;
                                    oItem.FromPane = 8;
                                    oItem.ToPane = 8;
                                    oItem.AffectsFormMode = false;
                                    SAPbouiCOM.StaticText oStaticText;
                                    oStaticText = (SAPbouiCOM.StaticText)oItem.Specific;
                                    oStaticText.Caption = "Bulletin répartition";
    Création du label "Total représentation" -
                                    oItem = oForm.Items.Add("LAB2", SAPbouiCOM.BoFormItemTypes.it_STATIC);
                                    oItem.Left = 17;
                                    oItem.Height = 14;
                                    oItem.Top = 335;
                                    oItem.Width = 100;
                                    oItem.FromPane = 8;
                                    oItem.ToPane = 8;
                                    oItem.AffectsFormMode = false;
                                    oStaticText = (SAPbouiCOM.StaticText)oItem.Specific;
                                    oStaticText.Caption = "Total représentation :";
    Création du champ "Total représentation" -
                                    oItem = oForm.Items.Add("EDI1", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oItem.Left = 120;
                                    oItem.Height = 14;
                                    oItem.Top = 335;
                                    oItem.Width = 100;
                                    oItem.FromPane = 8;
                                    oItem.ToPane = 8;
                                    oItem.AffectsFormMode = false;
                                    //oItem.Enabled = false;
                                    SAPbouiCOM.EditText oEdit;
                                    oEdit = (SAPbouiCOM.EditText)oItem.Specific;
                                    oEdit.DataBind.SetBound(true, "", "IFCEDI1");
    Création du label "Total Publication" -
                                    oItem = oForm.Items.Add("LAB3", SAPbouiCOM.BoFormItemTypes.it_STATIC);
                                    oItem.Left = 17;
                                    oItem.Height = 14;
                                    oItem.Top = 350;
                                    oItem.Width = 100;
                                    oItem.FromPane = 8;
                                    oItem.ToPane = 8;
                                    oItem.AffectsFormMode = false;
                                    oStaticText = (SAPbouiCOM.StaticText)oItem.Specific;
                                    oStaticText.Caption = "Total part :";
    Création du champ "Total Publication" -
                                    oItem = oForm.Items.Add("EDI2", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oItem.Left = 120;
                                    oItem.Height = 14;
                                    oItem.Top = 350;
                                    oItem.Width = 100;
                                    oItem.FromPane = 8;
                                    oItem.ToPane = 8;
                                    //oItem.Enabled = false;
                                    oItem.AffectsFormMode = false;
                                    oEdit = (SAPbouiCOM.EditText)oItem.Specific;
                                    oEdit.DataBind.SetBound(true, "", "IFCEDI2");
                                    AddChooseFromList(oForm);
    Matrix Create----
                                    oItem = oForm.Items.Add("MAT_BR", SAPbouiCOM.BoFormItemTypes.it_MATRIX);
                                    oItem.Left = 17;
                                    oItem.Top = 187;
                                    oItem.Width = 500;
                                    oItem.Height = 150;
                                    oItem.FromPane = 8;
                                    oItem.ToPane = 8;
                                    oItem.AffectsFormMode = false;
                                    SAPbouiCOM.Matrix oMatrix;
                                    SAPbouiCOM.Columns oColumns;
                                    SAPbouiCOM.Column oColumn;
                                    oMatrix = (SAPbouiCOM.Matrix)oItem.Specific;
                                    oColumns = oMatrix.Columns;
                                    oColumn = oColumns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "#";
                                    oColumn.Editable = false;
                                    oColumn = oColumns.Add("V_11", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "Nom";
                                    oColumn.Width = 60;
                                    //oColumn.DataBind.SetBound(true, "@IFC_BR", "U_IFC_NO");
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_NO");
                                    oColumn.Visible = false;
                                    oColumn = oColumns.Add("V_10", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "Nom";
                                    oColumn.Width = 60;
                                    //oColumn.DataBind.SetBound(true, "", "IFCEDI4");
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_NOM");
                                    oColumn.ChooseFromListUID = "IFC_CFL";
                                    oColumn.ChooseFromListAlias = "CardName";
                                    oColumn = oColumns.Add("V_2", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX);
                                    oColumn.TitleObject.Caption = "Fonction";
                                    oColumn.Width = 60;
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_FO");
                                    oColumn.ValidValues.Add("", "");
                                    oColumn.ValidValues.Add("AU", "Auteur");
                                    oColumn.ValidValues.Add("TR", "Traducteur");
                                    oColumn.ValidValues.Add("CO", "Compositeur");
                                    oColumn.ValidValues.Add("ED", "Editeur");
                                    oColumn.DisplayDesc = true;
                                    oColumn = oColumns.Add("V_3", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "Représentation";
                                    oColumn.Width = 60;
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_RE");
                                    oColumn = oColumns.Add("V_4", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "% Aut / Trad";
                                    oColumn.Width = 60;
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_PO");
                                    oColumn = oColumns.Add("V_8", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "Publication";
                                    oColumn.Width = 60;
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_PU");
                                    oColumn.Editable = false;
                                    oColumn = oColumns.Add("V_6", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX);
                                    oColumn.TitleObject.Caption = "";
                                    oColumn.Width = 15;
                                    oColumn.RightJustified = false;
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_TMP");
                                    oColumn.Editable = true;
                                    oColumn = oColumns.Add("V_5", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "Part";
                                    oColumn.Width = 60;
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_PA");
                                    oColumn = oColumns.Add("V_7", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "Observations";
                                    oColumn.Width = 100;
                                    oColumn.DataBind.Bind("@IFC_BR", "U_IFC_OB");
                                    oColumn = oColumns.Add("V_9", SAPbouiCOM.BoFormItemTypes.it_EDIT);
                                    oColumn.TitleObject.Caption = "";
                                    oColumn.Width = 60;
                                    oColumn.DataBind.Bind("@IFC_BR", "Code");
                                    oColumn.Visible = false;
                                    oMatrix.LoadFromDataSource();
                                    if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_FIND_MODE)
                                        oMatrix.AddRow(1, 1);
                                    else if (oForm.Mode == SAPbouiCOM.BoFormMode.fm_OK_MODE)
                                        oMatrix.AddRow(1, 0);
    Hope it's help you
    Michael

  • Populating a matrix cell with data selected from a picker

    Dear All,
    I am new to SAP Bussiness one, please let me know how to get the selected data from a picker in to a matrix cell. I have warehouse code and warehouse name in the picker. I want the user selected warehouse code in the matrix cell
    Below is my code But I am not getting the selected code in the matrix cell
    I am adding the datasource as below
    oUserDataSource = oForm.DataSources.UserDataSources.Add("UDCFL", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)
    Then I am adding the choose  list  as below
    Private Sub AddChooseFromList()
            Try
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                ' Adding 2 CFL, one for the button and one for the edit text.
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "64"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)                
            Catch
                MsgBox(Err.Description)
            End Try
        End Sub
    *Then I am binding the data as below to the matrix column*
    oColumn = oColumns.Item("colToWhs")
            oColumn.DataBind.SetBound(True, "", "UDCFL")
            oColumn.ChooseFromListUID = "CFL1"
    Then in the event i have added the  below code.
                        Dim oDataTable As SAPbouiCOM.DataTable
                        oDataTable = oCFLEvento.SelectedObjects
                        Dim val As String
                        Try
                            val = oDataTable.GetValue(0, 0)
                        Catch ex As Exception
                        End Try
                        oForm.DataSources.UserDataSources.Item("UDCFL").Value = val
                       End If
    But the code is not getting populated in the matrix cell. Please let me know at the earliest
    Thanx in Advance

    sOLVED

  • How to fill matrix with the output of recordset query?

    Hi all,
    I want a user matrix to load data when I hit a button and the data to be filled is the output of an sql query. binding the matrix columns with table columns and then load the matrix with DBDatasource attached to that table will not do in this case as the columns in the sql query are from several different tables or views. 
    writing following line to do this takes several minutes to load the data:
    For j = 0 To Reordset.RecordCount - 1
    Matrix.AddRow()
    Matrix.Columns.Item("col1").Cells.Item(i).Specific.value =  Recordset.Fields.Item("cardcode").Value
    Recordset.movenext()
    next
    Is there any other way to fill the matrix in this case, which loads the data faster?
    Regards,

    Hello Binita,
    I've tested the CFL for DataTable-Matrixes in my test-AddOn. But there's still one problem left. Maybe you find it out (I will need this in the future too...).
    The ChooseFromList must be added behind the DataTable-Bind, which is done on every MTX-Load (it's not from the sample above, so the UIDs are new ones):
                oDt = oDts.Item("dt_test")
                query = "SELECT  * FROM [@T_CONVTOOLS01]"
                oDt.ExecuteQuery(query)
                oMtx.Columns.Item("0").DataBind.Bind("dt_test", "Code")
                oMtx.Columns.Item("1").DataBind.Bind("dt_test", "U_Alpha01")
                oMtx.Columns.Item("2").DataBind.Bind("dt_test", "U_Price01")
                oMtx.Columns.Item("3").DataBind.Bind("dt_test", "U_Quant01")
                oMtx.Columns.Item("4").DataBind.Bind("dt_test", "U_Date01")
                AddChooseFromLists()
                oMtx.LoadFromDataSource()
    ...where AddChooseFromLists() is...
      Private Shared Sub AddChooseFromLists()
            Try
                Dim oCfls As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                Dim oCfl As SAPbouiCOM.ChooseFromList
                Dim oCflCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                Dim oBtn As SAPbouiCOM.Button
                Dim oMtx As SAPbouiCOM.Matrix
                Dim oCol As SAPbouiCOM.Column
                Dim oEtx As SAPbouiCOM.EditText
                oMtx = oForm.Items.Item("MTX_TEST02").Specific
                oCfls = oForm.ChooseFromLists
                oCflCreationParams = SboCon.SboUI.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCflCreationParams.MultiSelection = False
                oCflCreationParams.ObjectType = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner
                oCflCreationParams.UniqueID = "CFL_C1"
                oCfl = oCfls.Add(oCflCreationParams)
                '### OPTION:
                '# Shown ChooseFromList restricted by Conditions
                oCons = oCfl.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
                oCfl.SetConditions(oCons)
                oCol = oMtx.Columns.Item("1")
                oCol.ChooseFromListUID = "CFL_C1"
                oCol.ChooseFromListAlias = "CardCode"
            Catch e As Exception
                Microsoft.VisualBasic.MsgBox(className & ".AddChooseFromLists()" & vbCrLf & "Exception:" & vbCrLf & e.Message.ToString)
            End Try
        End Sub
    But I'm running into problems when trying to set the MTX-Cell via DataTable at the CFL-Event (see comment):
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                    Dim oMtx As SAPbouiCOM.Matrix
                    Dim oCFLEvent As SAPbouiCOM.IChooseFromListEvent
                    Dim oCFL As SAPbouiCOM.ChooseFromList
                    Dim oDataTable As SAPbouiCOM.DataTable
                    Dim cflID As String
                    Dim oDt As SAPbouiCOM.DataTable = oForm.DataSources.DataTables.Item("dt_test")
                    oCFLEvent = pVal
                    cflID = oCFLEvent.ChooseFromListUID
                    'Dim oForm As SAPbouiCOM.Form
                    'oForm = SboConnection.SboUI.Forms.Item(FormUID)
                    oCFL = oForm.ChooseFromLists.Item(cflID)
                    If Not oCFLEvent.BeforeAction Then
                        oDataTable = oCFLEvent.SelectedObjects
                        If oDataTable Is Nothing Then Exit Sub
                        '############## Matrix Test #######################################################################
                        If (oCFLEvent.ItemUID = "MTX_TEST02") Then
                            oMtx = oForm.Items.Item("MTX_TEST02").Specific
                            '### CFL Results to UserForm
                            oDt.Rows.Offset = oCFLEvent.Row - 1
                            MsgBox(oDt.GetValue("U_Alpha01", oCFLEvent.Row - 1))
                            MsgBox(oDataTable.GetValue("CardCode", 0))
                            ' PROBLEM - can't get this working - don't know at the moment:
                            ' on other forms SetValue works....
                            oDt.SetValue("U_Alpha01", oCFLEvent.Row - 1, oDataTable.GetValue("CardCode", 0))
                            ' this also gives me problems...:
                            'oMtx.Columns.Item("1").Cells.Item(oCFLEvent.Row).Specific.value = oDataTable.GetValue("CardCode", 0)
                            oForm.Update()
                        End If
                    End If
                End If
    The CFL-Form opens and returns the choosen value(s) at the CFL-event. But writing to MTX still not works with this code...
    Maybe you find the last piece. If so: please write here.
    Cheers,
    Roland
    p.s.:
    David Nussböck wrote
    LOL - ROLAND WAS FASTER ))
    ...just one minute...

  • Filtering CFL on Matrix

    Hi to all,
    How can i filter the System CFL which is in Matrix Column. I have filtered the System CFL in Form but unable to do in CFL of Matrix.
    What i am trying to do is Filtering The Project Code CFL in A/R Invoice
    Here is the code i have
    if (pVal.FormTypeEx == "133" & pVal.ColUID == "4")
                        if (pVal.InnerEvent & pVal.Before_Action)
                            BubbleEvent = false;
                            SAPbouiCOM.Form oForm;
                            SAPbouiCOM.Column oColumn;
                            SAPbouiCOM.ChooseFromList oCFL = null;
                            SAPbouiCOM.Conditions oCons = null;
                            try
                                oForm = SboApplication.Forms.Item(pVal.FormUID);
                                oCFL = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item("26");
                                //AddChooseFromList();
                                oCons = oCFL.GetConditions();
                                if (oCons.Count == 0)
                                    SAPbouiCOM.Condition oCon = null;
                                    oCon = oCons.Add();
                                    oCon.Alias = "PrjCode";
                                    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
                                    oCon.CondVal = "000021";
                                    oCFL.SetConditions(oCons);
                                BubbleEvent = true;
                            catch (Exception ex)
    with regards
    Bikram

    hi maskey,
    thanks for your reply, i have got the solution, the problem is due to the use same object in two different fields. i got the solutions.
    regards
    Bikram

  • Matrix with cfl

    hi friends,
                     i have created program which is matrix with clf. inthat program i have created 7 coloumns values as employee id, firstname,floor,desg,time,extrahour,otallowance. here i have created cfl in employee id column. when i press tab button in employee id the values like employee id,firstname,floor,desg should store in appropriate column. plz tell me how can i do that? can u tell me whats the coding?

    hi
    here is the complete coding .. it is working for me...
    Public Class Class1
        Public WithEvents SBO_Application As SAPbouiCOM.Application
        Dim oform As SAPbouiCOM.Form
        Dim oitem As SAPbouiCOM.Item
        Dim oedit, oedit1 As SAPbouiCOM.EditText
        Dim ocompany As SAPbobsCOM.Company
        Dim olinked As SAPbouiCOM.LinkedButton
        Public Sub SetApplication()
            Dim SboGuiApi As SAPbouiCOM.SboGuiApi = New SAPbouiCOM.SboGuiApi
            Dim sConnectionString As String
            sConnectionString = Environment.GetCommandLineArgs.GetValue(1)
            SboGuiApi.Connect(sConnectionString)
            SBO_Application = SboGuiApi.GetApplication()
        End Sub
        Private Function SetConnectionContext() As Short
            Dim sCookie As String
            Dim sConnectionContext As String
            ocompany = New SAPbobsCOM.Company
            sCookie = ocompany.GetContextCookie
            sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie)
            If ocompany.Connected = True Then
                ocompany.Disconnect()
            End If
            SetConnectionContext = ocompany.SetSboLoginContext(sConnectionContext)
        End Function
        Public Sub LoadFromXML(ByRef FileName As String)
            Dim oXmlDoc As Xml.XmlDocument
            oXmlDoc = New Xml.XmlDocument
            Dim sPath As String
            sPath = IO.Directory.GetParent(Application.StartupPath).ToString
            oXmlDoc.Load(sPath & "\" & FileName)
            SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)
        End Sub
        Private Function ConnectToCompany() As Short
            ConnectToCompany = ocompany.Connect
        End Function
        Public Sub con()
            If Not SetConnectionContext() = 0 Then
                SBO_Application.StatusBar.SetText("Connection Failed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                End
            End If
            If Not ConnectToCompany() = 0 Then
                SBO_Application.StatusBar.SetText("Connection Failed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                End
            End If
        End Sub
        Public Sub New()
            MyBase.New()
            SetApplication()
            con()
            LoadFromXML("manoj.srf")
            oform = SBO_Application.Forms.Item("sbo")
            oform.Visible = True
            AddChooseFromList()
            oedit = oform.Items.Item("t1").Specific
            oedit.DataBind.SetBound(True, "@INDIAN", "U_Name")
            oedit.ChooseFromListUID = "CFL1"
            oedit.ChooseFromListAlias = "DocNum"
            oitem = oform.Items.Item("l1")
            olinked = oitem.Specific
            olinked.LinkedObjectType = SAPbouiCOM.BoLinkedObject.lf_Order
        End Sub
        Public Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            If pVal.ItemUID = "t1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                oCFLEvento = pVal
                Dim sCFL_ID As String
                sCFL_ID = oCFLEvento.ChooseFromListUID
                Dim oForm As SAPbouiCOM.Form
                oForm = SBO_Application.Forms.Item(FormUID)
                Dim oCFL As SAPbouiCOM.ChooseFromList
                oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
                If oCFLEvento.BeforeAction = False Then
                    Dim oDataTable As SAPbouiCOM.DataTable
                    oDataTable = oCFLEvento.SelectedObjects
                    Dim val As String
                    If pVal.ItemUID = "t1" Then
                        Try
                            oitem = oForm.Items.Item("t1")
                            oedit = oitem.Specific
                            val = oDataTable.GetValue("DocNum", 0)
                            oedit.Value = val
                        Catch ex As Exception
                        End Try
                    End If
                End If
            End If
        End Sub
        Private Sub AddChooseFromList()
            Try
                Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
                oCFLs = oForm.ChooseFromLists
                Dim oCFL As SAPbouiCOM.ChooseFromList
                Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCFLCreationParams.MultiSelection = False
                oCFLCreationParams.ObjectType = "17"
                oCFLCreationParams.UniqueID = "CFL1"
                oCFL = oCFLs.Add(oCFLCreationParams)
            Catch
                MsgBox(Err.Description)
            End Try
        End Sub
    End Class

  • Cfl for matrix

    hi friends
    i had created a form with a matrix and an editbox. i can apply the cfl for the editbox but i cant use the same for the first column of the  matrix...can anyone provide any sample coding for this process
    thanks and regards
    manoj nagaraj

    Hi
    Look this. I think this code is complete.
    Best regards
    Sierdna S.
    Public Sub SBO_CreateForm(...)
    '... add controls to form, matrix, matrix columns,...
      Call AddChooseFromList(oForm)
      oForm.Visible = True
    End Sub
    Private Sub AddChooseFromList(ByRef oForm As SAPbouiCOM.Form)
      Try
        Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
        Dim oCons As SAPbouiCOM.Conditions
        Dim oCon As SAPbouiCOM.Condition
        oCFLs = oForm.ChooseFromLists
        Dim oCFL As SAPbouiCOM.ChooseFromList
        Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
        oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
        ' CFL for Items ------------------------------
        oCFLCreationParams.MultiSelection = False
        oCFLCreationParams.ObjectType = 4
        ' Item Code
        oCFLCreationParams.UniqueID = "cflIC"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        ' Item Name
        oCFLCreationParams.UniqueID = "cflIN"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        ' CFL button
        oCFLCreationParams.UniqueID = "cflIB"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        Catch ex As Exception
          ' log exception
        Finally
          System.GC.Collect() 'Release the handle to the table
        End Try
    End Function
    Public Sub ManageItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean)
      Dim oForm As SAPbouiCOM.Form
      oForm = SBO_Application.Forms.Item(FormUID)
      Select Case pVal.EventType
        Case BoEventTypes.et_CHOOSE_FROM_LIST
          If Not pVal.BeforeAction Then
         Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
         oCFLEvento = pVal
         Dim sCFL_ID As String
         sCFL_ID = oCFLEvento.ChooseFromListUID
         Dim oCFL As SAPbouiCOM.ChooseFromList
         oCFL = oForm.ChooseFromLists.Item(sCFL_ID)
         Dim oDataTable As SAPbouiCOM.DataTable
         oDataTable = oCFLEvento.SelectedObjects
         Dim sCode As String = ""
         Dim sName As String = ""
         Try
           sCode = oDataTable.GetValue(0, 0) ' Code
           sName = oDataTable.GetValue(1, 0) ' Name
         Catch ex As Exception
           sCode = ""
           sName = ""
           ' log exception
         End Try
         ' Rows
         If (pVal.ColUID = "colICode") Or (pVal.ColUID = "colIName") Then
           oForm.DataSources.DBDataSources.Item("@USER_TABLE").SetValue("U_ItemCode", pVal.Row, sCode)
           oForm.DataSources.DBDataSources.Item("@USER_TABLE").SetValue("U_ItemName", pVal.Row, sName)
           Call UpdateCells(oForm, pVal.Row, sCode, sName)
         End If
          End If
      End Select
      oForm = Nothing
    End Sub
    Private Function UpdateCells(ByRef oForm As SAPbouiCOM.Form, ByVal iRow As Integer, _
                        ByVal sCode As String, ByVal sName As String) As Boolean
      Dim b As Boolean = True
      Try
        Dim oMatrix As SAPbouiCOM.Matrix
        Dim oColumn As SAPbouiCOM.Column
        Dim oCell As SAPbouiCOM.Cell
        Dim oEdit As SAPbouiCOM.EditText
        ' MatrixID
        oMatrix = oForm.Items.Item(MatrixID).Specific
        oColumn = oMatrix.Columns.Item("colICode")
        oCell = oColumn.Cells.Item(iRow)
        oEdit = oCell.Specific
        oEdit.String = sCode
        oColumn = Nothing
        oCell = Nothing
        oEdit = Nothing
        oColumn = oMatrix.Columns.Item("colIName")
        oCell = oColumn.Cells.Item(iRow)
        oEdit = oCell.Specific
        oEdit.String = sName
        oColumn = Nothing
        oCell = Nothing
        oEdit = Nothing
        oMatrix = Nothing
      Catch ex As Exception
        b = False
        ' log exception
      Finally
        System.GC.Collect() 'Release the handle to the table  
      End Try
      Return b
    End Function

  • Can i create a matrix

    hi friends
    i have a doubt . can i create two cfl in the same form? if so how?
    thanks and regards
    Manoj Nagaraj

    Hi,
    Yes, you can create more CFLs with own UniqueID on the same form.
    In manage item event handler you can filter by uid of CFL.
    An example of CFLs on Clients Orders form:
    <ChooseFromListCollection>
      <action type="add">
        <ChooseFromList UniqueID="-1" ObjectType="17" MultiSelection="0" IsSystem="1" />
        <ChooseFromList UniqueID="1" ObjectType="73" MultiSelection="0" IsSystem="1" />
        <ChooseFromList UniqueID="10" ObjectType="1" MultiSelection="0" IsSystem="1" />
        <ChooseFromList UniqueID="11" ObjectType="1" MultiSelection="0" IsSystem="1" />
        <ChooseFromList UniqueID="12" ObjectType="17" MultiSelection="0" IsSystem="1" />
      </action>
    </ChooseFromListCollection>
    It is possible to find many examples by searching on SDK forum for words "CFL" or "ChooseFromList".
    When you create form call this function to add cfls
    Private Function AddChooseFromList(ByRef oForm As SAPbouiCOM.Form) As Boolean
      Dim b As Boolean = True
      Try
        Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
        Dim oCons As SAPbouiCOM.Conditions
        Dim oCon As SAPbouiCOM.Condition
        oCFLs = oForm.ChooseFromLists
        Dim oCFL As SAPbouiCOM.ChooseFromList
        Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
        oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
        ' Agent CFL
        oCFLCreationParams.MultiSelection = False
        oCFLCreationParams.ObjectType = 53
        ' Agent Code
        oCFLCreationParams.UniqueID = "cflACode"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        ' Agent Name
        oCFLCreationParams.UniqueID = "cflAName"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        ' Agent: Button CFL
        oCFLCreationParams.UniqueID = "cflAButt"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        ' Business Partner CFL
        oCFLCreationParams.MultiSelection = False
        oCFLCreationParams.ObjectType = 2
        ' BP Code
        oCFLCreationParams.UniqueID = "cflBPCode"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        ' BP Name
        oCFLCreationParams.UniqueID = "cflBPName"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        ' BP Button for CFL
        oCFLCreationParams.UniqueID = "cflBPButt"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
      Catch ex As Exception
        b = False
        ' log exception
      Finally
        System.GC.Collect() 'Release the handle to the table
      End Try
      Return b
    End Function
    If you about CFL on matrix... in manage Item event check CFL UniqueID...
    Case BoEventTypes.et_CHOOSE_FROM_LIST
      If Not pVal.BeforeAction _
      And (pVal.ColUID = "colICode" Or pVal.ColUID = "colIName") Then
        Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
        oCFLEvento = pVal
        Dim sChooseFromListUID As String
        sChooseFromListUID = oCFLEvento.ChooseFromListUID
        Dim oChooseFromList As SAPbouiCOM.ChooseFromList
        oChooseFromList = oForm.ChooseFromLists.Item(sChooseFromListUID)
        Dim oDataTable As SAPbouiCOM.DataTable
        oDataTable = oCFLEvento.SelectedObjects
        Dim sCode As String = ""
        Dim sName As String = ""
        Try
          sCode = oDataTable.GetValue(0, 0)
          sName = oDataTable.GetValue(1, 0)
        Catch ex As Exception
          ' log exception
          sCode = ""
          sName = ""
        End Try
        If Not sCode.Equals("") Then
          ' IF MATRIX COLUMN
          ' Update Matrix Row:
          '    1) oForm to have oMatrix object;
          '    2) row, to know where are need to be writed the Code & Name values.
          b = MatrixUpdateCell(oForm, pVal.Row, sCode, sName)
          ' IF DBDATASOURCES
         oForm.DataSources.DBDataSources.Item("USER_TABLE").SetValue("Code", 0, sCode)
         oForm.DataSources.DBDataSources.Item("USER_TABLE").SetValue("Name", 0, sName)
        End If
      End If
    Or search DK forum for "CFL matrix" words.
    Also look this
    Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
      If Not pVal.BeforeAction Then
        Try
          oForm.Freeze(True)
          Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
          oCFLEvento = pVal
          Dim sCFL_UID As String
          sCFL_UID = oCFLEvento.ChooseFromListUID
          Select Case sCFL_UID
         Case "cfl1"
           Dim oCFL As SAPbouiCOM.ChooseFromList
           oCFL = oForm.ChooseFromLists.Item(sCFL_UID)
           If oCFLEvento.BeforeAction = False Then
             Dim oDataTable As SAPbouiCOM.DataTable
             oDataTable = oCFLEvento.SelectedObjects
             Dim valCode As String = ""
             Dim valName As String = ""
             Try
               valCode = oDataTable.GetValue(0, 0)
               valName = oDataTable.GetValue(1, 0)
             Catch ex As Exception
               ' log exception
             End Try
             Try
              If (pVal.ItemUID = "eBPCode") Or (pVal.ItemUID = "bCFL1") Then
                ' for userdatasource
                oForm.DataSources.UserDataSources.Item("uCardName").ValueEx = valName
                ' for dbdatasource
                oForm.DataSources.DBDataSources.Item("USER_DEF_TABLE").SetValue("U_DEFINED_FIELD", 0, valCode)
                ' form to update mode
                oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
              End If
             Catch ex As Exception
              Dim s As String = ex.Message
             End Try
           End If
         Case "cfl2"
           ' do something
         Case "cfl3"
           ' do something
          End Select
        Catch ex As Exception
          ' log exception
        Finally
          oForm.Freeze(False)
        End Try
      End If
    Hope I help you.
    Regards
    Sierdnas
    Edited by: Sierdna S on Jul 17, 2008 12:04 PM

  • Xml matrix report not expending horizontally

    hi guys m trying to develop xml matrix report but m totally stuck.value are not expanding vertically.
    RTF tags are here.Plz tell me how can i attach rtf and xml file with this post so you people can help me in better way.
    plz help me its very urgent
    <?for-each:G_1?>
    <?ITEM_CATEGORY?>
    Organization : <?horizontal-break-table:1?>
    <?for-each-group@cell: G_ITEM_CATEGORY; ORGANIZATION_CODE?>
    <? ORGANIZATION_CODE?>
    <?end for-each-group?>
    <?for-each-group: G_ITEM_CATEGORY;ITEM_CODE?> <?ITEM_CODE?>
    <?for-each-group@cell:current-group();ORGANIZATION_CODE ?>
    <?current-group()// AMOUNT?>
    <?end for-each-group?>
    <?end for-each-group?>
    <?end for-each-group?>

    When you say "the values are not expanding vertically" do you mean that on the printed report it is not returning all the values for a given field, i.e. the field is too small to display the entire value.... OR the repeating frame for the group is not expanding enough to display all the fields???

  • SSRS 2008 - Expression for totals in a Matrix

    Hi,
    I have a simple Matrix with the following groups:
    Row Group: Program
    Column Group: Employee
    I need to add a new total column on the right side of the matrix using a simple calculation but I haven't been able to find how to do that other than doing it on the query side. Here's how the Matrix looks like:
    Program
    Employee1
    Employee2
    Employee3
    New Column
    Program1
    45.0%
    0.0%
    87.5%
    Program2
    12.5%
    50.0%
    3.8%
    Program3
    28.8%
    1.3%
    8.7%
    Program4
    1.3%
    23.8%
    0.0%
    Total
    87.6%
    75.1%
    100.0%
    The new column should display the sum of each program divided by the sum of all totals....for example for Program1 the calculation should be (45+0+87.5)/(87.6+75.1+100) which should be equal 50.44% ...the same logic applies for the other
    rows.
    The number of columns (Employees) and rows (Programs) are dynamic, so they change according to who is seeing the report. I'm unable to reference the sum of the total at the bottom row, not sure what I am missing.
    Any input on this is greatly appreciated.

    Hi Cleber,
    I have tested on my local environment and your issue can be caused by you haven't include the scope in the sum function, please find details information below about how to do the calculation:
    Please design the matrix like below:
    You can find the Row Group name is "Program" and the Column Group name is "Empolyee", this will include in the sum expression as below:
    Expression1: =SUM(Fields!Amount.Value,"Empolyee")
    Expression2: =SUM(Fields!Amount.Value,"Program")
    Expression2: =Sum(Fields!Amount.Value,"Program")/Sum(Fields!Amount.Value,"DataSet1")
    Preview you will got the result like below:
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • SSRS Matrix report. Variance expression by Month. Need to compare month from prior year to current month of current year VS2010

    Please help.  I have a matrix report.  In the report I have row group  PO Type.  One the Column groups I have a parent group by Fiscal Year, and then a child group by Month.  When I run the report, I get two years of data back broken
    out by month.  Please see below.
    Now here is where I am getting stuck.  I need to take the variance between the current month of the current year, from the same month of the prior year.  So I need to show the difference between Oct , 2014 from Oct, 2013. November, 2014 from November
    2013... etc. etc.
    In the example below, how do I create a column or row showing the variance for Contracts for October 2014.  I need to take the contracts for October 2014 which is 3 and subtract that from October 2013 which is 8.  Any suggestions? How do I do that
    for each month?  Then I need to do it for the quarter... then the year?  But I'll be happy if I can just get the month working first.
    Any help will be appreciated. 
    here is what my rdl file looks like.
    Here is what my report looks like when I render it.

    Hi Adrian_s2012,
    According to your description, you want to compare values for the month of current year with the month of prior year and get the variance. Right?
    In Reporting Services, we don't have any function to get this "Year to Year" Growth. In this scenario, if you data source is a cube, we suggest you use Analysis Services to achieve your requirement. If this data source is just from database, it will be hardly
    to calculate the variance because we need to compare the values within every two different column group and matrix generate adjacent columns one by one. Even we make it by using custom, every time executing the long code when generating result
    in a cell will reduce a lot of performance, we really don't suggest to do that in SSRS. Here is a thread with much easier requirement, please take a reference of that:
    http://social.msdn.microsoft.com/Forums/office/en-US/842e2dcb-d949-4297-9d91-eac989692cb5/difference-between-the-grouped-column?forum=sqlreportingservices
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • SSRS - Expression to color column value dynamically in Matrix

    Hi ,
    I have a matrix which looks like :
    The <<Expr>> value can be 1 /0 /"-" .
    The Expr value is being calculated dynamically.
    The data set query I am using has a column called due_days.
    In the color expression of the <<Exp>> box I am using the expression as :
    =IIf(Fields!Due_Days.Value>14  and Fields!Notes_Count.Value>0,"Blue",(Iif(Sum(Fields!Notes_Count.Value)=0 ,"Red","Black")))
    My requirement is if the Due_Days column value is >14 then I need to highlight the value as blue else black and if value is 0 then red. When I use the above query it is just highlighting the color blue for 1st column only. Eg: 4th row . Due days for month
    of Oct and Nov is > 14 but it shows blue only for month of oct.
    How can i resolve the issue?

    In select query i have 5 columns:
    Due days(Which is difference between 2 dates) ,
    Notes count (Which is just a count of notes  entered or not having value 0/1  and value '-' if another column CRD is greater than the matrix month and year.)Eg: below date 11/12/2014 is greater than Oct 2014 hence Oct 2014 should have "-"
    Month Name , Year , Month Nbr (last 6 months which I cross joined with the table to get counts for each month)
    The matrix has year and last 6 month  as column groups
    Color coding should be if notes count is 0 then red  ,if notes count is 1 and due_days> 14 then blue else black . When i try to use expression for color as i mentioned above, it colors only 1st colum.eg:  2nd row
    Nov 2014 is blue but for jan 2014 also it should show blue as due days>14 .
    Is there any way i can do that ??
    Eg: data set returns value as :
    Due Days        CRD                              Month         
    Month_Nbr    Year   Notes _Count
    5             2014-11-28 00:00:00.000    December          12         2014       
    0
    5               2014-11-28 00:00:00.000    February           2         2015        
    0
    5             2014-11-28 00:00:00.000    January              1           2015      
    0
    5            2014-11-28 00:00:00.000    November          11          2014       1
    5            2014-11-28 00:00:00.000    October              10          2014        0
    5            2014-11-28 00:00:00.000    September          9           2014         0
    Matrix is of the form :
                  YEAR
                  MONTH
    CRD        Notes_count

  • How to Delete a Specific Cell in a Matrix + plz Give sample code for Lost F

    hello there !!!!
    i m in Great Trouble please help me out..
    i have to search for a specific Column n then i have to validate that portion, similarly after validating i have to add update delete all the fuction apply... so please help me i m very upset.
    Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
            Try
                Dim Count As Int32
                If FormUID.Equals("Allowance") Then
                    If (pVal.BeforeAction = True) And (pVal.ItemUID = "1") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                        If pVal.Row = 0 Then
                            'BubbleEvent = False
                        End If
                        o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                        Count = o_Matrix.RowCount()
                        SBO_Application1.MessageBox("Matrix Count is " & o_Matrix.RowCount)
                        Validate(pVal, EventEnum, FormUID, BubbleEvent)
                    End If
                End If
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
        Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
            Dim Row, ii As Integer
            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
            o_Matrix.FlushToDataSource()
            Try
                For Row = 2 To o_Matrix.RowCount
                    StrName = Convert.ToString(DBtable.GetValue("CardCode", Row - 1)).Trim()''' i got Error over there n rest of my code is also not working pls...
                    StrUId = Convert.ToString(DBtable.GetValue("U_AlwID", Row - 1)).Trim()
                    StrEnter = Convert.ToString(DBtable.GetValue("U_SupEnter", Row - 1)).Trim()
                    StrExist = Convert.ToString(DBtable.GetValue("U_SupExist", Row - 1)).Trim()
                    If Row - 1 < DBtable.Rows.Count - 1 Or (Not (StrName.Equals(String.Empty) And StrUId.Equals(String.Empty) And (StrEnter.Equals(String.Empty) Or StrExist.Equals(String.Empty))) And (Row - 1 = DBtable.Rows.Count - 1)) Then
                        If (Not StrName.Equals(String.Empty)) And ((StrUId.Equals(String.Empty) Or StrEnter.Equals(String.Empty)) Or StrExist.Trim.Equals(String.Empty)) Then
                            SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                            BubbleEvent = False
                            Exit Sub
                        End If
                        For ii = Row To DBtable.Rows.Count - 1
                            If Convert.ToString(DBtable.GetValue("ColName", ii)).Trim().Equals(StrName.Trim()) Then
                                SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Duplication Not Allowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                                oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
                                BubbleEvent = False
                                Exit Sub
                            End If
                        Next
                        If CDbl(StrName) < 0 Then
                            SBO_Application1.StatusBar.SetText("Invalid values provided!Blank values not vllowed", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
                            BubbleEvent = False
                            Exit Sub
                        End If
                    End If
                Next Row
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

    Hello there
    sir i want to Add Update and delete these three basic operation onto the Matrix, Sir u game me a Sample code of Delete a specific Column...
    Sir can u do me a favour pls leave every thing n just told me how to update a matrix ,like i have to fill the matrix field through the DATABASE table now i want to update the DataBase table from the matrix..
    i just only know thta i have to fill back database table with the help of FLUSHTODATABASE()
    here is my Sample Code...n i have to update in the validate portion...
    Public Sub HandleEventts_Allowance(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByRef BubbleEvent As Boolean)
            Try
                Dim oCellValue As SAPbouiCOM.EditText
                If FormUID.Equals("Allowance") Then
                    If (pVal.ItemUID = "MatAllow") Then
                        If pVal.Row = 0 Then Exit Sub
                        o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                        If (pVal.Row > o_Matrix.RowCount) Then Exit Sub
                        oForm = SBO_Application1.Forms.Item(FormUID)
                        If (pVal.ItemUID = "1" Or EventEnum = SAPbouiCOM.BoEventTypes.et_CLICK) Then
                            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
                            If pVal.ColUID = "ColName" And pVal.BeforeAction = True Then
                                If pVal.Row = 0 Then Exit Sub
                                oCellValue = CType(o_Matrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific(), SAPbouiCOM.EditText)
                                If (oCellValue.Value.Trim().Equals(String.Empty) And o_Matrix.RowCount <> pVal.Row) Then
                                    SBO_Application1.StatusBar.SetText("Invalid Allowance ID: Blank Value Not Allowed", )
                                    oCellValue.Active = True
                                    BubbleEvent = False
                                    Exit Sub
                                End If
                            End If
                        End If
                    End If
                End If
                Validate(pVal, EventEnum, FormUID, BubbleEvent)
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
    Public Sub Validate(ByRef pval As SAPbouiCOM.ItemEvent, ByRef EventEnum As SAPbouiCOM.BoEventTypes, ByVal FormUID As String, ByRef BubbleEvent As Boolean)
            Dim str, str1 As String
            Dim checkbox1, Checkbox2 As SAPbouiCOM.CheckBox
            Dim o_Matrix As SAPbouiCOM.Matrix
            Dim Sum As Integer
            Dim oRecordset As SAPbobsCOM.Recordset
            Dim Container As Integer
            Dim Count As Int32
            o_Matrix = SBO_Application1.Forms.Item(FormUID).Items.Item("MatAllow").Specific
            oRecordset = o_CompanyObj.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Try
                For Count = 0 To DBtable.Rows.Count - 1
                    CodeFill = Convert.ToString(DBtable.GetValue("Name", Count).Trme())
                    NameID = Convert.ToString(DBtable.GetValue("ColUID", Count).Trim())
                    Price = Convert.ToString(DBtable.GetValue("ColPrice", Count).Trim())
                    Quantity = Convert.ToString(DBtable.GetValue("ColQuant", Count).Trim())
                    Total = Convert.ToString(DBtable.GetValue("ColTotal", Count).Trim())
                    checkbox1 = o_Matrix.Columns.Item("ColSEnter").Cells.Item(Count).Specific
                    Checkbox2 = o_Matrix.Columns.Item("ColSExist").Cells.Item(Count).Specific
                    If (checkbox1.Checked = True) And (Checkbox2.Checked = True) Then
                        Dim Sql As String
                        Sql = "Update [@Supplier] Set U_Price=' " & Price & " ',U_ID=" & NameID & "Where Name ='" & CodeFill & " '"
                        oRecordset.DoQuery(Sql)
                    End If
                Next Count
                SBO_Application1.MessageBox("Record was Updated")
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

  • Assign a matrix to a JTable?  Possible?

    OK. I will not know the incomming data matrix untill it is assigned. Is there anyway to put the following matrix into a JTable without a headache? All I see are examples of Object class variables assigned to JTables. If anyone knows how to make this work I will appreciate it very much. Here is what I have come up with as an idea:
            String[][] originalDMatrix;
            // Assigned String Matrix.
            if(Program.printDataMatrix.isSelected()) {
                originalDMatrix = new String[Program.matrix.length][];
                for(int i = 0; i < Program.matrix.length; i++) {
                    originalDMatrix[i] = new String[Program.matrix.length];
    for (int j = 0; j < Program.matrix[i].length; j++) {
    originalDMatrix[i][j] = Program.matrix[i][j];
    // Create the table and give it the matrix THIS IS WHERE IT WONT WORK.
    final JTable originalDMatrixT = new JTable(originalDMatrix);
    [/code[
    ERROR OUTPUT:
    cannot resolve symbol
    symbol : constructor JTable (java.lang.String[][])
    location: class javax.swing.JTable
    final JTable originalDMatrixT = new JTable(originalDMatrix);
    ^
    1 error
    Errors compiling Results.

    Changing to strings gave same result but with Object:
    symbol  : constructor JTable (java.lang.Object[][])
    location: class javax.swing.JTable
            final JTable originalDMatrixT = new JTable(originalDMatrix);
                                            ^
    1 error

  • Event dead loop in updating column value of a matrix

    Hi,
    I need to do some auto calculation in a matrix. In my matrix, i have column A and B. If user enter a value in column A and leave the column then my add-on will do some calculation and assign a new value to column B, same thing on column B. In my event filtering, i use
    "pVal.FormType == xxx && pVal.ItemUID == "xx" && pVal.ColUID == "U_xx" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_LOST_FOCUS && !pVal.BeforeAction"
    to capture the event. But then my add-on enter into a dead loop. It seems when i write a value to column B in column A event it will trigger LOST_FOCUS event in column B and then it trigger same event of column A, and then it enters into a dead loop. In SAP B1 client, i can see the two columns start refreshing endlessly.
    Apparently, when assigning a value into a column B during event of column A, it will trigger LOST_FOCUS event of column B. That's the only reason i strongly suspect that.  Is there any one know the solution for my situation?
    Thanks,
    Lan
    P.S. i first get the object of the textbox in the matrix, and use "oEditText.value = new_value" to assign the value.
    Edited by: ZHANGLAN on Jul 8, 2010 2:26 AM

    Hi
    Why didn't you try the Validate event instead of Lost focus. That is pretty easy for such calculations.
    "pVal.FormType == xxx && pVal.ItemUID == "xx" && pVal.ColUID == "U_xx" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_Validate && !pVal.BeforeAction"
    Thanks
    Anoop

Maybe you are looking for

  • Apex 3.1.2 Installation

    Hi All I´m trying to install but I getting some problems. In this version 3.1.2 must I really create the apex tablespace before run the apexins.sql ? I run but got the error: Tablespace "TS_APEX" not exists, but I read that it isn´t necessary, the sc

  • Applications and iPhoto Library folders not in backup

    My iMac G5 disk failed some time ago and was replaced by a new drive. I had been doing system backups via TM so was not concerned about being able to rebuild the system. However, when the new drive was initialized, I made the mistake of specifying a

  • ATV vs Mac Mini

    I have been considering an ATV for my main TV in our home to be used for usual reasons, pull content off itunes, video and audio, and then to begin to stream rented content from itunes store as well along with maybe consider third party sources, netf

  • Can you charge Macbook pro A1297 batteries externally?

    I hav a Macbook 17" Core i5 Unibody A1297 which doesnt charge due to a motherboard fault - The battery ISNT removable without unscrewing it .... but is ther a way to charge it externally? cheers,

  • Three questions: how to turn green letters and why is text now just crossed out

    Why is my text green and not black as set the text color to be? I have the new Maverick and every thing seems different. The text is coming out green and not black, I delete a word and all it does is cross it out, and how do I change words like cafe