cancel
Showing results for 
Search instead for 
Did you mean: 

How to Use ChooseFromList with a DataBind Matrix

Former Member
0 Kudos

Hi there,

I get a problem with DataBind Matrix, I like to show CFL

in one column in Matrix, the Matrix bind with a DBDataSource,when user press TAB Key in the cell that link with CFL, it show the CFL dialog, the problem is after user choose one row from CFL, I should fill the cell with the choose value, but the datasource do not content the new value, the CFL will show again, do I need add the new row to DB and Load data from datasource again, or have other better way to show CFL and fill the choose value as user input value?

Thanks in advance!

Lanjun Wang

Accepted Solutions (1)

Accepted Solutions (1)

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Lanjun,

Once you select a row from the CFL you will receive an event of type SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST.

You must catch this event, inside it you have the information about the content selected in the CFL by using:

eventCFL.SelectedObjects.GetValue(0, 0)

You only have to fill your DBDataSource with this value, it isn't done automatically.

Hope it helps

Trinidad.

Former Member
0 Kudos

Trinidad, Thank you very much!

Would you please share some sample code, that fill

the DBDataSource and I wornder after fill DBDataSource,

How dose the Matrix show the choose value, is it show the

value in Matrix automatically or I need use some way to

show the value.

Thanks again!

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Lanjun,

You must refresh the DBDataSource value and then call LoadFromDataSource to refresh the matrix.

Here you have a sample to place on the code receiving the event et_CHOOSE_FROM_LIST:

oForm.DataSources.DBDataSources.Item("@MY_TABLE").SetValue("Code", recordIndex, eventCFL.SelectedObjects.GetValue(0, 0))

oMatrix.LoadFromDataSource()

Hope it helps

Trinidad.

Message was edited by: Trinidad Martinez

Former Member
0 Kudos

Hi, Trinidad

Thank you very much!

Actually this problem solved this morning,

I use DBDataSoure set value and Matrix.SetLineData

to show the value in Matrix, it works perfectly.

Many thanks!

Lanjun

Former Member
0 Kudos

Can u please show me how have u uset setlindata in matrix to set the value in one of column

Former Member
0 Kudos

Hi Harshad,

Try this......


Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
                       If pVal.BeforeAction = False Then
                            Dim db1 As SAPbouiCOM.DBDataSource = frm.DataSources.DBDataSources.Item("@DetailTableName")
                            Dim mat As SAPbouiCOM.Matrix = frm.Items.Item("matMatrix").Specific
                            Dim cflevent As SAPbouiCOM.ChooseFromListEvent = pVal
                            Dim cfl As SAPbouiCOM.ChooseFromList
                            Dim a As String = cflevent.ChooseFromListUID
                            cfl = frm.ChooseFromLists.Item(a)
                            Dim dt As SAPbouiCOM.DataTable = cflevent.SelectedObjects

                            If Not (dt Is Nothing) Then
                               If cfl.UniqueID = "ItemCFL" Then
                                    If pVal.Row = mat.VisualRowCount Then
                                        db1.Offset = db1.Size - 1
                                        db1.SetValue("U_ItemID", db1.Offset, "")
                                        db1.SetValue("U_ItemDesc", db1.Offset, "")
                                        mat.SetLineData(db1.Size)
                                        mat.FlushToDataSource()
                                    End If
                                    db1.SetValue("U_ItemID", db1.Offset, dt.GetValue(0, 0))
                                    db1.SetValue("U_ItemDesc", db1.Offset, dt.GetValue(1, 0))
                                    mat.SetLineData(pVal.Row)
                                    mat.FlushToDataSource()
                                End If
                            End If
	End if

Former Member
0 Kudos

thanks

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks it worked