cancel
Showing results for 
Search instead for 
Did you mean: 

ComboBox and DataTable

Former Member
0 Kudos

Hey All,

I have found a lot of posts on here about adding values to a combo box using the valid values collection. I am trying to assign a datatable to the Combobox in my case. I add my datatable in the xml and assign a query to it. Then I assign that to the databind property of the combobox and when the form loads it only displays the 1st record in the query.

Any ideas what I am doing wrong?

I basically just want to display the list of item groups in my combo box without manually adding these to the valid values collection.

Curtis

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Curtis.

If it can help you this is some methods used in my programs:

1) ValidValues in xml file


<item uid="cType" type="113" left="100" tab_order="0" 
         width="150" top="10" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="1" 
         right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" 
         AffectsFormMode="1">
  <AutoManagedAttribute /> 
  <specific AffectsFormMode="1" TabOrder="0">
   <ValidValues>
    <action type="add">
     <ValidValue value="A" description="AAA" /> 
     <ValidValue value="E" description="EEE" /> 
     <ValidValue value="B" description="BB" /> 
     <ValidValue value="D" description="DD" /> 
    </action>
   </ValidValues>
  <databind databound="1" table="@TABLE_A" alias="U_TYPE" /> 
 </specific>
</item>

2) Add ValidValues to combobox.


Private Sub CreateForm()

    Dim oForm As SAPbouiCOM.Form
    Dim oComboBox As SAPbouiCOM.ComboBox

    Set oForm = SBO_Application.Forms.Add("MYFORM")

    oForm.DataSources.UserDataSources.Add "DS", dt_SHORT_TEXT, 20

    Set oComboBox = oForm.Items.Add("cCombo1", it_COMBO_BOX).Specific

    oComboBox.DataBind.SetBound True, "", "DS"

    oComboBox.ValidValues.Add "A", "Value A"
    oComboBox.ValidValues.Add "B", "Value B"
    oComboBox.ValidValues.Add "C", "Value C"
End Sub

3) Add Linked Table for field.

See this thread [User defined Valid values in SBO|;

4) Recordset

See this thread [Fill values in combobox from database table|;

5) LoadSeries Method (look SDK Help)

Other ways I don't know.

Best regards

Sierdna S.

Former Member
0 Kudos

Thanks for the help.

I have seen many of these examples.

I am trying to link my combo box directly to a datatable object. This way I wouldn't have to add things to the valid values etc...

Answers (0)