$componenttype
Return the type of the specified component instance.
$componenttype { (
InstanceName | componentName)
}
Parameters
Parameter | Data Type | Description |
---|---|---|
InstanceName | componentName | String |
Name of the component instance or the name of the component. 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. Using componentName allows you to get the component type from the component signature without first creating an instance. |
Return Values
Value | Meaning |
---|---|
A
|
The InstanceName argument was omitted and no instance is current, for example, in the apStart trigger. |
D
|
InstanceName was created from a Dynamic Server Page component, or the componentName provided is for a Dynamic Server Page. |
P
|
InstanceName was created from a Static Server Page component, or the componentName provided is for a Static Server Page. |
F
|
InstanceName was created from a Form component, or the componentName provided is for a Form. |
R
|
InstanceName was created from a Report component, or the componentName provided is for a Report. |
S
|
InstanceName was created from a Service component, or the componentName provided is for a Service. |
E
|
InstanceName was created from an Entity Service component, or the componentName provided is for an Entity Service. |
N
|
InstanceName was created from a Session Service component, or the componentName provided is for a Session Service. |
An empty string ("") |
An error occurred. $procerror contains the exact error. |
Value | Error constant | Meaning |
---|---|---|
-1105
|
<UPROCERR_INSTANCE>
|
The string provided is not a valid instance name or not a valid component name. |
-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
Version | Change |
---|---|
10.4.02 | Enhanced to return the component type based on the component name. |
9.4.01 | Added return value D for
DSPs. |