SELECTOR
See also
Example
Further information
Select the data that appears in a grid control animation.
WebVue support - No. Returns an unsuccessful code if used in this context.
If using a project with multiple regions, you must set the region before executing any instructions that interacts with the HMI. For further information, see the REGION topic.
How the Lines and Columns are numbered in a grid control
The data lines and columns are numbered starting at 0.
The header lines and columns (Fixed Row / Col in the Grid Properties dialog) are numbered starting at -1. Show picture
Modes
Mode |
Mnemonic |
Syntax |
1 | GETNBLINE | 1 |
2 | GETNBCOL | 1 |
3 | GETCELL | 2 |
4 | GETLINE | 3 |
5 | GETCOL | 4 |
6 | GETARRAY | 5 |
7 | PUTCELL | 6 |
8 | PUTLINE | 3 |
9 | PUTCOL | 4 |
10 | PUTARRAY | 5 |
11 | SCROLL | 7 |
12 | GETLISTART | 1 |
13 | GETNBLINEMAX | 1 |
14 | VARIABLE | 9 |
15 | VARMODE | 10 |
16 | SELECTLINE | 1 |
17 | SELECTCOL | 1 |
18 | SELECTMODE | 7 |
19 | SFIRSTCELL | 1 |
20 | SNEXTCELL | 1 |
21 | ALLSELOFF | 1 |
22 | CLICKCELL | 16 |
23 | GETSEL | 16 |
24 | SELPROG | 11 |
25 | INPUTPROG | 11 |
26 | CLEAR | 1 |
27 | SETNBLINE | 8 |
28 | GETLASTCELL | 1 |
30 | SORT | 12 |
31 | GETCELLBACKCOLOR | 13 |
32 | GETCELLTEXTCOLOR | 13 |
33 | PUTBACKCOLOR | 14 |
34 | PUTTEXTCOLOR | 14 |
35 | GETVARNAME | 15 |
36 | HISTORICAL | See the topic SELECTOR mode HISTORICAL |
37 | SETSELECTEDQUERYINDEX | 17 |
38 | GETSELECTEDQUERYINDEX | 1 |
39 | EXECQUERY | 1 |
40 | GETSELECTEDQUERYSYNTAX | 19 |
41 | SETCYCLICEXECPERIOD | 18 |
The following instructions are designed for and can only be used with the Sql grid control:
-
SETSELECTEDQUERYINDEX
-
GETSELECTEDQUERYINDEX
-
EXECQUERY
-
GETSELECTEDQUERYSYNTAX
-
SETCYCLICEXECPERIOD
All Syntaxes
Argument |
Meaning |
Window |
The name of the window that contains the grid control to be used. Type STR. |
Branch |
The branch of the window (if any). Using a "*" means the current branch of the program. Type STR. |
Identity |
The identity of the grid control animation within the specified window. Type STR. |
Syntax 1
IntVal = SELECTOR(Mode, Window, Branch, Identity);
Return type: INTEGER.
Execution
Mode |
Mnemonic |
Action |
1 |
GETNBLINE |
Returns the number of lines that may be displayed at any one time (dependent on the size of the support drawing element). |
2 |
GETNBCOL |
Returns the number of columns. |
12 |
GETLISTART |
Returns the index of the first visible line at the top of the grid control. |
13 |
GETNBLINEMAX |
Returns the total number of lines present in memory. |
16 |
SELECTLINE |
Returns the line index of the cell currently selected. Returns -1 if no cell selected. |
17 |
SELECTCOL |
Returns the column index of the cell currently selected. Returns -1 if no cell selected. |
19 |
SFIRSTCELL |
For a multiple selection, find the first selected cell searching from the beginning of the table. Use modes 16 (SELECTLINE) and 17 (SELECTCOL) to obtain the position of the cell found. Returns 1 if a cell has been found else 0. |
20 |
SNEXTCELL |
For a multiple selection, find the next selected cell starting from the last cell found with the same function or with mode 19 (SFIRSTCELL). Use modes 16 (SELECTLINE) and 17 (SELECTCOL) to obtain the position of the cell found. The search is made from left to right then top to bottom. Returns 1 if a cell as been found else 0. |
21 |
ALLSELOFF |
Deselect all the selected cells of a table. |
26 |
CLEAR |
Reset the table. |
28 |
GETLASTCELL |
Returns the number of lines used. |
38 | GETSELECTEDQUERYINDEX |
Returns the index of the selected Sql query. Returns -1 if no query selected. |
39 | EXECQUERY |
Executes the selected Sql query. Returns 1 if OK, else 0. |
All modes return 0 if unsuccessful (incorrect parameter or executed in WebVue context). |
Syntax 2
StrVal = SELECTOR(Mode, Window, Branch, Identity, Line, Column);
Return type: STR.
Argument |
Meaning |
Line |
The index of a line. Type INTEGER. |
Column |
The index of a column. Type INTEGER. |
Execution
Mode |
Mnemonic |
Action |
3 |
GETCELL |
Return the contents of the cell pointed to by the line and column index. Line and column indices both start at 0. Return: An empty string if unsuccessful (incorrect parameter or executed in WebVue context). |
Syntax 3
LongVal = SELECTOR(Mode, Window, Branch, Identity, Line, Hbuf, Csepa);
Return type: LONG.
Argument |
Meaning |
Hbuf |
The location (handle) of a memory buffer as returned by ALLOC_BUFFER. Type LONG. |
Csepa |
A single character used as a delimiter for the text in each column. Type STR. |
Execution
Mode |
Mnemonic |
Action |
4 |
GETLINE |
Get the contents of the line Line and store it in the memory buffer Hbuf. |
8 |
PUTLINE |
Write the contents of the line Line using the contents of the memory buffer Hbuf. |
Return: 0 if unsuccessful (incorrect parameter or executed in WebVue context). |
Syntax 4
LongVal = SELECTOR(Mode, Window, Branch, Identity, Col, Hbuf, Lsepa);
Return type: LONG.
Argument |
Meaning |
Hbuf |
The location (handle) of a memory buffer as returned by ALLOC_BUFFER. Type LONG. |
Lsepa |
A single character used as a delimiter at the end of each line. Type STR. |
Execution
Mode |
Mnemonic |
Action |
5 |
GETCOL |
Get the contents of the column Col and store it in the memory buffer Hbuf. |
9 |
PUTCOL |
Write the contents of the column Col using the contents of the memory buffer Hbuf. |
Return: 0 if unsuccessful (incorrect parameter or executed in WebVue context). |
Syntax 5
LongVal = SELECTOR(Mode, Window, Branch, Identity, Hbuf, StartLine, StartCol, EndLine, EndCol, CLsepa);
Return type: LONG.
Argument |
Meaning |
Hbuf |
The location (handle) of a memory buffer as returned by ALLOC_BUFFER. Type LONG. |
StartLine |
The index of a line. Type INTEGER. |
StartCol |
The index of a column. Type INTEGER. |
EndLine |
The index of a line. Type INTEGER. |
EndCol |
The index of a column. Type INTEGER. |
CLsepa |
Two characters used as delimiters for the text in each column and line. Type STR. |
Execution
Mode |
Mnemonic |
Action |
6 |
GETARRAY |
Get the contents of the cell range specified by StartLine, StartCol and EndLine, EndCol and store it in the memory buffer Hbuf. |
10 |
PUTARRAY |
Write the contents of the cell range specified by StartLine, StartCol and EndLine, EndCol using the contents of the memory buffer Hbuf. |
Return: 0 if unsuccessful (incorrect parameter or executed in WebVue context). |
In both modes, the two characters supplied by CLsepa are used as column and line delimiters.
Syntax 6
IntVal = SELECTOR(Mode, Window, Branch, Identity, Line, Column, Chain);
Return type: INTEGER.
Argument |
Meaning |
Line |
The index of a line. Type INTEGER. |
Column |
The index of a column. Type INTEGER. |
Chain |
A character string. Type STR. |
Execution
Mode |
Mnemonic |
Action |
7 |
PUTCELL |
Write the supplied Chain into the cell specified by Line and Column. Return: 0 if unsuccessful (incorrect parameter or executed in WebVue context). |
Syntax 7
IntVal = SELECTOR(Mode, Window, Branch, Identity, OpMode [, LineNb]);
Return type: INTEGER.
Argument |
Meaning |
OpMode |
A number indicating (according to the Mode selected) the operational mode for the grid control. |
LineNb |
A number indicating a specific line. Type INTEGER. |
Execution
Mode |
Mnemonic |
Action |
|
11 |
SCROLL |
Scroll the contents of the grid control. The OpMode argument provides the scroll mode: 1 TOBEGIN - Scroll to the start of the grid content. |
|
18 |
SELECTMODE |
Change the response of the cells to user actions. The OpMode argument defines the behavior: 0 OFF - Disables cell selection and interaction. |
|
|
|
Return: 1 if OK, else 0 (incorrect parameter or executed in WebVue context). |
Syntax 8
IntVal = SELECTOR(Mode, Window, Branch, Identity, LineNb);
Return type: INTEGER.
Argument |
Meaning |
LineNb |
A number indicating a specific line. Type INTEGER. |
Execution
Mode |
Mnemonic |
Action |
27 |
SETNBLINE |
Define the last line that can be made visible by scrolling. If the lines currently visible are greater than the new LineNb value, the table is position to the new value. |
|
|
Return: 1 if OK, else 0 (incorrect parameter or executed in WebVue context). |
Syntax 9
IntVal = SELECTOR(Mode, Window, Branch, Identity, Filter, VarType);
Return type: INTEGER.
Argument |
Meaning |
Filter |
A filter, applied to the variable name, for the variables that are displayed. Depending on how the grid control is configured, either:
|
VarType |
An integer defining the type of variable: 1 Bits |
Any combination may be used, for example, 3 (1 + 2) would correspond to Bits and Alarms.
Execution
Mode |
Mnemonic |
Action |
14 |
VARIABLE |
Display a list of variables and their real time values in a two column grid control. The variables that are displayed are filtered according to the parameters Filter and VarType. |
|
|
Return: 1 if OK, else 0 (incorrect parameter, syntax error in the filter, grid control not in variable tracking mode, or executed in WebVue context). |
To use this mode, the variable tracking property of the grid control must first be set.
If a variable has the command attribute set the background color of its value display will correspond to that in the grid control definition for a selected cell. The value of the variable may be changed by clicking on the cell displaying its value.
When using the grid control to display the value of variables in the database, only variables in the visible area of the grid control are subscribed and have their real time values updated.
Syntax 10
IntVal = SELECTOR(Mode, Window, Branch, Identity, VarType);
Return type: INTEGER.
Argument |
Meaning |
VarType |
An INTEGER defining what to display for the variable: 0 Variable name |
Execution
Mode |
Mnemonic |
Action |
15 |
VARMODE |
Display a list of variable names and their properties according to VarType. |
|
|
Return: 1 if OK, else 0 (incorrect parameter or executed in WebVue context). |
Syntax 11
IntVal = SELECTOR(Mode, Window, Branch, Identity, Program, Branch, Function [Farg]);
Return type: INTEGER.
Argument |
Meaning |
Program |
Program name. Type STR. |
Branch |
Branch name. Type STR. |
Function |
Function name. Type STR. |
Farg |
Optional. String of 2,047 characters maximum, used to pass from 1 to 8 arguments separated by "," (comma) to the function. These arguments can be retrieved in the called function using the verb GETARG. |
Execution
Mode |
Mnemonic |
Action |
24 |
SELPROG |
Specify a function that will be executed when a cell of the table is clicked. The table must be in MONO or MULTI mode. |
25 |
INPUTPROG |
Specify a function that will be executed when a cell of the table is clicked. A dialog box provides the operator with the option to confirm or cancel. The table must be in INPUT mode. |
|
|
Return: 1 if OK, else 0 (incorrect parameter or executed in WebVue context). |
Syntax 12
IntVal = SELECTOR(Mode, Window, Branch, Identity, Column, Flag);
Return type: INTEGER.
Argument |
Meaning |
Column |
Column number. Type INTEGER. |
Flag |
A flag indicating the sort order. Type INTEGER. 0 or greater: ascending Less than 0: descending. |
Execution
Mode |
Mnemonic |
Action |
30 |
SORT |
The contents of the table are sorted using the contents of the specified column. The sort order is according to the ASCII code of the characters in each cell. |
|
|
Return: 1 if OK, else 0 (incorrect parameter or executed in WebVue context). |
Syntax 13
Color = SELECTOR(Mode, Window, Branch, Identity, Line, Column);
Return type: LONG.
Argument |
Meaning |
Line |
The index of a line. Type INTEGER. |
Column |
The index of a column. Type INTEGER. |
Color | A color as a byte weighted value to code an RGB value. Red is byte 0, green byte 1 and blue byte 2. For example,, red is 255, green 65280 and yellow (red + green) 65535. Type LONG. |
Execution
Mode |
Mnemonic |
Action |
31 |
GETCELLBACKCOLOR |
Return the background color of a cell as a byte weighted value. |
32 |
GETCELLTEXTCOLOR |
Return the text color of a cell as a byte weighted value. |
Return: 0 if unsuccessful (incorrect parameter or executed in WebVue context). |
Syntax 14
IntVal = SELECTOR(Mode, Window, Branch, Identity, StartLine, StartCol, EndLine, EndCol, Color);
Return type: INTEGER.
Argument |
Meaning |
StartLine |
The index of a line. Type INTEGER. |
StartCol |
The index of a column. Type INTEGER. |
EndLine |
The index of a line. Type INTEGER. |
EndCol |
The index of a column. Type INTEGER. |
Color |
The color as a byte weighted value. Type LONG. |
Execution
Mode |
Mnemonic |
Action |
33 |
PUTBACKCOLOR |
Change the background color of a range of cells to the color given by the Color parameter. The range of cells is defined by the StartLine, StartCol, EndLine, EndCol parameters. |
34 |
PUTTEXTCOLOR |
Change the text color of a range of cells to the color given by the Color parameter. The range of cells is defined by the StartLine, StartCol, EndLine, EndCol parameters. |
Return: 1 is OK, else 0 (incorrect parameter or executed in WebVue context). |
Syntax 15
StrVal = SELECTOR(Mode, Window, Branch, Identity, LineNb);
Return type: STR.
Argument |
Meaning |
LineNb |
The index of a line. Type INTEGER. |
Execution
Mode |
Mnemonic |
Action |
35 |
GETVARNAME |
Returns the name of the variable in the specified line when the grid control is in variable tracking mode. Return: The variable name or an empty string if unsuccessful (incorrect parameter or executed in WebVue context). |
Syntax 16
IntVal = SELECTOR(Mode, Window, Branch, Identity, Line, Column);
The return type: INTEGER.
Argument |
Meaning |
Line |
The index of a line. Type INTEGER. |
Column |
The index of a column. Type INTEGER. |
Execution
Mode |
Mnemonic |
Action |
22 |
CLICKCELL |
Simulate a click of the mouse on the cell specified by Line and Column. Returns 1 if OK, else 0. |
23 |
GETSEL |
Check whether a cell is selected. Returns 1 if the cell is selected, else 0. |
Return: 0 if unsuccessful (incorrect parameter or executed in WebVue context). |
Syntax 17
IntVal = SELECTOR(Mode, Window, Branch, Identity, Index);
Return type: INTEGER.
Execution
Mode |
Mnemonic |
Action |
37 |
SETSELECTEDQUERYINDEX |
Sets the Sql query at Index as Selected for execution. Returns 1 if OK, else 0. |
Syntax 18
IntVal = SELECTOR(Mode, Window, Branch, Identity, Hours, Minutes, Seconds);
Return type: INTEGER.
Execution
Mode |
Mnemonic |
Action |
37 |
SETCYCLICEXECPERIOD |
Changes the value of the timer to trigger the selected Sql query cyclically. Returns 1 if OK, else 0. |
Syntax 19
StrVal = SELECTOR(Mode, Window, Branch, Identity);
Return type: STR.
Execution
Mode |
Mnemonic |
Action |
40 | GETSELECTEDQUERYSYNTAX |
Returns the syntax of the selected Sql query. Returns an empty string if unsuccessful (incorrect parameter or executed in WebVue context). |
Example
For an example, select the Example link above.