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

MapKeyDelete

Use this function to delete a key and value from a map.

Syntax

INT MapKeyDelete(STRING sMapName, STRING sKeyName)

sMapName:

Name of map.

sKeyName:

Name of key and value to be deleted.

Return Value

0 (zero) if successful, otherwise an error code is returned.

If the map name is empty an “Invalid argument” error (274) will be raised and returned.

If the map or the key does not exist a “Record not found” error (536) will be returned.

Example

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

Related Functions

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

See Also

Published June 2018