You are here: Core Reference > Coding > Scripting > Query.SelectedRow

Query.SelectedRow

The Query Control Object that is returned by the AddQuery function has a SelectedRow property. The SelectedRow property represents the currently selected row in the Queries List box.

Syntax

ControlObject.SelectedRow = <index number>

Where ControlObject is the name of the variable (declared in your script) that is used to store the Query Control Object that is returned by the AddQuery function.

Description

Represents the currently selected row on the Queries List box. Typically, the SelectedRow value is used as an input for another function.

Arguments

<Index Number>

The number of the list item that is currently selected. If no item is selected in the list, the Index Number is -1. The first item in the list has the Index Number of 0, the second an Index Number of 1, the third an Index Number of 2 and so on.

Do not enter the angle brackets < >.

Returns

None.

Example:

In this extract from a script, the SelectedRow property is used to determine what is displayed in a message box. If the SelectedRow property has a value of -1, it means there are no items in the Queries List box currently selected and so the message box contains the message "No row selected". If the SelectedRow property contains any other value, the message box displays a message stating the name and type of the selected item.

  • If Q.SelectedRow = -1 Then
    • MsgBox "No row selected"
  • Else
  • Dim Name, TypeDesc
    • Name = Q.Value( Q.SelectedRow, 0 )
    • TypeDesc = Q.Value( Q.SelectedRow, 1 )
    • MsgBox "You clicked on " & Name & " which is a " & TypeDesc
  • End If

ClearSCADA 2015 R2