1. Home
  2. SelectList

SelectList

◷ Reading Time: 2 minutes

Summary

This command is very similar to SelectRow command the difference is it builds a list for values based on the return result from query. If one column is selected from SELECT command, then the list contains all the values for that selected column only. If multiple columns are selected, then the list contains complex object that the values of column can be access by object properties.

Parameters

  1. command
    1. Description: The Select command
    2. Mandatory: Yes
    3. Type: String
  2. return
    1. Description: Name of the variable in which the row will be stored
    2. Mandatory: Yes
    3. Type: String
  3. storedProcedure
    1. Description: Determines whether the command should execute a stored procedure in the database
    2. Mandatory: No
    3. Type: Boolean (true/false). Default is true.
  4. multi
    1. Description: Indicates whether the Select command will return multiple rows
    2. Mandatory: No
    3. Type: Boolean (true/false)

Internal Commands

Param

This command sends a Break command to the execution flow iterating inside a Do command.

Sample

Return list is a list of string values:

<Database connection-ref="cnn" type="MsSql">
  <SelectList command="select ([Made]+'-'+[Model]) as Car from [dbo].[HighRiskCars]" return="listResults"/>
</Database>
 
<!-- This will read the first value which is a string -->
<Var name="firstItem" value="listResults[0]"/>

Return list is a list of objects that have two properties: made and model

<Database connection-ref="cnn" type="MsSql">
  <SelectList command="select [Made] as made, [Model] as model from [dbo].[HighRiskCars]" return="listResults"/>
</Database>
 
<!-- This will read the 'made' property of the first item in the list -->
<Var name="firstItem" value="listResults[0].made"/>
Updated on May 30, 2019

Was this article helpful?