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

Setting EditText value problem.

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 10:20 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Sep 08, 2009 at 08:56 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Satish but unfortunately it doesn't change anything.

      Still I got this strange behaviour where it loops unit SAP crashes.

      I wonder if this problem is because I have this column data bounded.

      But I can change this column' value by hand.

      Thanks anyway

      Kamil

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 06:20 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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hello Jane

      My column' type is 16 whatever that means and I have this column data bounded to db data source.

      I'm wondering if the fact that it's bounded counts but I want to change value of the matrix cell only.

      I created my addon with B1DE. (UDO)

      Thanks

      Kamil

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 08:46 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

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.