Skip to main content

get (Function)

Function returns the value corresponding to the given key from the map.

Syntax

<OBJECT|INT|LONG|FLOAT|DOUBLE|FLOAT|BOOL|STRING> map:get(<OBJECT> map, <INT|LONG|FLOAT|DOUBLE|FLOAT|BOOL|STRING> key)
<OBJECT|INT|LONG|FLOAT|DOUBLE|FLOAT|BOOL|STRING> map:get(<OBJECT> map, <INT|LONG|FLOAT|DOUBLE|FLOAT|BOOL|STRING> key, <OBJECT|INT|LONG|FLOAT|DOUBLE|FLOAT|BOOL|STRING> default.value)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
mapThe map from where the value should be obtained.OBJECTNoYes
keyThe key to fetch the value.INT LONG FLOAT DOUBLE FLOAT BOOL STRINGNoYes
default.valueThe value to be returned if the map does not have the key.OBJECT INT LONG FLOAT DOUBLE FLOAT BOOL STRINGYesYes

Example 1

map:get(companyMap, 1)

If the companyMap has key 1 and value ABC in it's set of key value pairs. The function returns ABC.

Example 2

map:get(companyMap, 2)

If the companyMap does not have any value for key 2 then the function returns null.

Example 3

map:get(companyMap, 2, 'two')

If the companyMap does not have any value for key 2 then the function returns two.