$instancename

Return the name of the current component instance.

$instancename

Return Values

  • Name of current component instance in uppercase.
  • Name of the current form in uppercase, if the form was started with run.
  • Name of the application shell, if no form is current (for example, in the apStart trigger).
  • Empty string (""), if an error occurred. $procerror contains a negative value that identifies the exact error
Values of $procerror Commonly Returned Following $instancename
Value  Error constant Meaning
-1304 <UPROCERR_UNKNOWN_CONTEXT> Function not allowed, unknown context.

For example, there is no current instance in the apStart trigger, or the current instance is a form started with run.

Use

Allowed in all component types.

Tracing Application Execution

You can use the value in $instancename to help trace an application's execution. For example:

operation exec

putmess "Started instance %%$instancename at %%$clock"
edit
putmess "Terminated instance %%$instancename at %%$clock"
end ; end exec

Related Topics