Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This section describes functions that enable use of hash maps.

The following functions for Map described here are:


mapClear

Removes all entries in a map.

void mapClear
 (map<any,any>  myLittleMap );
ParameterDescription

myLittleMap

The map to clear

Returns

Nothing


mapContains

Evaluates if a key is present in a map.

boolean mapContains
 ( map<any,any>  myMap , 
 any  myKey  );
ParameterDescription

myMap

Name of the map to evaluate

myKey

The requested key

Returns

true or false


mapCreate

Creates a new, empty map.

map<any,any> mapCreate
 ( any  myKeyType , 
 any  myValueType );
ParameterDescription

myKeyType

Defines the data type of the keys in the map

myValueType

Defines the data type of the values, associated with the keys in the map

Returns

An empty map

Example - Using mapCreate

An example of a map definition, including assignment of the first key/value pair.

map<string,int> myMap = mapCreate( string, int); mapSet( myMap, "Failed", 22 );


mapCreateSync

Creates a new, empty synchronized map. This function may be useful for global maps in real time workflows, where the same map may be accessed from several threads at the same time.

map<any,any> mapCreateSync
 ( any  myKeyType , 
 any  myValueType );
ParameterDescription

myKeyType

Defines the data type of the keys in the map

myValueType

Defines the data type of the values, associated with the keys in the map

Returns

An empty map

Example - Using mapSet

An example of a map definition, including assignment of the first key/value pair.

map<int,string> mySyncMap = mapCreateSync( int, string);
mapSet( mySyncMap, 55, "Successful" );


mapGet

Retrieves the value of a specified key in a map.

valueType mapGet
 ( map<key,value>  myMap , 
 keyType  key  );
ParameterDescription

myMap

The name of the map from which you want to retrieve a value

key

The name of the key holding the value to you want to retrieve

Returns

Returns the value associated with the key. The data type of the returned value is the same as the defined value type for the map.

If there is no matching key mapGet will return null, false or 0 depending on type.

Note - using mapGet

If the map is map<int,string>. The return type of "mapGet" will be "string".


mapKeys

Returns a list of all keys present in a map. Note that the order of the elements in the list is not defined.

list<any>
 mapKeys(map<any,any> myMap );
ParameterDescription

myMap

The map to fetch all keys from

Returns

An unsorted list of keys according to: [keyA, keyB, keyX...] The data type of the list elements is the same data type as defined for the keys in the map.

mapRemove

Removes a key and its corresponding value.

any mapRemove
 ( map<any, any>  myMap ,
 any  myKey );
ParameterDescription

myMap

The map to remove a key from

myKey

The name of the key to remove

Returns

The value corresponding to the removed key


mapSet

Sets or updates a key's associated value.

void mapSet
 ( map<any, any>  myMap ,
 any  myKey , 
 any  myKeyValue );
ParameterDescription

myMap

The map to update

myKey

The name of the key to set/update

myKeyValue

The corresponding value to set/update

Returns

Nothing


mapSize

Returns the number of keys present in a map.

int mapSize( map<any,any> myMap );
ParameterDescription

myMap

The map to examine

Returns

The size of the map in terms of number of keys


mapValues

Returns a list of all values present in a map. Note that the order of the elements in the list is not defined.

list<any>mapValues(map<any, any> myMap );
ParameterDescription

myMap

The map to fetch all values from

Returns

A list of all values (unsorted):

[valueA, valueB, valueX...]. The data type of the list elements is the same data type as defined for the values in the map.

  • No labels