Script functionPre-defined run book template in the Automation Engine. One single step only, e.g. Start Windows Service, Copy file,…: It retrieves the size of a scriptA particular Automation Engine object type. array.
LENGTH(Script-Array, [SIZE])
Syntax |
Description/Format |
---|---|
Script array |
The name of the script variableA placeholder for a value within a script. that has been defined as an array. |
SIZE | Ignores the empty elements at the end of the array. |
Return codes |
---|
The number of script array elements. |
You can create script arrays by using the script element :DEFINE in which you can also determine the data type and the number of elements. Subsequently, you can query the array size using the script function LENGTH. You use empty brackets [] in order to indicate that it is an array..
The maximum size of a script array is 99999.
A script error will occur when the specified array cannot be found or when you specify a script variable.
When you specify the parameter SIZE, this script function only returns the number of filled array elements. The empty elements at the end of the array are ignored.
Note that for retrieving the size up to the last filled element (SIZE parameter), the array must have the data type "string". All other data types will always return the total array size.
The following example creates a script array, fills it with values from a Variable objectAutomation Engine controlled activities and processes are structured in the form of objects. See also: Task and outputs these values with a loop.
:DEFINE &ARRAY#, string, 5
:SET &LEN# = LENGTH(&ARRAY#[])
:SET &VAR# = 1
:FILL &ARRAY#[] = GET_VAR(VARA1, ARRAY)
:WHILE &VAR# LE &LEN#
:PRINT "Element &VAR# = &ARRAY#[&VAR#]"
:SET &VAR# = &VAR# + 1
:ENDWHILE
See also:
Script Element | Description |
---|---|
Stores several values to a script array. |
|
FIND | Searches through a script array and returns the corresponding index. |
Script Elements - Activation Data
About Scripts
Script Elements - Alphabetical Listing
Script Elements - Ordered by Function
Automic Documentation - Tutorials - Automic Blog - Resources - Training & Services - Automic YouTube Channel - Download Center - Support |
Copyright © 2016 Automic Software GmbH |