- 27 Feb 2024
- 2 Minutes to read
- Print
- DarkLight
Index of Item in List
- Updated on 27 Feb 2024
- 2 Minutes to read
- Print
- DarkLight
Step Details | |
Introduced in Version | 4.0.0 |
Last Modified in Version | 7.12.0 |
Location | Data > List |
The Index of Items in List step is used to find the index of an item in a list, with the index starting at zero. The step accomplishes this task by taking in user-defined ListType, values of that ListType, and a single item to find from that list. The step then evaluates to find the item's index with the given list.
Properties
Data
Property | Description | Data Type |
---|---|---|
ListType | The desired data type that the step will evaluate for. | --- |
Case Insensitive | If set to true, the search is insensitive to the case (e.g., "apple" and "Apple" would be considered the same). If set to false, the search is case-sensitive. | Boolean |
Use Property | This setting is likely used when the ListType is a complex data type. A complex type contains multiple properties or fields. This setting determines whether you want to find the index based on a specific property/data field of the complex data type. | Boolean |
Key Property Name | It specifies the name of the property within the complex data type that should be used to identify the item. The index will be determined based on the values of this property within the list of complex types. | --- |
Inputs
Property | Description | Data Type |
---|---|---|
Item to Find | Item to fetch against the list | --- |
List | List that the item to manipulate will be pulled from. | List of --- |
Outputs
Property | Description | Data Type |
---|---|---|
Item Index | Represents the index (position) of the specified item in the list.
| Int32 |
Example 1:
The following screenshot demonstrates a simple example with a constant input list.
Example 2:
The following example demonstrates how to get the index of an item from a complex data type.
The Get All step retrieves all the data from a user-defined data type. Connect the step to the Index of the Item in List Step.
Navigate to the Properties panel of the Index of Item in List step. Under ListType, pick the same user-defined data type of the Get All step.
Enable Use Property option and select a preferred field name. (The step will fetch the index of the item against this field/column)
Change the input type of Item to Find and enter the Item name (of which the index is to be returned). Ensure the Item name is available in the data field/column that is picked under Use Property. Not all fields need to be filled, as the step focuses on fetching the item index within the specified field name.
Pass the Results of the Get ALL step to the list.
Debug the Flow.
In the provided screenshot, the "EmpName" field/column was chosen, and the Item to Find was "Wick". As a result, the step returned an index value of 1.