Tag Link | [Map->Insert] | Category | Array |
---|---|---|---|
Type | Member | Source Available | No |
Support | Preferred | Version | 5.0 |
Change | Unchanged | Data Source | Any |
Output Type | None | Security | None |
Implementation | LCAPI | Sets | Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0 |
[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.
[Map->(Insert: 'Map Key'='Map Value')]
Required Parameters | |
---|---|
Key/Value Pair | The key and value for a new element which is to be inserted into the map. |
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');
?>
#000000