Skip to Content
author's profile photo Former Member
Former Member

Form and UDO and matrix

Hi all,

I've got a UDO with only a header with 2 fields: Code and Name. I've created my form and added a matrix and 2 buttons and linked the form to the UDO. But when I load the code, even if there is some data in my UDO, they don't appear in my matrix. Any idea?

Another problem is that the button 1 and button 2 don't appear...

Vincent

Option Explicit

Private WithEvents SBO_Application As SAPbouiCOM.Application

Private oCompany As SAPbobsCOM.Company

Public oForm As SAPbouiCOM.Form

Private Sub SetApplication()

Dim SboGuiApi As SAPbouiCOM.SboGuiApi

Dim sConnectionString As String

Set SboGuiApi = New SAPbouiCOM.SboGuiApi

sConnectionString = Command

SboGuiApi.Connect sConnectionString

Set SBO_Application = SboGuiApi.GetApplication()

End Sub

Private Function SetConnectionContext() As Long

Dim sCookie As String

Dim sConnectionContext As String

Dim lRetCode As Long

Set 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

Private Function ConnectToCompany() As Long

ConnectToCompany = oCompany.Connect

End Function

Private Sub Class_Initialize()

SetApplication

If Not SetConnectionContext = 0 Then

SBO_Application.MessageBox "Failed setting a connection to DI API"

End ' Terminating the Add-On Application

End If

If Not ConnectToCompany = 0 Then

SBO_Application.MessageBox "Failed connecting to the company's Data Base"

End ' Terminating the Add-On Application

End If

Dim creationPackage As SAPbouiCOM.FormCreationParams

Dim oForm As SAPbouiCOM.Form

Dim oItem As SAPbouiCOM.Item

Dim oButton As SAPbouiCOM.Button

Dim oMatrix As SAPbouiCOM.Matrix

Dim oColumn As SAPbouiCOM.Column

Dim oColumns As SAPbouiCOM.Columns

Set creationPackage = SBO_Application.CreateObject(cot_FormCreationParams)

creationPackage.UniqueID = "MathExamsID"

creationPackage.FormType = "SM_MathExam"

creationPackage.ObjectType = "EVOSS_OITG" '// set the parameter with the object unique id

creationPackage.BorderStyle = SAPbouiCOM.BoFormTypes.ft_Fixed

'Set oForm = SBO_Application.Forms.Add("EVOSS_FRM1", ft_Fixed)

Set oForm = SBO_Application.Forms.AddEx(creationPackage)

oForm.Title = "Item Grades"

oForm.Height = 300

oForm.Width = 350

oForm.DataSources.UserDataSources.Add "EVOSS_DS1", dt_SHORT_NUMBER, 1

Set oItem = oForm.Items.Add("1", it_BUTTON)

oItem.Left = 5

oItem.Width = 65

oItem.Top = 270

oItem.Height = 19

Set oButton = oItem.Specific

Set oItem = oForm.Items.Add("2", it_BUTTON)

oItem.Left = 75

oItem.Width = 65

oItem.Top = 270

oItem.Height = 19

Set oButton = oItem.Specific

'Adding a matrix

Set oItem = oForm.Items.Add("GradeList", it_MATRIX)

oItem.Left = 10

oItem.Width = 150

oItem.Top = 60

oItem.Height = 180

oItem.Description = ""

oItem.DisplayDesc = False

oItem.AffectsFormMode = True

Set oMatrix = oItem.Specific

'Adding the columns

Set oColumns = oMatrix.Columns

'Column 1

Set oColumn = oColumns.Add("Col_nb", it_EDIT)

oColumn.TitleObject.Caption = "#"

oColumn.Editable = False

oColumn.DataBind.SetBound True, "@EVOSS_OITG", "DocEntry"

'Column 2

Set oColumn = oColumns.Add("GradeCode", it_EDIT)

oColumn.TitleObject.Caption = "Grade Code"

oColumn.Editable = True

oColumn.DataBind.SetBound True, "@EVOSS_OITG", "Code"

'Column 3

Set oColumn = oColumns.Add("GradeDesc", it_EDIT)

oColumn.TitleObject.Caption = "Grade Code"

oColumn.Editable = True

oColumn.DataBind.SetBound True, "@EVOSS_OITG", "Name"

oForm.Mode = fm_FIND_MODE

oForm.Visible = True

End Sub

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jan 07, 2005 at 07:08 AM

    Have you tried to set a breakpoint and stepped through the code... Not all errors from the SDK result in an exception, but just an abnormal exit from the event

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 09, 2005 at 04:14 PM

    Hello Vincent,

    If you want to show in a for only a matrix, you may consider of using the default form of the UDO, which is a matrix that contains the data. It's an option you have when you create the UDO.3

    If you just start using the UDO, I'd recommend you to be familiar with them, to use text box instead of matrix.

    In your form, add two text box and bind them to the fields, also add the

    oForm.DataBrowser.BrowseBy = "Name of the control bind to Code field", that will allow you to browse it

    I've created a UDO with matrix, but the matrix was linked to the table child, not the main table.

    And there are some events to manage on the matrix child, the UDO won't do everything...

    Sebastien

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks a lot Sebastien. UDO are something really interesting in Business One but obsviously the SDK does not work effeciently with them.

      I hope a new version will help us to develop more efficiently soon.

      Vincent

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.