Get index of element Version 13 (Java)
Action group: Collections
Description
Gets the sequence number of the item position whose value is equal to the specified value.
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Collection | Collection to check | Robin.Collection | Yes | |
Value | Value to check | Robin.Object | Yes | |
Results | ||||
Index | Numeric variable containing the index of the element with the specified value, or -1 if the element was not found | Robin.Numeric |
Special conditions of use
If there are multiple identical values in the collection, it determines the index of the first in order.
Example of use
Task
There is a variable "Collection 1" with a list of cities containing 10 entries. It is required to determine the index under which the city Moscow is recorded and output the value in the dialog box.
Solution
Use the "Get index of element" and "Show message" actions.
Implementation
- Assemble a robot scheme consisting of actions:
- Set the parameters of the "Get index of element" action.
- Set the parameters of the "Show message" action.
- Start the robot using the "Start" button in the top panel.
Result
The program robot completed successfully.
The desired value of the Moscow city position is displayed in the dialog box.
Обзор
Инструменты контента