Re:Combo in matrix
Hi All,
I have created a matrix with priceunitColumn.this field is linked to a no Object type table.My problem is iam not getting the define new option in the combo.Also i cant get all the values from the table in the combo.How should i achieve this.
Thanx in advance.
Regards
Mohana
Hi..
Try this code it will work..
Dim oPopUp As SAPbouiCOM.Form REM Define New Form (Global)
Private Sub LoadFromXml(ByVal fileName As String)
Dim XmlDoc As Xml.XmlDocument
Dim Xmlstr As String
XmlDoc = New Xml.XmlDocument
Dim SPath As String
Try
SPath = IO.Directory.GetParent(Application.StartupPath).ToString
XmlDoc.Load("C:\Program Files\SAP\SAP Business One\AddOns\Ur Srf Folder" & "\" & fileName)
SBO_Application.LoadBatchActions(XmlDoc.InnerXml)
oPopUp = SBO_Application.Forms.Item("define sfr form ID")
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
oPopUp.Visible = True
End Sub
Item Event
If pVal.FormUID = "UID" And pVal.ItemUID = "ComboID" And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT Then
Try
ocombo = FormS.Items.Item("ID").Specific
If ocombo.Selected.Value = "-9" Then
LoadFromXml("Define NewSRF .srf")
End If
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
Regards..
Billa 2007
Similar Messages
-
Hi,
I have a Matrix.
In Each row i want like to populate matrix with values based on the row.
My problem is once a combo gets populated in one row, the same value
gets populated for other rows also(inspite of changing values)
This is my code
Do Until rsWHID.EoF = True
i = i + 1
Dim sLength As String
sLength = rsWHID.Fields.Item("Length").Value
WHOH_Form.DataSources.UserDataSources.Item("usLot").ValueEx = ""
Dim sDate As String = Convert.ToString(rsWHID.Fields.Item("DueDate").Value)
WHOH_Form.DataSources.UserDataSources.Item("usDate").ValueEx = Convert.ToString(sDate).Replace(".", "")
WHOH_Matrix.AddRow()
sQuerySOWO = "select u_ORDER,U_SOWO from [@CDIplanorders] WHERE u_iTEMcODE='" & sItemNo & "' AND u_lENGTH='" & sLength & "'"
rsSOWO.DoQuery(sQuerySOWO)
WHOH_Form.DataSources.UserDataSources.Item("usCmboSOWO").ValueEx = ""
WHOH_Combo = WHOH_Matrix.Columns.Item("cmbSOWO").Cells.Item(i).Specific
For j = WHOH_Combo.ValidValues.Count - 1 To 0 Step -1
WHOH_Combo.ValidValues.Remove(j, SAPbouiCOM.BoSearchKey.psk_Index)
Next j
If Not rsSOWO.EoF() Then
Do Until rsSOWO.EoF = True
Dim strOrderNO, strWOorSO As String
strOrderNO = rsSOWO.Fields.Item("u_ORDER").Value
strWOorSO = rsSOWO.Fields.Item("u_SOWO").Value
WHOH_Combo.ValidValues.Add(strOrderNO, strWOorSO)
rsSOWO.MoveNext()
Loop
End If
rsWHID.MoveNext()
Loop
Pls help.The design of the matrix implies that all row-comboboxes have the same data, you cannot change that.
Maybe use the double click event to popup a form and show the different possible values depending on the row -
Hi,
How can I populate a combo box in a matrix with different values?
The combobox will have a dynamic data coming from a table for each description.
Supposed, if I my matrix would look like the following.
Description Option(combobox)
ABC Yes/No
DEF Excellent/Good/Poor
GHI High/Medium/Low
How would I do it?
Thanks,Hi jaun,
you write the code in Key_Down Event Of Description field
'Assuming clCombo as Combobox column,DESCUID as Description field ColUID and it is Edit Text
If Description field is also combo box then you add this code in Combo_Select in before action false
if pVal.ColUid="DESCUID" and Pval.Row>0 then
dim objCombo as SAPbobsUICOM.ComboBox
dim i as integer
objCombo =objMatrix.Columns.Item("clCombo").Cells.Item(Pval.Row).Specific
for int=0 to objCombo.ValidValues.Count-1
objCombo.ValidValues.Remove(0)
Next
if objMatrix.Columns.Item("DESCUID").Cells.Item(Pval.Row).Specific.Value="ABC" then
objCombo.ValidValues.ADD("Y","YES")
objCombo.ValidValues.ADD("N","NO")
end if
if objMatrix.Columns.Item("DESCUID").Cells.Item(Pval.Row).Specific.Value="ABC" then
objCombo.ValidValues.ADD("E","EXCLLENT")
objCombo.ValidValues.ADD("G","GOOD")
objCombo.ValidValues.ADD("P","POOR")
end if
if objMatrix.Columns.Item("DESCUID").Cells.Item(Pval.Row).Specific.Value="ABC" then
objCombo.ValidValues.ADD("H","HIGH")
objCombo.ValidValues.ADD("M","MEDIUM")
objCombo.ValidValues.ADD("L","LOW")
end if
End if
Hope it helps you
Regards
Vishnu -
Hi,
How do I check whether a combo is selected? The combo is bind to the matrix using screen painter.
I have tried this but it is not working:
oMatrix.Columns("ColName").Cells.Item(i).Specific.Selected.Value = ""
I am using VB and 2004B. Help appreciated.Hi,
If ((pVal.EventType = SAPbouiCOM.BoEventTypes.et_GOT_FOCUS And pVal.ItemUID = "Matrix1" And pVal.ColUID = "ColumnID" And pVal.Before_Action = False)) Then
oCombo = oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific
If oCombo.Selected Is Nothing Then
oCombo.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)
Else
SBO_Application.MessageBox("Combo selected")
End If
End If
This event gives me a selection even before losing the focus of combobox item.
Hope it may be of use to u.
Cheers
Manu -
How to add combo in system matrix ? I am adding a column in the matrix of A/R invoice.I am using the following code-
Dim matMatrix As SAPbouiCOM.Matrix
Dim objColumn As SAPbouiCOM.Column
Dim ddlAP As SAPbouiCOM.ComboBox
objForm = SBO_Application.Forms.ActiveForm
If objForm.DataSources.UserDataSources.Count = 228 Then
objForm.DataSources.UserDataSources.Add("ddlAP", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 50)
End If
matMatrix = objForm.Items.Item("38").Specific
matMatrix.Clear()
If matMatrix.Columns.Count = 265 Then
objColumn = matMatrix.Columns.Add("AP", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
Else
objColumn = matMatrix.Columns.Item("AP")
End If
objColumn.DataBind.SetBound(True, "", "ddlAP")
'objColumn.TitleObject.Caption = "AP Invoice"
objColumn.Width = 100
objColumn.Visible = True
matMatrix.Columns.Item("AP").DisplayDesc = True
matMatrix.Columns.Item("AP").TitleObject.Caption = "A/P Invoice"
ddlAP = matMatrix.Columns.Item("AP").Cells.Item(0).Specific
objForm.Refresh()
But the combo is note getting displayed.Hi Dilip,
You cannot change (add or modify) a system matrix via SDK. If you need to add a ComboBox in a system matrix you need to create a UserField with ValidValue or connected to a User Table.
Regards,
Vítor Vieira -
hi
im using combo in my matrix
how to load data from database table to column(ocombo) of the matrix
plz help me
Edited by: hareeshKR on Jul 18, 2011 12:37 PM
Edited by: hareeshKR on Jul 18, 2011 1:15 PMHi,
ObjMatrix = ObjForm.Items.Item("6").Specific
ObjCombo = ObjMatrix.Columns.Item("4").Cells.Item(row).Specific
strSQL="Select Code,ItemName from OITM"
obRS= objAddOn.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
objRS.doQuery(strSQL)
for i=1 to objRS.recordcount
ObjCombo.ValidValues.Add(ObjRS.Fields.Item("Code").Value, ObjRS.Fields.Item("ItemName").Value)
ObjRS.MoveNext()
Next -
Combo inside matrix, help me
Dear all,
In my application i have combox in matrix, Values of combo i added (1, 2,3,4...). now when user click button in form it will assign for combobox is 1 or 2 ..... I try this code but error"
oComboBox = oMatrix.Columns.Item(colName.ToString).Cells.Item(i + 1).Specific()
oComboBox.Select(1, SAPbouiCOM.BoSearchKey.psk_ByValue)
Please help me. THanksWhat is the error message?
Im using it as
For q = 1 To Matrix.RowCount
com = Matrix.Columns.Item("c1").Cells.Item(q).Specific
com.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)
Next q
and its working. -
Hola a todos.... el problema que tengo y espero me puedan ayudar es que tengo un matrix de sap, pero nesesito que una de las columnas de ese matrix en ves de mostrar texto me muestre un combo con informnacion de los turnos de una empresa ....alguien me puede ayudar .. este es el codigo que estoy ocupando:
For Li_Fila = 0 To Lo_Personal.TotalFilas - 1
Lo_Personal.Fila = Li_Fila
Lo_UserDataSource = Mo_Forma.DataSources.UserDataSources.Item(MatrixCambiaTurnosNumero)
Lo_UserDataSource.Value = Lo_Personal.Empleado
Lo_UserDataSource = Mo_Forma.DataSources.UserDataSources.Item(MatrixCambiaTurnosOriginal)
Lo_UserDataSource.Value = Lo_Personal.TurnoDescripcion
''En esta columna es en la que deseo mostrar el combo.....
__Lo_UserDataSource = Mo_Forma.DataSources.UserDataSources.Item(MatrixCambiaTurnosCambio)__
__Lo_UserDataSource.Value =Lo_cboTunos.Selected.Description__
Lo_grdMatrixCambiaTurnos.AddRow()
Next
Asi como lo tengo ahora me muestra la forma de combo con un valor pero al darle click no me despliega el resto de los valores....
alguien sabe como puedo solucionar esto
De antemano les agradesco ....Jorge Luis
Sobre el punto que mencionas te puedo decir lo siguiente:
' Creando los UserDataSources para la columna tipo combo
oMyForm.DataSources.UserDataSources.Add("udsColumna", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)
oMatrix = oMyForm.Items.Item(MyMatrix).Specific
oColumns = oMatrix.Columns
' Asignando el UserDataSources a la columna tipo combo
oColumns.Item("c_Columna").DataBind.SetBound(True, "", "udsColumna")
oMatrix = oMyForm.Items.Item(MyMatrix).Specific
oColumns = oMatrix.Columns
' Agregando valores al combo de la columna tipo combo
oColumns.Item("c_Columna").ValidValues.Add("M", "Mañana")
oColumns.Item("c_Columna").ValidValues.Add("T", "Tarde")
oColumns.Item("c_Columna").ValidValues.Add("N", "Noche")
oColumns.Item("c_Columna").DisplayDesc = True
oRecordSet.DoQuery("SELECT CODE, NAME FROM [@TABLE]")
Dim index As Integer = 1
' Cargando valores a las filas de la matrix
oMatrix = oMyForm.Items.Item(MyMatrix).Specific
While Not oRecordSet.EoF
oMatrix.AddRow(1)
oMatrix.GetLineData(index)
oUserDataSource = oMyForm.DataSources.UserDataSources.Item("udsColumna")
oUserDataSource.Value = oRecordSet.Fields.Item("CODE").Value.ToString.Trim
oMatrix.SetLineData(index)
index += 1
oRecordSet.MoveNext()
End While
Si revisas bien este codigo primero llenas la columna que es tipo combo con sus valores posibles, puedes usar un oRecordSet para llenarla si es que los datos los tienes en una tabla y pueden varias.
Al usar UserDataSource en una matrix debes usar las funciones GetLineData(index) y SetLineData(index).
Bueno espero que esto aclare tus dudas, si todo sale bien seria bueno que lo comentes.
Saludos
George -
LoadBatchActions to Populate a Matrix
We have managed to work out some XML that can be passed to LoadBatchActions to populate a matrix in a single call (With performance being the goal), however it doesn't seem possible to populate combo box columns using this mechanism. Is there a way to populate combo box matrix cells with data using LoadBatchActions? What we have so far is something like this, but the LnType2 column is causing the operation to fail because it is a combo box column:
<?xml version="1.0" encoding="UTF-16"?>
<Application>
<forms>
<action type="update">
<form appformnumber="2000071350" uid="FSE_0000000">
<items>
<action type="update">
<Item uid="Matrix">
<Specific>
<rows>
<action type="add">
<row index="0" />
<row index="0" />
</action>
<action type="update">
<row index="1">
<column uid="Um2" string="EA" />
<column uid="LnType2" string="P" />
</row>
<row index="2">
<column uid="Um2" string="EA" />
<column uid="LnType2" string="P" />
</row>
</rows>
</Specific>
</Item>
</action>
</items>
</form>
</action>
</forms>
</Application>Hi Benjamin,
In the Business One UI API 2004 help file you could find an issue named "Adding Forms with XML" where it is explained the file format.
Moreless, you should use the valid values property under ItemSpecific tag to set the possible options, and then add some datasources to link the controls on the matrix with the tables in the DB.
Regards
Ibai Peñ -
Screen Painter how to, manual or flash book
Is there a screen painter manual, how to or flash book?
I started using it but the help is to simple, for now I want to create a form that will ask for an inventory code and bring in description and barcode field. Then the last field will ask for a quantity, that I will read with my add on to print barcode labels.
Regards,
William BurgosHi William Burgos
Screen painter is very basic. It only creates a screen. So all you do is make a new form, drop things on it like a text box, combo box, matrix and so on. But screen painter itself has no logic and you can't set it to do certain actions.
Screen painter only creates the form. Then you through code must load the form that screen painter created, this form is actually a XML form. Through code you must also apply all the logic.
Hope this helps -
How to use the Combo Box In MAtrix Colums
HI Experts,
Good Mornong.How to use the Combo Box In MAtrix Colums?
Regards And Thanks,
M.Thippa Reddyhi,
loading data in to the combobox on form load.but, it should be done when atleast one row is active.
the values what ever you are inserting in to combo should be less than or eqhal to 100 or 150.if it exceeds beyond that performance issue arises.it takes more time to load all the data.so, it is better to have 100 or less.
oMatrix.AddRow()
RS = Nothing
RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
RS.DoQuery("select ItemCode,ItemName from oitm")
oCombo = oMatrix.Columns.Item("ColumnUID").Cells.Item(oMatrix.RowCount).Specific
For i = 1 To RS.RecordCount
If RS.EoF = False Then
oCombo.ValidValues.Add(RS.Fields.Item("ItemCode").Value,RS.Fields.Item("ItemName").Value)
RS.MoveNext()
End If
Next
the above code is inserting data from database to column combobox.
you can fill combo directly also as shown below.
oCombo.ValidValues.Add("x","1")
oCombo.ValidValues.Add("y","2")
oCombo.ValidValues.Add("z","3")
oCombo.ValidValues.Add("","")
and what ever the values you are filling into combo should be unique.other wise it shows valid value exists.
regards,
varma -
Problem with combo box in a Matrix column
hi every one, i have a user form with a matrix(uid = 37) with some columns and one column is combo box. in that combo box i have to get values from OSTC table (Code)...i have written this code ..i dont know how to access the combo box so that i can get values to combo box when i execute the prg....
oitem = oForm.Items.Item("37") 37 is uid of omatrix2
oMatrix2 = oitem.Specific
oColumns = oMatrix2.Columns
oForm.DataSources.UserDataSources.Add("CSR1", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)
oColumn = oColumns.Item("V_6") ''for accessing the combo box item [V_6 is col uid ]
oCombo = oColumn.Cells.Item(omatrix2.row).Specific ''''''''problem line
oCombo.DataBind.SetBound(True, "", "CSR1")
rset = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
query = "select Code from OSTC"
rset.DoQuery(query)
Dim tc As String
rset.MoveFirst()
For row = 0 To rset.RecordCount - 1
tc = rset.Fields.Item("Code").Value
oCombo.ValidValues.Add(tc, row)
rset.MoveNext()
Next
oMatrix2.Columns.Item("V_6").DataBind.SetBound(True, "@SALE_CHILD", "U_Tax")Call objMain.objUtilities.LoadComboValuesForMatrix(FormUID, "27", "SELECT Code,Name FROM OSTC Order by Code", "V_19", objMatrix.RowCount)
Public Sub LoadComboValuesForMatrix(ByVal FormUID As String, ByVal ItemUID As String, ByVal strQuery As String, ByVal MtrxColId As String, ByVal Rowcount As Integer)
Dim inti As Integer
objRecSet = objMain.objUtilities.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
Try
Dim objmatrix As SAPbouiCOM.Matrix
Dim objCombo As SAPbouiCOM.ComboBox
objForm = objMain.objApplication.Forms.Item(FormUID)
objItem = objForm.Items.Item(ItemUID)
objmatrix = objItem.Specific
objCombo = objmatrix.Columns.Item(MtrxColId).Cells.Item(Rowcount).Specific
objItem.DisplayDesc = True
objRecSet.DoQuery(strQuery)
If objRecSet.RecordCount > 0 Then
If (objCombo.ValidValues.Count > 0) Then
For inti = 0 To objRecSet.RecordCount - 1
objRecSet.MoveNext()
Next
End If
If (objCombo.ValidValues.Count <= 0) Then
objCombo.ValidValues.Add("", "")
For inti = 0 To objRecSet.RecordCount - 1
objCombo.ValidValues.Add(Convert.ToString(objRecSet.Fields.Item(0).Value), Convert.ToString(objRecSet.Fields.Item(1).Value))
objRecSet.MoveNext()
Next
End If
End If
Catch ex As Exception
Throw ex
Finally
System.Runtime.InteropServices.Marshal.ReleaseComObject(objRecSet)
GC.WaitForPendingFinalizers()
GC.Collect()
End Try
End Sub -
Combo box in matrix column does not bind
Dear Sirs,
I have a master data UDO with three child tables, and I generated an xml form file using the B1DE form ganerator for this UDO.
After that I used screen painter to set some columns of the matrix bindend to the child tables as combo box.
In the load data event of the form I populate each combo box cell with the valid values I want.
Now, when I add (or update) data , the combo box let me choose the valid values correctly (and I can see the choosen value in the cell) , but then data are not saved in the DB, while the data entered in edit text columns are correclty saved.
Anyone have an idea of the problem?
Thank you for the help
MassimoMassimo,
Have a look at the SDK Sample for Matrix and DataSource ...
...\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources
This may help.
Eddy -
How to set default values in matrix combo
hai everybody.
i want to set default values in a matrix combo box. how to do that
pls.......Hi Priya,
Public Sub comboload1()
Try
ds = oform.DataSources.DBDataSources.Add("OUSR")
oitem = oform.Items.Item("pm7")
omatrix = oitem.Specific
ocolumns = omatrix.Columns
ocolumn = ocolumns.Item("V_2")
ocombo = ocolumn.Cells.Item(r).Specific (r = row number)
LoadEroToCombo1(ocombo)
Catch ex As Exception
oapp.MessageBox(ex.Message)
End Try
End Sub
load to combo function is below
Public Sub LoadEroToCombo1(ByRef ocombo As SAPbouiCOM.ComboBox)
Dim rset As SAPbobsCOM.Recordset
Dim querystring As String
Dim rcount As Long
Dim rindex As Long
Try
rset = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
querystring = "SELECT T0.U_NAME FROM OUSR T0"
rset.DoQuery(querystring)
rcount = rset.RecordCount
rset.MoveFirst()
ocombo.ValidValues.Add("0", "Select")
For rindex = 0 To rcount - 1
ocombo.ValidValues.Add(rset.Fields.Item(0).Value, rindex)
rset.MoveNext()
Next rindex
ocombo.Select("0")
rset = Nothing
System.GC.Collect()
Catch ex As Exception
oapp.MessageBox(ex.Message)
End Try
End Sub
try this code if it helps please reward points
Regards
Cool Ice
Edited by: Cool Ice on Jul 28, 2008 1:43 PM -
How the condition of combo box of matrix can be passed in query
Hi,
I want to get the parameter code and description for a particular category. Category code is in the matrix combo box if i pass tat field in a where condition i cant retrieve the parameter code but its working in the database. Please identify the mistake and correct it.
Private Sub Addcomboparam(ByVal oCombo As SAPbouiCOM.Column)
Try
Dim RS As SAPbobsCOM.Recordset
'Dim Bob As SAPbobsCOM.SBObob
RS = Ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
'Bob = Ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)
RS.DoQuery("select Code,U_paradesc from [@PSSIT_QCPARAMETER] where U_catcode='" & txtcatcode.Selected.Value.ToString() & "'")
RS.MoveFirst()
While RS.EoF = False
oCombo.ValidValues.Add(RS.Fields.Item("Code").Value, RS.Fields.Item("U_paradesc").Value)
RS.MoveNext()
End While
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Regards,
MadhaviI think that the problem is, that you accesed
txtcatcode.Selected.Value.ToString
but txtcatcode isnt declared.
try to do it as
dim x as string
x = txtcatcode.Selected.Value.ToString
and to seccond line add watch and breakpoint.
what you have in x variable? Or use try catch statement for receive error.
Petr
Maybe you are looking for
-
I wrongly changed the settings on the apps page to the American store. Now I cannot download any updates because I am locked out and need to revert back to the Canadian store, how do I do that
-
Urgent Need for Freeing space on time machine
unable to free space on time machine for backups. Unable to see option to delete various backups by right clicking on the file name in the list on the right side of the screen. I clicked on the "gear icon" on the actual picture of the backup in Time
-
Problem radius authetication ACS 5.4
Hi friends, Do you know about this problem with radius authenticaction in ACS 5. This is la log. Best regard, Marco
-
I'm trying to upgrade from forms 4.5 to 9i. We have properties of buttons with background color of white. I want to change it to gray. Can we do this without opening a form, in a batch. Because we have 500 forms. Can any one help me please. Or is the
-
7912 and CCM 4.2. Response redirect not working. 7912 Bug
I'm using response.redirect. All of a sudden we do receive support cases from customers using CCM 4.1.3SR2 and 4.2. It turns out that when using response.redirect (ASP) it does work anymore. 7940,60 still works. You have to press a button twice to be