Defines a new "map". The map lasts for the duration of the Intent session. A "map" data structure is sometimes referred to as a "hash table" or "lookup table". If you define another map with the same name, the reset? argument specifies whether the existing map is cleared. This function always returns True .
You must invoke defineMap() prior to attempting to store or retrieve data from it. This may be a good reason to use an onCreate rule .
defineMap ( mapName As Name, _
Optional reset? As Boolean = True ) As Boolean
Argument | Type | Description |
---|---|---|
mapName | Name | The name of the map |
reset? | Boolean | Optional; if True (default) and a map with the same name exists, the data in the map is cleared at that point . If False , nothing happens to the existing data in the map. |
Intent >defineMap(:myMap)
--> True
Defines a map named 'myMap'. Intent >defineMap(:myMap)
--> True
This redefines the map defined in Example 1, clearing any values that may have been previously set using setMapValue(). Intent >defineMap(:myMap, reset? := False)
--> True
This attempts to define a map named 'myMap'. But since a map with this name exists and reset? is
False
, the existing map is left alone. Intent >defineMap(:myMap)
--> True
Intent >setMapValue(:myMap, :myStringValue, "A String")
--> True
Intent >setMapValue(:myMap, :myIntegerValue, 123)
--> True
Intent >defineMap(:myMap, reset? := False)
--> True
Intent >getMapKeys(:myMap)
--> {:myStringValue, :myIntegerValue}
Intent >getMapValue(:myMap, :myStringValue)
--> "A String"
Intent >getMapValue(:noMap, :noValue)
--> NoValue
Intent >deleteMapValue(:myMap, :myIntegerValue)
--> True
Intent >getMapValue(:myMap, :myIntegerValue)
--> NoValue