cancel
Showing results for 
Search instead for 
Did you mean: 

How to made Matrix columns editable and not editable?

Former Member
0 Kudos

Hi All,

I want to make a matrix columns editable false and true depend on my conditions result.

It is showing an error "Item is not user defined item" in the line **Error**

Can anybody help me to solve this problem?

my coding is as follows

   
If Trim(sValue) = "Y" Or Trim(sValue) = "Yes" Then
            objMatrix.Columns.Item("1").Editable = False
  Else
            objMatrix.Columns.Item("1").Editable = True  ' ***Error***
 End If

m_felicella
Participant
0 Kudos

private static void Event_ComboSelectAfter(SAPbouiCOM.Form oFrm, SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
{
BubbleEvent = false;
SAPbouiCOM.Folder flder;
SAPbouiCOM.Matrix oMatrix;
try
{

oFrm.Freeze(true);
CommonUtil.StatoFiltri(false);

oMatrix.Columns.Item("2007").Visible = true;
oMatrix.Columns.Item("2007").Width = 50;
((SAPbouiCOM.ComboBox)oMatrix.Columns.Item("2007").Cells.Item(pVal.Row).Specific).Active = true;
((SAPbouiCOM.CheckBox)oMatrix.Columns.Item("2007").Cells.Item(pVal.Row).Specific).Checked = true;

}

catch (Exception ex)
{

oFrm.Freeze(false);
CommonUtil.StatoFiltri(true);

}

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor

Hi,

you get this error message when you try this in a System Matrix.

the System Matrix is not a User Defined Item

-> you can't use Editable = True

lg David

Former Member
0 Kudos

Hi David,

How do my problem get resolved?

Is there is any other way to show that columns should not be edited?

Regards,

Tamil

Nussi
Active Contributor
0 Kudos

Hi,

for a System Form -> the Form Settings Window

alternative you can try to manipulate the CPRF table - but this only works when all business one are closed and

open the Business One again.

you see - there is no really good solution for you...

lg David

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

If solved this problem so:

By default I has set matrix columns property Editable=True (editable="1").


<column uid="e1UQty" type="16" title="Quantity" description="Quantity"
	visible="1" AffectsFormMode="1" width="91"
	disp_desc="0" editable="1" right_just="0" val_on=""
	val_off="" backcolor="-1" forecolor="-1" text_style="0" font_size="-1">
<databind databound="1" table="@TABLE" alias="U_Qty" />
<ExtendedObject />
</column>

After loading the form with the matrix and selectection of data into the matrix, I has set the property Editable of column Qty to True.


oMatrix.Columns.Item("e1UQty").Editable = True

Regards

Sierdna S.

Former Member
0 Kudos

Hello,

in SBO 2005A SP01 PL 46 Editable = true works (maybe only with UDF and DBDataSource) :

( (Matrix)form.Items.Item("38").Specific ).Columns.Item("U_WREDE_Discount").Editable = true;

No Error is thrown here.

(I have to use it after form.Freeze(true) to write some data in this disabled column, after that I switch again to Editable = false and then unfreeze the form. )

(I'm searching for an solution to set a UDF-column in system matrix as visible and unvisible.)

Kind regards

Christian

***

Hello, .... today it doesn't work anymore

It seems to depend on creating the UDF by code. These new fields were editable for a several time...

Edited by: Christian Bührig on Oct 21, 2008 5:42 PM

Former Member
0 Kudos

Dear Tamizharasi,

for system items, you can set a editable one enabled = false, while you cannot set uneditable enable = true.

it does make sense for protecting default data integrity.

if in your application, you really need this kind of feature, you can create your own Item, binding with the same datasource which system item binds.

then, you can set enabled = true or false, as you want.

Thanks,

Warren.

Former Member
0 Kudos

When I want to "protect" a matrix column from data entry, I use the following code

to reject input during the "key-down" event in the matrix (using bubble = false).

I use the B1DE wizard to generate the addon on, so instead of a specific function

for key down, you might wrap my code in an IF stmt like this:

(where 3 is the matrix ID on the BOM form, and 4 is the price column):

if pval.EventType =BoEventTypes.et_KEY_DOWN and pval.ItemUID = "3"

       ' Public Overridable Function OnKeyDown(ByVal pVal As ItemEvent) As Boolean

            Try

                Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)
                Dim item As Item = form.Items.Item("3")
                Dim matrix As Matrix = item.Specific

                If pVal.ColUID = "4" Then
                    B1App.MessageBox("You cannot override component prices.")
                    Return False
                End If

            Catch ex As Exception
                B1App.MessageBox(ex.ToString)
            End Try

            Return True

        End Function

Former Member
0 Kudos

Hi...

use this code

Dim OMat As SAPbouiCOM.Matrix

Dim OCols As SAPbouiCOM.Columns

Dim ocol As SAPbouiCOM.Column

Dim oitem As SAPbouiCOM.Item

oitem = OForm.Items.Item("Matrix-ID")

OMat = oitem.Specific

OCols = OMat.Columns

ocol = OCols.Item("Column-ID")

ocol.Editable = False

ocol = OCols.Item("Column-ID")

ocol.Editable = True

Regards..

Billa 2007