cancel
Showing results for 
Search instead for 
Did you mean: 

New column in existing matrix (formtype=133)

Former Member
0 Kudos

Hi all,

i have a question:

if i try to add with code a custom column in matrix's form=133, i don't add the new column.

Therefore, i add the new column with Sap Business One Client and this column is the last column of my matrix.

It's possible to add column in existing matrix with code?

Best Regards

Serema

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Dear John,

i have tried your mode, but i have the same error.

my code:

righe = 7

Set frm = SBO_Application.Forms.Item(FormUID)

Set matrice = frm.Items("38").Specific

matrice.DeleteRow (righe)

Set oColumns = matrice.Columns

Set oColumn = oColumns.Add("Nr", it_EDIT)

oColumn.TitleObject.Caption = "Nr"

oColumn.Width = 30

oColumn.Editable = False

Set dbEdit = frm.DataSources.DBDataSources.Add("INV1")

oColumn.DataBind.SetBound True, "INV1", "U_BNVuotP"

matrice.AddRow (righe)

Best regards

Serema

Former Member
0 Kudos

Why delete row 7? It is normally row 1 that has the data, try changing to

matrice.deleterow 1

.

.

matrice.addrow

(I dont think you will need a parameter on the addrow)

John.

Former Member
0 Kudos

dear john.

SDK Version 6.5

I wish add on new column in existing matrix to Batch Transaction Report.

what i doing?

I'm sorry.

Give me a source please.

email : sbumkim@daebosystem.com <== source please.

Message was edited by: kim sung bum

Former Member
0 Kudos

I added a new user defined field "U_BNVuotP" to "OITM" with oUserFieldsMD, and then

tried to add a new column into existing matrix with

the sample code, but failed.

Error message is

"Data Source - Alias Not Found"

at the following line.

oColumn.DataBind.SetBound True, "INV1", "U_BNVuotP"

Could you please help me?

Message was edited by: Jinsuh Lee

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

If you add a new User Defined Field in a System Form the column will automatically be added to the Matrix (it will also be automatically linked with the corresponding DBDataSource).

Usually it will be added after the last existing one.

If you cannot see it you must go to the SAP Business One "Form Settings" icon in the ToolBar and select the columns you want to see.

Hope it helps

Trinidad.

Former Member
0 Kudos

Sorry.

I added a new user defined field "U_BNVuotP"

not to "INV1" but to "OITM" which is different from

the System form to which a new column will be added.

In that case, the error occured

"Data Source - Alias Not Found"

at the following line.

oColumn.DataBind.SetBound True, "INV1", "U_BNVuotP"

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Which event are you catching to add the row?

Can you please show your code?

You need to modify the form everytime it is loaded, and to add a row the matrix must have no rows... How do you do it?

I have tried my self to add a column in a system form(removing all rows before) and I have the same error as you.

I think you must create a message into the Service Marketplace, I'm not sure wether or not this functionality is allowed.

Please post a message if you have an answer.

Regards

Trinidad.

Answers (1)

Answers (1)

Former Member
0 Kudos

My code for to add column in the existing matrix:

Case et_FORM_LOAD

Set frm = SBO_Application.Forms.Item(FormUID)

Set matrice = frm.Items("38").Specific

Set oColumns = matrice.Columns

Set oColumn = oColumns.Add("Nr", it_EDIT)

oColumn.TitleObject.Caption = "Nr"

oColumn.Width = 30

oColumn.Editable = False

Set dbEdit = frm.DataSources.DBDataSources.Add("INV1")

oColumn.DataBind.SetBound True, "INV1", "U_BNVuotP"

But i have an error in row:

oColumn.TitleObject.Caption = "Nr"

Why?

Serema

Former Member
0 Kudos

You can't add columns to a matrix when it has rows. When you open a system form, the matrix will already have a row in it with blank values displayed.

Try deleting the existing row before adding the column, and then re-adding the blank row after you have finished.

matrice.deleterow

.

.

.

matrice.addrow

John.