get_keys_fieldset_map

The function get_keys_fieldset_map retrieves the index values of all elements in a 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:

  1. The parameter input_map is a MAP of type FIELDSET. The MAP of which you want the index values.
  2. The parameter result_array is an array of type TEXT. The array in which the index values are stored.

Example

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 (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