Tag Link | [Map->Get] | Category | Array |
---|---|---|---|
Type | Member | Source Available | No |
Support | Preferred | Version | 5.0 |
Change | Unchanged | Data Source | Any |
Output Type | Any | Security | None |
Implementation | LCAPI | Sets | Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0 |
[Map->Get] returns a key/value pair from the map. Accepts a single integer parameter identifying the position of the item to be returned.
The first element in a map is at position 1. The elements in a map are ordered arbitrarily. The order may change as elements are added and removed from the map.
An error will be returned if an item is requested which is greater than the size of the map.
[Map->(Get: Map Position)]
Required Parameters | |
---|---|
Map Index | The index of the element of the map which should be returned. |
To get each of the elements of a map:
Use the [Map->Get] tag. This tag treats the map as if it were an array. The following code loops through the map displaying each value.
<?LassoScript
Variable: 'Colors'=(Map: 'red'='#ff0000',
'green'='#00ff00',
'blue'='#0000ff');
Loop: $Colors->Size;
Output: '<br>' + $Colors->(Get: Loop_Count),
/Loop;
?>
<br>(Pair: (red), (#ff0000))
<br>(Pair: (green), (#00ff00))
<br>(Pair: (blue), (#0000ff))