The object command execution instruction is used to execute a specified command of an object.
The object on which the command is to be executed is specified through an object reference which can be:
Input argument values are transferred to the command through input argument assignments and output argument values are transferred from the command through output argument assignments.
See also the section called “Script execution tail” for information about specific error handling.
Table 20.5. Object command execution syntax
| Production | Syntax | Links |
|---|---|---|
object_command_execution_instruction |
object_reference_selector "." command_id input_assignment_list ? output_assignment_list ? script_execution_tail ?
| the section called “Object command execution instruction” |
object_reference_selector | object_reference ( "." attribute_id ) * | |
object_reference | ||
assignable_object_reference |
| |
input_assignment_list | "(" input_assignment ( ";" ? input_assignment ) * ")" | |
output_assignment_list |
"(" output_assignment ( ";" ? output_assignment ) * ")"
remark: if there are no input arguments assigned then the output argument assignment list must be preceded by | |
input_assignment |
( input_argument_id "=" ) ? expression
remark: | |
output_assignment | assignable_object_reference_selector "=" output_argument_id | |
script_execution_tail |
on_error_clause ?
| the section called “Script execution tail” |
on_error_clause |
"on_error" ":" ( "exit_script" | "continue" )
"remark: default value is |
Example 20.4. Object command execution examples
service instruction_examples
command object_command_execution_examples
script
// create supplier
const supplier supplier = fa_supplier.co_create ( &
identifier = 100 &
name = "Bestsoft" )
// execute object command with 1 output argument
var string supplier_XML = c_supplier.co_convert_to_XML
// execute object command with 2 input arguments and 1 output argument
supplier_XML = supplier_XML.co_replace_all ( &
to_replace = "identifier" &
replace_by = "id" )
// execute object command with 2 input arguments and 2 output arguments
var file temporary_file
var resource_error error
se_text_file_IO.create_temporary_text_file ( &
delete_file_on_exit = yes &
text = supplier_XML ) &
( v_temporary_file = o_result &
v_error = o_error )
if v_error #r void then
// error handling
exit script
end if
// if we are just interested in 1 of the 2 output arguments we can also write as follows:
// (Remark: It is NOT a good idea to ignore the error returned by a command)
v_temporary_file = se_text_file_IO.create_temporary_text_file.result ( &
delete_file_on_exit = yes &
text = supplier_XML )
if v_temporary_file =r void then
// error handling
exit script
end if
end script
end command
end service