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

MapValueSetQuality

Use this function to set the quality of a property in a map.

Syntax

INT MapValueSetQuality(STRING sMapName, STRING sKeyName, QUALITY Quality)

sMapName:

Name of the map.

sKeyName:

Name of the key to override the quality for

Quality:

Quality to override in an existing value. There is no default value. The QUALITY type is created using the QualityCreate function.

Return Value

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

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

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

Example

! Demonstrate MapValueSetQuality.
STRING sMapName = MapOpen();
! sMapName is a randomly generated text that uniquely identifies the map
INT iMapValueSetResult = MapValueSet(sMapName, “SomeKey”, “SomeValue”);
QUALITY qVariableQualityResultExpectGood =
VariableQuality(MapValueGet(sMapName, “SomeKey”));
! qVariableQualityResultExpectGood is set to GOOD QUALITY (checked below)
INT iQualityIsGoodResultExpectTrue =
QualityIsGood(qVariableQualityResultExpectGood);
! iQualityIsGoodResultExpectTrue is set to TRUE (non-zero)
INT iMapValueSetQualityResult =
MapValueSetQuality(sMapName, “SomeKey”, QualityCreate(192));
! iMapValueSetQualityResult will be set to 0 (NO ERROR)
QUALITY qVariableQualityResultExpectBad =
VariableQuality(MapValueGet(sMapName, “SomeKey”));
! qVariableQualityResultExpectBad is set to BAD QUALITY (checked below)
INT iQualityIsGoodResultExpectFalse =
QualityIsGood(iQualityIsGoodResultExpectFalse);
! iQualityIsGoodResultExpectFalse is set to FALSE (zero)
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, MapKeyNext, MapValueSet

See Also

Published June 2018