Combobox in Matrix
Hi,
I have created a form through UDO which has a matrix linked to a table.
One of the columns of the matix has to be a combo box which in turn is to be linked to
another table.
Can this be done, if so how to do it?
I can using C#
Hi,
I think I havent made the question very clear.
the marix is linked to the user table(table 1) which was generated using UDO,
and I want one of the cloumns say (col2)
to have values in combo box filled from another user table(table2).
when trying to do it , I now get an error message
Specified cast is not valid.
Invalid query tree [300-33]. The SQL error is 8180
Can you send me some sample Code.
Similar Messages
-
Combobox (in matrix) not selectable?!
hello all.
i'd like to ask something.
see, i am populating a combobox within a column within a matrix.
all the values are there alright,
but i can't seem to select any entry ***
more details:
i DO see the drop down with all the values,
but whenever i select (programmicaly or using the mouse),
nothing is shown in the combobox,
and indeed the combobox.SELECTED is nothing!
why?
need i attach/bind it to datasource?
i don't want to do that.
thank you for your time.
-i.Hi Itay,
You are right, you need to bind the combobox to a datasource. I think binding to userdatasource is very useful and it's the mechanism of SAP Business One application. So I suggest you to do that.
Here is a sample.
Set oColumn = oColumns.Add("customer", it_COMBO_BOX)
oColumn.TitleObject.Caption = "customer"
oColumn.Width = 127
oColumn.Editable = True
oForm.DataSources.UserDataSources.Add "Customer", dt_LONG_TEXT, 30
oColumn.DataBind.SetBound True, "OCRD", "CardType"
Set oUserDataSource = oForm.DataSources.UserDataSources.Item("Customer")
Hope it helps.
Best Regards,
Nick He -
Hi all,
Here is my J# code:
SAPbouiCOM.EditText oEdit;
SAPbouiCOM.ComboBox oCombo;
oCombo = (SAPbouiCOM.ComboBox)colItemCode.get_Cells().Item(new Integer(pVal.get_Row())).get_Specific();
oEdit = (SAPbouiCOM.EditText)colItemName.get_Cells().Item(new Integer(pVal.get_Row())).get_Specific();
oEdit.set_Value(oCombo.get_Selected().get_Description());
I got the following error message executing the row "Item(new Integer...":
Row - Invalid index 66000-31
Using debug I saw the value of pVal.getRow() is equal to 1 (int type), i'm on the first row of the matrix.
Can you help me to solve it ?
How can I get the value of combo box selected?
Thanks in advance.
Best regards,
Andreahi,
I am puneeth. I will show u the code in vb.net...
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT And pVal.ItemUID = "Matrix1" And pVal.BeforeAction = False And pVal.ItemChanged = True And pVal.Row Then
If oForm.Items.Item("Matrix1").Specific.Columns("uom").Cells(pVal.Row).Specific.Selected.Value = "2" Then
cRow = pVal.Row
UpdateMatrix(cRow)
Else
cRow = pVal.Row
UpdateMatrix1(cRow)
End If
End If
i think by analyzing the code u can solve the problem.
to solve ur prob write code like this.
Step 1) Declare a integer variable as
Dim a as Integer
step 2) Assign variable "a" to selected value in combo like this...
a=oForm.Items.Item("Matrix1").Specific.Columns("uom").Cells(pVal.Row).Specific.Selected.Value
Regards,
Puneeth s -
How can i add colunm (fields) to matrix?
How can I add the combo box, edit text, ect.. into the row in the matrix table?
Plz give me a example.
Rgds~Hi,
U can find the required information in the following threads.
ComboBox in Matrix
ComboBox in a Matrix
UI - ComboBox in Matrix
Hope this helps,
Vasu Natari. -
How to Write values in matrix and add Rows
hi all,
i am having a problem in retrieving values
for Combobox in Matrix.
one more thing is i am not able to write to the Matrix
even after adding rows by using oMatrix.Add()
pls help me
if possible any sample code of linking columns to datasource and popping values in combobox.
Regards
omOm,
You may want to look at the samle code that comes with the SAP Business One 2005A SDK with respect to the DI API. There is a sample that shows entering a sales order in an external VB.Net app and the populating a sales order rows and header in Business One. This may five you some help.
..\Program Files\SAP\SAP Business One SDK\Samples\COM DI\VB.NET\05.OrderAndInvoice
HTH,
Eddy -
I want to make matrix with combobox column, it is not dificulte, but did somebody know is it posible with different values in each cell?
first row ( 0, Zero ), ( 1, One )
second row ( 0, Zero ), (2, Two ), (6, Six)
third row ( 0, Zero), (1, One )
.... ( Value, Description )
I make something but all cell's have the same set of pair (Value, Description )
P.S. Sorry for my englishHi Andy,
I have been playing around with this for a while now and (seeing that Ibai actually already gave you a solution) I'm just gonna post where I am up to now. I have a matrix with two columns on it (c_1 and c_2). c_1 holds the value 1, 2 or 3. Whenever the user clicks on c_2 I repopulate the combo box according to the value selected in c_1. The only problem is that it shows the second last selected row and not the one that is currently selected. I am just posting it here so it can maybe someday put someone onto the right track.
If pVal.FormTypeEx = "MainForm" Then
If pVal.ItemUID = "m_List" Then 'Matrix
If pVal.ColUID = "c_2" Then 'Column 2
If pVal.BeforeAction = False Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_GOT_FOCUS Then
Dim oForm As SAPbouiCOM.Form
Dim oEdit As SAPbouiCOM.EditText
Dim oCombo As SAPbouiCOM.ComboBox
Dim oMatrix As SAPbouiCOM.Matrix
Dim oCol As SAPbouiCOM.Column
Dim i As Integer
oForm = oApplication.Forms.ActiveForm
oMatrix = oForm.Items.Item("m_List").Specific
oCol = oMatrix.Columns.Item("c_1")
oEdit = oCol.Cells.Item(pVal.Row).Specific
oCol = oMatrix.Columns.Item("c_2")
oCombo = oCol.Cells.Item(pVal.Row).Specific
For i = oCombo.ValidValues.Count - 1 To 0 Step -1
oCombo.ValidValues.Remove(i, SAPbouiCOM.BoSearchKey.psk_Index)
Next
If oEdit.Value = "1" Then
oCombo.ValidValues.Add("1", "One")
ElseIf oEdit.Value = "2" Then
oCombo.ValidValues.Add("2", "Two")
oCombo.ValidValues.Add("22", "TwoTwo")
ElseIf oEdit.Value = "3" Then
oCombo.ValidValues.Add("3", "Three")
oCombo.ValidValues.Add("33", "ThreeThree")
oCombo.ValidValues.Add("333", "ThreeThreeThree")
End If
End If
End If
End If
End If
End If
Hope it helps,
Adele
PS: Ibai, why do you have a new user name? You are the same Ibai Peña right? -
Hi,
How do I build a Combo box in a matrix? (C#, (or VB))
I have a empty matrix which the user key in data; so after row 1, row 2 has to be created with combo box, etc.
Thank you,
RuneHi Rahul and Anand,
Thank you very much for your feedback.
I have added a combobox through Screen Painter. I have build combobox in the past, but not in a Matrix.
Here is the code to clear and fill a combobox in a form; I need the code for combo box in a matrix.
1) How do I clear a combo box in a Matrix?
2) How do I load a combo box in a Matrix?
PS
See the code for regular combo box below...
Thank you,
Rune
Clear_ComboBox("uid_Form_F03", "cbo_Sales");
SAPbouiCOM.ComboBox oComboBox = null;
oItem = oForm_MyForm.Items.Item("cbo_Sales");
oComboBox = ( ( SAPbouiCOM.ComboBox ) ( oItem.Specific ) );
Load_ComboBox(oComboBox);
private void Clear_ComboBox( string FormUID, string ItemUID )
int count;
try
if ( ( ( SAPbouiCOM.ComboBox ) ( oApplication.Forms.Item(FormUID).Items.Item(ItemUID).Specific ) ).ValidValues.Count > 0 )
count = ( ( SAPbouiCOM.ComboBox ) ( oApplication.Forms.Item(FormUID).Items.Item(ItemUID).Specific ) ).ValidValues.Count;
for ( int i = 1; i <= count; i++ )
( ( SAPbouiCOM.ComboBox ) ( oApplication.Forms.Item(FormUID).Items.Item(ItemUID).Specific ) ).ValidValues.Remove(count - i - 0, SAPbouiCOM.BoSearchKey.psk_Index);
( ( SAPbouiCOM.ComboBox ) ( oApplication.Forms.Item(FormUID).Items.Item(ItemUID).Specific ) ).ValidValues.Add("0", " ");
( ( SAPbouiCOM.ComboBox ) ( oApplication.Forms.Item(FormUID).Items.Item(ItemUID).Specific ) ).Select("0", SAPbouiCOM.BoSearchKey.psk_ByValue);
( ( SAPbouiCOM.ComboBox ) ( oApplication.Forms.Item(FormUID).Items.Item(ItemUID).Specific ) ).ValidValues.Remove(" ", SAPbouiCOM.BoSearchKey.psk_ByDescription);
catch ( Exception Error )
oApplication.MessageBox("Add-On Error: Error-3266 " + Error.Message, 1, "Ok", "", ""); // My Error Code
finally
private void Load_ComboBox( SAPbouiCOM.ComboBox oCombo )
try
oRecordset = ( ( SAPbobsCOM.Recordset ) ( oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset) ) );
vDoQuery_string = "My SELECT Statement";
oRecordset.DoQuery(vDoQuery_string);
vRecordsetCount_long = oRecordset.RecordCount;
oRecordset.MoveFirst();
oCombo.ValidValues.Add("0", "Sales Order");// Add the default value
for ( vRecordsetIndex_long = 0; vRecordsetIndex_long <= vRecordsetCount_long - 1; vRecordsetIndex_long++ )
oCombo.ValidValues.Add(System.Convert.ToString(oRecordset.Fields.Item(0).Value), System.Convert.ToString(oRecordset.Fields.Item(1).Value));
oRecordset.MoveNext();
oRecordset = null;
System.GC.Collect();
catch ( Exception Error )
oApplication.MessageBox("Add-On Error: Error-3256 " + Error.Message, 1, "Ok", "", ""); // My Error Code -
Combobox column in a user matrix
hi!
I've a user matrix in a user form whith 2 ComboBox columns. I've just filled these whith their values and descriptions. But, when the addon is running, if i select a value in a combo cell, it doesn't appear in the cell!
I explain myself: i load the form, i click on the combo column (1st row), i click on a value from the combo list, the list is closed but the cell is still empty! Why?
Please help me,
thanks
Giuseppethat's ok!
I have to add an UserDataSource!
Now it run well -
ComboBox Matrix First Line Empty
Hi,
I have build a Matrix with a combo box ( ...a old story...); but when the form loads, the first line in the combo box is empty.
I start filling the Combo Box from position 0...
Thanks
Rune
oRecordset = ((SAPbobsCOM.Recordset)(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
bool vmp_Language_EN_bool = true;
m_Language(out vmp_Language_EN_bool);
if (vmp_Language_EN_bool)
vDoQuery_string = "SELECT [Code],[U_English] FROM [dbo].[@FCSDK_PAY_TYPE]";
else
vDoQuery_string = "SELECT [Code],[Name] FROM [dbo].[@FCSDK_PAY_TYPE]";
oRecordset.DoQuery(vDoQuery_string);
vm_Recordset_Count_long = oRecordset.RecordCount;
oRecordset.MoveFirst();
SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item("mtx_F_AA").Specific;
SAPbouiCOM.Column oColumn = (SAPbouiCOM.Column)oMatrix.Columns.Item("mtxV_0");
for (vRecordsetIndex_long = 0; vRecordsetIndex_long <= vm_Recordset_Count_long - 1; vRecordsetIndex_long++)
oColumn.ValidValues.Add(System.Convert.ToString(oRecordset.Fields.Item(0).Value), System.Convert.ToString(oRecordset.Fields.Item(1).Value));
oRecordset.MoveNext();
oRecordset = null;
System.GC.Collect();Hi Rune,
I think that's the normal behavior, and is probably desirable. If the first entry were automatically displayed it would become the automatic default, whether the user chose it or not. Plus if rows get added to the source table, the one that displays first might change! You can always do an edit to make sure it is entered before processing it.
But if you really want a default, you can use the combobox.select method, right after loading it, to display whichever row you desire.
for example:
cb.Select("Visa",BoSearchKey.psk_ByDescription)
"by description" means to select the entry where the description field is = "Visa". You can also
pass it the code for visa & set the searchkey to ByValue. -
Problem with ComboBox / Matrix
Hi all,
I have this problem... when I try to populate a column with comboxbox ...
Code:
Set co = lmatrix.Columns.Add("orgDist", it_COMBO_BOX)
co.TitleObject.Caption = "Dist"
co.Editable = True
co.Visible = True
co.DataBind.SetBound True, "@DIST", "Code"
Set DBSource = lfrm.DataSources.DBDataSources.Item("@DIST")
DBSource.Query
For x = 0 To DBSource.Size - 1
tp1 = Trim(DBSource.GetValue("Code", x))
tp2 = Trim(DBSource.GetValue(3, x))
co.ValidValues.Add tp1, tp2
DBSource.Offset = x
Next
- at the 'co.ValidValues.Add tp1,tp2' I receive this error
'Valid Value - The Value Exceed boundaries'
- tp1 max value is of 8 Char
- tp2 max value is of 50 Char
I've try to insert manually the value like validvalue.add "101","23123123....213" and it work correctly..
where is my error??
Bye!!
PS: Sorry for my englishHi,
There's no problem with your code itself (however you don't need to set the DBDataSource offset, if you are only filling the ComboBox - GetValue picks the right data anyway...). It works fine (at least with 2004 PL23 + 2005 Build 119).
Looks like a problem with your data (or some "old" bug, but this would be the first time I heard about it...)?
...or did you solve it in the meantime?
Regards,
Frank -
Combobox with LinkedObject in matrix
OK,
I know, that's a lot of whishes in once, but is this
possible ????
Regards,
HolgerNo, Holger.
But you could connect a query /a formatted search to the it_LINKED_BUTTON column.
That's the standard in SAP Business One.
Regards,
Frank -
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 -
How I can know which row is parent item code or child item in matrix?
Hi,
In marketing document, when insert a item into contents page, if it is a BOM then all child item will be inserted into matrix automatically. My question is when i view the rows in matrix how i can know which row is normal master item and which row is a child item row? From the UI, i can only see the child item code looks readonly but how i can know it in my add-on code? I tried to get the edittext box object from item No. cell, but i can't find any difference.
Thanks!
LanSorry, i found an issue when i try to retrieve the BOM Type column value. I am in adding mode, when i insert a BOM with components, the bom type will appears as "Component of a Sales BOM". But in the event, when I try to get the value from this cell (it is combobox), it gives another value which is not same with the one it appears in the matrix. Is anyone know how to solve my problem?
Thanks!
Lan -
How to disable a particular CELL in matrix?????
Hi All,
I have a doubt regarding the matrix.In my matrix the first column is a combobox it has a,b,c items....so if i select 'a' the remaining 'b' & 'c' columns should get disabled....previously iam able to disable the 'b' & 'c' columns but it's disabling the total 'b & 'c' columns in my matrix.....i just want to disable the particular cell based on the combobox selection....can we disable a particular cell in matrix.....
regards,
shangai.Shangai,
here were many threads about this in last month. Try to search in history.
BTW, the particular cell cannot be disabled (only whole column), but you could make system, that the cell is enabled but you cannot click on it (when user clicks on the cell, set bubbleeevnt to fasle). -
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
Maybe you are looking for
-
5760 WLC & ISE 1.2 PEAP Issues
I have the following setup: WLC 5508 (7.4.100) WLC 5760 (03.03.02) (I'm replacing the 5508 with the 5760) ISE 1.2 Im currently running 802.1x PEAP with external AD authentication, on the 5508 and everything is working 100%. As soon as I switch the
-
2 finger pinch and 3 finger scroll stopped working
Spontaneously my 2 finger pinch and 3 finger scroll have stopped working. 4 finger not working either 2 finger right click works ok as does 2 finger scroll. I haven't changed any settings and my software updates are fine. Have tried deactivating them
-
Good afternoon, Has anyone got recommendation on the following: I have been trying to uninstall the SAP GUI and the unistall is taking for ever. I tried from the "Add/Remove programs" first and had to cancel. I have tried as well fromt he setup.exe b
-
Hello, We have a planned upgrade from XI3.0 to PI7.1 and we need to provide an estimation of efforts for support during upgrade. Unfortunately,we don't have experience for such upgrade. Also,currently our Seeburger version is 1.7.4,please let us know
-
Error (-50) when downloading from ATV and Trailers don't work - Invalid Fmt
My Apple TV syncs with an HP running Vista over an 802.11g network. I have a Watchguard Edge firewall. I can download updates and view YouTube without a problem. I have no problem downloading or renting movies on my PC. The Apple TV will not download