cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the datasources of the new form in sap business one studio

sg2707
Participant
0 Kudos

Hi,

I have created a new form

added a combo box to it

added a DBDatasource for table OPDN

the combobox alias is set to DocCur and datasource is set to OPDN

Now the combo box is not listing any info. Basically i need to query the DBDatasource with conditions. I am unable to use the DBDatasource added to form too, please give me a sample on how to get the datasource in the backend code? Also if the steps mentioned is incorrect, please help me correct it.

Accepted Solutions (1)

Accepted Solutions (1)

sg2707
Participant
0 Kudos

Hello Sam & others who get in to this trouble,

I have figured out a way and i am not sure whether there is another way to acheive this.

You can get the datasources of the form in the following way, and query it to display the data. If you are using matrix, may be you need a statement to load data from the datasource.

            SAPbouiCOM.Conditions conditions = new SAPbouiCOM.Conditions();

            SAPbouiCOM.Condition condition = null;

            SAPbouiCOM.DBDataSource opdn = null;

        

                condition = conditions.Add();

                condition.Alias = "docdate";

                condition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;

                condition.CondVal = EdDate.Value;

                //get the active form of application or using the ID

               oForm = Application.SBO_Application.Forms.ActiveForm;

                opdn = oForm.DataSources.DBDataSources.Item("OPDN");

                opdn.Query(conditions);

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Sinoj !

Former Member
0 Kudos

I got the similar situation.

In SAP Business One Studio for MS Visual studio 2012, I created a Matrix,  added a DB Data Resource for table OCRD, set the Matrix's alias to CardCode and datasource to OCRD.

But the Matrix is NOT actually bonded to OCRD...I went over the auto-generated C# codes and there's nothing about dbdataresource or OCRD.

Any input on this issue will be valuable, and will be appreciated.