Lasso Soft Inc. > Home

[Map->Get]

[Map->Get] returns a key/value pair from the map. Accepts a single integer parameter identifying the index of the item to be returned.

The first element in a map is at index 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.

  • Syntax
  • Parameters
[Map->(Get: Map Index)]
Required Parameters
Map The map which is to be operated upon.
Map Index The index of the element of the map which should be returned.
Examples

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), -EncodeNone;
  /Loop;
?>
Result:
<br>(Pair: (red), (#ff0000))
<br>(Pair: (green), (#00ff00))
<br>(Pair: (blue), (#0000ff))
Tag Link [Map->Get] Category Array
Type Member Data Source Any
Support Preferred Version 5.0
Output Type Any Security None
Implementation Internal Sets Lasso 6.0, Lasso 5.0

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft