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

MapClear

Clears all entries in a map and returns the error status.

Syntax

INT MapClear(STRING sMapName)

sMapName:

Name of the map to be cleared.

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 does not exist a “Record not found” error (536) will be returned.

Example

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

Related Functions

MapOpen, MapExists, MapKeyCount, MapKeyDelete,MapKeyExists, MapKeyFirst, MapValueGet, MapKeyNext, MapValueSet, MapValueSetQuality

See Also

Published June 2018