Read from Array | MuleSoft Documentation
# Read from Array
The _Read from Array_ action step is used to access the content of an array.
You can either return a value at a certain point in the array via an index or return the whole array as text. In the latter case, all values are listed as comma separated values.
The _Read from Array_ action step provides the read values from the array automatically as various data types. You can decide later in the Workflow which data type you wish to use.
## Properties
**Get entire array as CSV** (Bool, default: false) If active, the whole array is returned as a string in CSV format (comma separated values).
**Index to read at** *(integer, > 0, default: 1) Position within the array where the content of the array is to be read from. Indexing starts at 1.
Please make sure that the index entered is not greater than the total number of all elements within the array.
## Inbound Variables
**Array to read from** (Array) The array that is to be read from.
The drop-down _Array to read from_ list contains all the arrays that have been created in the Workflow so far. These can be _Workflow Based Variables_ or return arrays from the _Read from Excel File_ action step.
**Index to read at** *(integer, > 0, default: 1) Position within the array where the content of the array is to be read from. Indexing starts at 1.
## Outbound Variables
The _Read from Array_ action step automatically supplies four different return values. Each one represents one of the possible data types. Depending on what you want to use the data for, you will take a different data type. In a _Keystroke_ , for example, you will use the data type _AsString_ , or if it concerns a number that you want to use to manage how often a _Loop_ is repeated, use the data type _AsInt_ :
  * **Read from Array.AsString** (string) Return value as text
  * **Read from Array.AsInt** (int) Return value as a whole number
  * **Read from Array.AsDouble** (double) Return value as a floating-point number
  * **Read from Array.AsBool** (bool) Return value as a Boolean value


Please make sure that the content of the value read from the array is compatible with the desired data type.
For example, a character string such as "abc" cannot be converted into a meaningful integer number.
If you want to use the return value from the Read from Array action step in another in action step, a pre-selection will be made for you as to which data types can meaningfully be used at this point.
The following table provides an overview of the result of converting the data types:
From / to | String | Int | Double | Bool  
---|---|---|---|---  
unchanged | The strings True and true and all positive numbers > 0 are True; all others give False  
unchanged | unchanged | unchanged | If Int ⇐0, false; if Int >= 0 true  
unchanged | The decimal places are truncated | unchanged | If Double ⇐0, false; if Double >= 0 true  
unchanged | unchanged  
Each row refers to an outbound data type, each column to the result of converting to the data type in the column header.
## Wizard
The drop-down _Array to read from_ list contains all the arrays that have been created in the Workflow so far. These can be _Workflow Based Variables_ or return arrays from the _Read from Excel File_ action step.
If you select the checkbox _Get entire array as comma separated values_ , the whole array will be returned as a string. The individual values will, of course, be separated by commas. The text field _Index to read at_ and its content are deactivated in this case.
The _Index to read at_ denotes the position within an array from which the content of the array is to be read. The first element has the index 1. The index can also be mapped to a variable. Simply click on the Pin symbol and select a suitable variable from the list. If you subsequently wish to set the variable manually, click on the Pin symbol again and select None. You can then enter a value manually in the input field. The input field and its content are deactivated if the checkbox above it is selected.
## Example
For a detailed example, please refer to the description of the _Get Array Count_ action step.