Lasso Soft Inc. > Home

[Map->Insert]

[Map->Insert] inserts a value into the map for a specified key. Accepts a single name/value parameter which is the name of a key in the array and the value that should be stored for that key.

Keys and values can be of any data types.

Note: This tag will replace an item in the map with the same key. Each map can only store one value for each key.

  • Syntax
  • Parameters
[Map->(Insert: 'Map Key'='Map Value')]
Required Parameters
Map The map which is to be operated upon.
Key/Value Pair The key and value for a new element which is to be inserted into the map.
Examples

To store a value in a map for a given key:

Use the [Map->Insert] tag. The following example adds a new color black to the 'Colors' map with an appropriate HTML color code as the value.

<?LassoScript
  Variable: 'Colors'=(Map: 'red'='#ff0000', 
    'green'='#00ff00', 
    'blue'='#0000ff');
  $Colors->(Insert: 'black'='#000000');
  Output: $Colors->(Find: 'black');
?>
Result:
#000000
Tag Link [Map->Insert] Category Array
Type Member Data Source Any
Support Preferred Version 5.0
Output Type None Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, 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