Skip to main content
InSource KnowledgeCenter

TN DR116 Passing a Multi-Select from a Combo Box into a SQL Query

Description

This article from InSource shows how to configure a combo box in Dream Report to pass a multi-select into a SQL query. 

  • Author:  Rich Brooks
  • Published:  7/2/2019
  • Applies to:  ODS Dream Report v4.82 and higher

Details

Start by adding a combo box to your report.  The Combo Box is found from the Web Elements tab on the tool bar.

Capture1.PNG

The Combo Box Object is named Tag in this example.  Check the check boxes for Multi-selection and Favourite tags list.  Enter the Tag names as required in the tag list.  Click OK to save and close.

Capture2.PNG

Next, add an Expression Data Object to the report.  This object will format the list of tags selected from the combo box.

Capture3.PNG

Enter the expression OdsObjComboGetSelectedListQuoted('[on#Tag]').  OdsObjComboGetSelectedListQuoted() is one of the LUA script functions included with Dream Report.  It retrieves the list of strings selected in the combo box named Tag and parses the strings with quotes as required in the SQL query. 

The following is an example of the resulting format.

Capture4.PNG

The string from the expression data object is then passed into the SQL Query as shown in the example below.

Capture5.PNG