$instancepath
Return the path with which the current component instance is registered.
$instancepath { (
InstanceName)
}
Parameters
Parameter | Data Type | Description |
---|---|---|
InstanceName | String | Name of component instance; optional. If omitted, the current instance is used. |
Return Values
- Name of the path for the current instance in uppercase.
- Empty string (""), if the current application did not register with the Uniface Router when it started.
Use
Allowed in all component types.
Description
The $instancepath function can be useful to pass addressing information to another component instance.
Starting a Component and Passing Data to an Operation
The detail trigger of a field in the form COMP1 contains the following
code. It starts a new instance of the component COMP2, prepares data for the operation
TELL_ME_LATER
, then hands the data to the operation.
; field DO_IT trigger detail ; prepare the data for TELL_ME_LATER ; prepare the my return address variables string MYADRESS endvariables newinstance/async "COMP2", "INST2" DATA = ... MYADDRESS = "%%$instancepath:%%$instancename" activate "INST2".TELL_ME_LATER (MYADDRESS, DATA) end; detail
The operation TELL_ME_LATER
does
what is required, then sends the result back to the calling instance:
; Component COMP2 ; prepare data to be returned operation TELL_ME_LATER params string RETURN_ADDRESS : IN string DATA : IN endparams variables string DATAOUT endvariables ... DATAOUT = ... postmessage "%%RETURN_ADDRESS", "RESULT", "%%DATAOUT" end
The message is received by the receiveMessage trigger of COMP1:
; component COMP1 trigger receiveMessage selectcase $msgid case "RESULT" askmess "Result from %%$msginfo("INSTANCENAME") available in message frame." putmess "Received the following result from %%$msginfo("SRC") :" putmess "%%$msginfo("DATA")" case ... ... endselectcse end; receiveMessage