on 09-08-2009 9:12 AM
Hi
I try to set some values on matrix object using EditText string property.
I have this simple code
...
Cell cell1 = matrix.Columns.Item("col_5").Cells.Item(pVal.Row);
EditText editText1 = (EditText)cell1.Specific;
editText1.String = sTotal;
Cell cell2 = matrix.Columns.Item("col_6").Cells.Item(pVal.Row);
EditText editText2 = (EditText)cell2.Specific;
editText2.String = sTotal1;
...
but when it reaches editText1.String = sTotal line it goes back to Cell cell1...
It goes then on and on unitl SAP crashes.
What is the problem?
Thanks in advance
Kamil
Dear Kamil,
By SAP Note 700670, To prevent performance problems, we recommend that you use the
data sources to fill matrix object cells instead of filling the matrix cell by cell.
Here the sample code in the Note 700670:
'Define different user data sources
Set us_col1 = frm.DataSources.UserDataSources.Add
"us_col1", SAPbouiCOM.dt_SHORT_TEXT, 10
Set us_col2 = frm.DataSources.UserDataSources.Add
"us_col2", SAPbouiCOM.dt_SHORT_TEXT, 10
Set us_col3 = frm.DataSources.UserDataSources.Add
"us_col3", SAPbouiCOM.dt_SHORT_TEXT, 10
Set us_col4 = frm.DataSources.UserDataSources.Add
"us_col4", SAPbouiCOM.dt_SHORT_TEXT, 10
Set us_col5 = frm.DataSources.UserDataSources.Add
"us_col5", SAPbouiCOM.dt_SHORT_TEXT, 10
'associate columns with data sources
Set col1 = mtx.Columns.Add
("col1", SAPbouiCOM.it_EDIT)
col1.DataBind.SetBound True, "", "us_col1"
Set col2 = mtx.Columns.Add
("col2", SAPbouiCOM.it_EDIT)
col2.DataBind.SetBound True, "", "us_col2"
Set col3 = mtx.Columns.Add
("col3", SAPbouiCOM.it_EDIT)
col3.DataBind.SetBound True, "", "us_col3"
Set col4 = mtx.Columns.Add
("col4", SAPbouiCOM.it_EDIT)
col4.DataBind.SetBound True, "", "us_col4"
Set col5 = mtx.Columns.Add
("col5", SAPbouiCOM.it_EDIT)
col5.DataBind.SetBound True, "", "us_col5"
'Fills matrix
For ii = 0 To 19
For jj = 0 to colNum
frm.DataSources.UserDataSources(jj).Value = "stam" & ii
&& jj
Next jj
'After setting all the relevant data sources and the line to matrix
mtx.AddRow
Next ii
Best Regards
Jane Jing
SAP Business One Forums team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jane
This is in some sense funny because I wanted to avoid using data source method because it produces
this nasty scroll behaviour that is unacceptable.
I tried different solutions to this problem without any good solution and that is why I turned into filling my column
cell by cell.
When I have a matrix that have 300 columns and I want to change something at, for instance, column 234 I have to recompute
and show the results.
I used load from data source method but it rewinds back to the beginning of the matrix.
This behaviour is unacceptable for my client.
As I said I tried different solutions but none of them work the way it should.
I will try to use user data sources and see if it will solve my problem.
Thanks
Kamil
Funny, I found the problem cause of FMS that Return More Than 1 Value.
So work around is
oForm.DataSources.DBDataSources.Item(Object Name).SetValue(Field Name, Record Number - 1, New Value)
oMatrix.LoadFromDataSource()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Kamil,
By SDK help the Column Type list in BoFormItemTypes Enumeration:
Member Description
it_BUTTON Button. Not relevant for column type.
it_STATIC Static text. Not relevant for column type.
it_EDIT Text Box.
it_FOLDER Pipe. Not relevant for column type.
it_RECTANGLE Frame rectangle. Not relevant for column type.
it_COMBO_BOX Combo Box (List Box, Popup, etc.)
it_LINKED_BUTTON Link arrow to other items.
it_PICTURE Image.
it_EXTEDIT Text Box with multiple lines.
it_CHECK_BOX Check Box.
it_OPTION_BUTTON Option Button. Not relevant for column type.
it_MATRIX Matrix (table). Not relevant for column type.
it_GRID Table.
it_PANE_COMBO_BOX Pane Combo Box. Not relevant for column type.
it_ACTIVE_X ActiveX object.
Please make sure use the it_EDIT type for your column.
Best Regards
Jane Jing
SAP Business One Forums team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry If I wasn't clear enough.
The part of code I have trouble with is outside of loop in a sense of language construct.
When I go into the debugger it goes like this
line1
then
line 2
then
line3
Oops, some problem it goes back to line 1.
It goes on and on until it crashes.
I don't use any loop myself.
Here is the part that "loops"
Cell cell2 = matrix.Columns.Item("col_6").Cells.Item(pVal.Row);
EditText editText2 = (EditText)cell2.Specific;
editText2.String = sTotal;
Hi Kamil,
Had you seen my earlier post in the same thread, perhaps that code piece might solve your problem in this problem. That one line of mine will suffice all three lines you have written. Moreover, try getting the value in the field using a msg box before and after that given line.
Regards,
Satish. B.
Sorry Satish but when I use (as You suggested)
((SAPbouiCOM.EditText)matrix.Columns.Item("col_5").Cells.Item(pVal.Row).Specific).String = sTotal;
it is looping on the same line over and over (until it finally crashes)
I tried moving my code to different places. Still the same behaviour.
Type of my column is indeed it_EDIT so it should work.
I wonder if this is due to the fact that I'm using B1DE. After all it is additional layer of code.
Edited by: kamil_w on Sep 9, 2009 11:40 AM
Edited by: kamil_w on Sep 9, 2009 11:43 AM
Dear kamil_w,
What column type of "col_5" and what data type do you bind with the column "col_5"? Is it EditText type?
Best Regards
Jane Jing
SAP Business One Forums team
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Kamil,
Don't use the cell object at all. Rather, use the Edit Text property directly. Check the below piece of code.
((SAPbouiCOM.EditText)oMatrix.Columns.Item(3).Cells.Item(Row).Specific).Value = strValue;
Hope this helps.
Regards,
Satish.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
11 | |
11 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.