Initializing help system before first use

# geteltype

Purpose
Get the type ID of an element of a collection type.
Synopsis
`function geteltype(u: union): integer`
`function geteltype(tid: integer): integer`
Arguments

u | A union
tid | A type ID

Return value
A type ID or -1 if the provided parameter is not a valid type ID or the union is not defined.
Example

    declarations
     MYSET=set of integer
     s: MYSET
     u1,u2,u3: any
    end-declarations
      ...
    u1:=s
    u2:="bla"
    writeln("ElType of MYSET: ", geteltype(MYSET.id),   ! = integer.id=1
            "\nElType of u1: ", u1.eltype,              ! = integer.id=1
            "\nElType of u2: ", u2.eltype,              ! = string.id=3
            "\nElType of u3: ", u3.eltype)              ! = -1

Further information
1. This function retrieves the type ID of an element of a collection (array, set or list) represented by a type ID or the value stored in a union. If the referenced type is not a collection ( i.e. it is a constant or a reference) the type of the entity itself will be returned (that is the same value as gettypeid).
2. There are 2 versions of this routine: when used with a union the information reported comes from the current value of this union ( -1 is returned if the union is not initialized). If applied to an integer the function expects this integer to be a type ID ( -1 is returned if this value does not correspond to a type ID).
Related topics
getstruct, gettypeid, geteltype.
Parent Topic Predefined functions and procedures

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.