Cicode Programming Reference > Cicode Function Categories > Map Functions > MapValueGet

MapValueGet

Use this function to retrieve the value from a key in a map.

Syntax

VARIANT MapValueGet(STRING sMapName, STRING sKeyName)

sMapName:

Name of map.

sKeyName:

Name of the key to retrieve the value from.

Return Value

Value returned is a VARIANT that also contains QUALITY and TIMESTAMP components, otherwise an error code is returned.

If the map or key does not exist an "Invalid argument" error (274) is raised.

Example

! Demonstrate MapValueGet.
STRING sMapName = MapOpen();
! sMapName is a randomly generated text that uniquely identifies the map
INT iMapValueSetResult = MapValueSet(sMapName, “SomeKey”, “SomeValue”);
STRING sMapValueGetResult = MapValueGet(sMapName, “SomeKey”);
! sMapValueGetResult will be set to “SomeValue”
INT iMapCloseResult = MapClose(sMapName);
! The map that is identified by sMapName is now closed and unavailable		

Related Functions

MapClear, MapOpen, MapClose, MapExists, MapKeyCount, MapKeyDelete, MapKeyExists, MapKeyFirst, MapKeyNext, MapValueSet, MapValueSetQuality

See Also

Published June 2018