cancel
Showing results for 
Search instead for 
Did you mean: 

Matrix Rows

Former Member
0 Kudos

Dear All Experts,

I am trying to check some conditions in the matrix rows. If there are 10-20 rows all is fine. But if there is more than 100 Rows then my add-on works very slow.

How to resolve that ?

plz reply.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Amit,

Please explain a bit:

1. Are you checking the condition Row by Row ? Also do you want to check Row by Row ?

2. Is it a user defined Form ?

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

Yes I want to check it Row by Row. also it is a user defined form.

Regards

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Amit,

Also please tell me what you are using till now ?

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

I am using the For loop upto all Matrix rows.

Regards

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Amit,

That For loop is creating the problem for you.

You can use the DBDataSource for your purpose. Just loop through the DBDataSource & check you condition and perform whatever you want.

Hope it helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

Please provide me some lines of code to do this.

Plz help.

Regards

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Amit,

I will have to search for that. Please give me some time. I will make you available once I will get that.

Thanks & Regards

Ankit Chauhan

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Amit,

For a test I have written it. you can use it accordingly:

private SAPbouiCOM.DBDataSource  dBDataSourceChild;

dBDataSourceChild = oForm.DataSources.DBDataSources.Item("@ACTDETAILTABLE");

SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item(enControlName.Matrix).Specific;

                                            try

                                            {

                                                if (oMatrix.VisualRowCount > 0)

                                                {

                                                    oMatrix.FlushToDataSource();

                                                    int count = dBDataSourceChild.Size;

                                                    for (int i = count - 1; i >= 0; i--)

                                                    {

                                                        string strCode = dBDataSourceChild.GetValue("U_Code", i).ToString().Trim();

                                                        string strName = dBDataSourceChild.GetValue("U_Name", i).ToString().Trim();

                                                        if (strCode == "" && strName == "")

                                                        {

                                                            dBDataSourceChild.RemoveRecord(i); // Write your own logic here.

                                                        }

                                                    }

                                                    oMatrix.LoadFromDataSource();

                                                }

                                            }

                                            catch

                                            {

                                                throw;

                                            }

Hope it helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

Thanks for the reply.

I am getting Invalid Datasource error.

Regards

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Amit,

Make sure that you are using the correct Table Name with @.

Also field name should be the same as in Database like U_FieldName.

Also refer this thread:

Hope it helps.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi,

Thanks... Its done.

Regards

Answers (0)