A command in_check script belongs to a command (which can also be a creator in a factory) and checks conditions that must be fulfilled before executing the command. Any checks depending on several input arguments can be done in this script. Moreover, any other checks not depending on input arguments, such as testing the existence of a file, are done in this script.
![]() | Note |
|---|---|
To check the value of a single input argument instead of several, mutually dependant input arguments, the command input argument check script should be used instead of the command in_check script. See the section called “Input argument check script” for checking a single input argument. |
Table 7.10. Command in_check script selector
| Production | Syntax | Links |
|---|---|---|
command_in_check_script_selector | command_id "." "in_check" | the section called “Command in_check script” |
All input arguments of the command are implicitly provided as input arguments for this script.
Moreover, if the script belongs to an object (i.e. it is defined in a type) then an additional last input argument holds a reference to the object. This argument's id is i_object_, and its type is the type of the object. i_object_ is used whenever the object's state must be considered in the script. For example, in case of a list, the following instruction in the in_check script would require at least 1 item in the list, before executing the related command:
check i_object_.item_count >= 1
If the script belongs to a service then no such input argument exists.
This script always has one output argument whose id is o_error and whose type is ty_error_in_check. o_error is void if all conditions to execute the command are fulfilled. Otherwise it returns an error describing the first check that failed.
Example 7.1. Command in_check script example
service script_examples
command append_string_twins_to_file
in string1 type:string end
in string2 type:string end
in_check
script
// first we require that both strings have the same length
check string1.item_count =v string2.item_count &
error_message: "Both strings must be of equal length!"
// we also check that file c:\foo.txt exists
var file_handle file = fa_file_handle.co_create ( '''c:\foo.txt''' )
check v_file.co_exists &
error_message: "File " & v_file.a_full_name & " must exist!"
end
end
script
// we only arrive here if no check in the 'in_check' script fails
// now process data ...
end
end
endThe implicitly defined input arguments of the above in_check script are i_string1 and i_string2 of type string, and the implicitly defined output argument is o_error of type error_in_check.
To check whether input conditions would be fulfilled in a given case, we can explicitly call the script like this:
var in_check_error error = se_script_examples.co_append_string_twins_to_file.in_check ( &
string1 = "foo" &
string2 = "bar" )
if v_error =r void then
// everything ok
else
// we have a problem
end if