get_keys_fieldset_map
The function get_keys_fieldset_map retrieves the index values of all elements in MAP and stores them in an array. The index values are stored in the array in random order.
get_keys_fieldset_map ( input_map;result_array)
This function returns a NUMBER, which is the number of elements stored in the array.
This function has two parameters:
- input_map is a MAP of type FIELDSET. The MAP whose index values you need.
- result_array is an array of type TEXT. The array whose index values are stored.
An example is provided here.
DATASTRUCTURE DS
BEGIN
MAP FIELDSET Input_map
END
DECLARE struct DEFINED_AS DS
ASSIGN struct.Input_map ["first"].Field := "This is the first value"
ASSIGN struct.Input_map ["second"].Field := "This is the second value"
ASSIGN struct.Input_map ["third"].Field := "This is the third value"
ASSIGN struct.Input_map ["fourth"].Field := "This is the fourth value"
ASSIGN struct.Input_map ["fifth"].Field := "This is the fifth value"
ARRAY TEXT result_array[1]
NUMBER number_of_elements
ASSIGN number_of_elements := get_keys_fieldset_map (struct.Input_map;result_array)
NUMBER counter
FOR counter
FROM 1
UPTO number_of_elements
DO
#
The key @(result_array[counter]) contains @(struct.Input_map[result_array[counter]].Field) in the map.
#
OD