11.19 getvector()

This function may be used to obtain the entire value of vector or matrix attributes (both user-defined and predefined), i.e. a list of all indexed values, or a section thereof, in a vector.

Definition

vector getvector
(
      object    Object     input,
      attribute Attribute  input
  { , anyvalue  FirstIndex input
  { , anyvalue  LastIndex  input } }
)

Parameters

object Object input
This parameter defines the object whose attribute values shall be queried.
attribute Attribute input
This parameter defines the attribute to be queried.
anyvalue FirstIndex input
This optional parameter defines the start index as of which the element values are retrieved. For one-dimensional array attributes an integer value should be specified, for two-dimensional arrays an index value. The default value for one-dimensional array attributes is the integer value 1, for two-dimensional arrays the index value [1,1].
anyvalue LastIndex input
This optional parameter specifies the end index up to which the values from the attribute are taken into the resulting value list. Again, an integer value is expected for one-dimensional array attributes and an index value for two-dimensional arrays. If no LastIndex parameter is specified, all values up to the end of the array are included. The LastIndex value should be after the FirstIndex value.

Return value

The indexed values determined from the object attribute are returned as a value list with type vector.

Fault behavior

The function call fails for an invalid object or attribute or for an invalid index range.

Example

dialog D
{
  string Extra[integer];
  .Extra[1] := "Anna";
  .Extra[2] := "William";
}

window Wi
{
  .title "Names";
  
  listbox Lb
  {
     .xauto 0;  .yauto 0;
     .content[1] "..NAMES..";
     .content[2] "Irene";
     .content[3] "David";
     .content[4] "Henry";
  }
  
  on close { exit(); }
}

on dialog start {
  variable vector Names;

  Names := join(getvector(Lb, .content, 2), getvector(D,.Extra));
  setvector(Lb, .content, sort(Names), 2);
}

See also

Built-in function setvector()

C functions DM_GetVectorValue, DM_SetVectorValue