Script execution

Object command execution instruction

Description

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:

  • an attribute
  • a variable
  • a constant
  • a script input argument
  • a script output argument

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.

Syntax

Table 8.5. Object command execution syntax

ProductionSyntaxLinks
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_selectorobject_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 () to indicate an empty input argument assignment list

 
input_assignment ( input_argument_id "=" ) ? expression

remark: input_argument_id = can only be omitted if the called script has exactly one input argument

 
output_assignmentassignable_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 exit_script

 

Examples

Example 8.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 no input arguments and 2 output arguments
         var file_handle temporary_file
         var file_error error
         supplier_XML.co_store_to_new_temporary_file () ( &
            v_temporary_file = o_file_handle &
            v_error = o_error )
         // delete temporary file
         v_temporary_file.co_delete_file

         // if we are just interested in 1 of the 2 output arguments we can also write:
         v_temporary_file = supplier_XML.co_store_to_new_temporary_file.o_file_handle
         // delete temporary file
         v_temporary_file.co_delete_file

      end script
   end command
   
end service

-->