$componenttype

Return the type of the specified component instance.

$componenttype { (InstanceName) }

Parameters

Parameters
Parameter Data Type Description
InstanceName String Name of the component instance. If omitted, the current instance is used. If no instance is current, for example, in the apStart trigger, the returned type indicates that the instance is the application shell.

Return Values

Values returned by $componenttype
Value Meaning
A The InstName argument was omitted and no instance is current, for example, in the apStart trigger.
D InstName was created from a Dynamic Server Page component
P InstName was created from a Static Server Page component
F InstName was created from a Form component.
R InstName was created from a Report component.
S InstName was created from a Service component.
E InstName was created from an Entity Service component
N InstName was created from a Session Service component
An empty string ("")

An error occurred. $procerror contains the exact error.

Values of $procerror Commonly Returned Following this Function
Value  Error constant Meaning
-57 <UACTERR_NO_INSTANCE> The named instance cannot be found in the component pool.
-1101 <UPROCERR_FIELD> An incorrect field name was provided; either the field name is not valid syntactically or the field is not available in the component.
-1105 <UPROCERR_INSTANCE> The instance name provided is not valid; for example, the argument contains incorrect characters.
-1304 <UPROCERR_UNKNOWN_CONTEXT> Function not allowed, unknown context. The InstName argument was omitted and no instance is current, for example, in the apStart trigger.

Use

Allowed in all component types.

Using $componenttype

The following example writes a message to the message frame that indicates the type of the component from which the current instance was created:

getitem/id $COMPTYPE$, "D=DSP;P=USP;S=Service;=unknown", $componenttype
if ($componenttype = "A")
   putmess "Application shell is %%$applname"
else
   putmess "Current instance is from a %%$COMPTYPE$" named %%$componentname"
endif
History
Version Change
9.4.01 Added return value D for DSPs.

Related Topics