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

MapKeyNext

Use this function to retrieve the next key after the supplied key in a map so that all the keys in a map can be discovered

Syntax

STRING MapKeyNext(STRING sMapName, STRING sKeyName)

sMapName:

Name of map to retrieve the value from.

sKeyName:

Name of the key to retrieve the value for.

Return Value

The next key if successful or, an empty string if no next key exists.

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

Example

! Demonstrate MapKeyNext.
STRING sMapName = MapOpen();
! sMapName is a randomly generated text that uniquely identifies the map
INT iMapSetValueResult1 = MapSetValue(sMapName, “somekey”, “somevalue”);
INT iMapSetValueResult2 = MapSetValue(sMapName, “SomeKey”, “SomeValue”);
STRING sMapKeyFirstResult = MapKeyFirst(sMapName);
! sMapKeyFirstResult will be set to “SomeKey”
STRING sMapKeyNextResult = MapKeyNext(sMapName, sMapKeyFirstResult);
! sMapKeyNextResult will be set to “somekey”
! This shows that the keys are visited in ordinal order, and that
! the keys are case sensitive
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, MapValueGet, MapValueSet, MapValueSetQuality

See Also

Published June 2018