IvyScript Reference

Operators

IvyScript Field Access and Type Cast Operators

Operator

Explanation

Usage

.

Field and method access of ivy objects

in.customer.name addresses the name attribute in the data structure

in.message.length() calls the method length()

.#

Field access with suppressed auto initialisation

in.#customer == null

null check of customer which is not initialised

as

Type cast operator

in.anObject as Date casts the object to a Date

IvyScript Logic Operators

Operator

Explanation

Usage

>

greater than

5 > 3 is true

<

less than

5 < 3 is false

==

equals

(Java equals)

5 == 5 is true

"Hello" == "HELLO" is false

!=

unequal

7 != 2 is true

>=

greater than or equal

7 >= 6 is true

<=

less than or equal

2 <= 5 is true

&&

Boolean AND

true && true is true

||

Boolean OR

true || false is true

!

Boolean NOT

! true is false

IvyScript Arithmetic Operators

Operator

Explanation

Usage

Addition

String Concatenation

12.5+17.0 is 29.5

"Hello "+"World" is “Hello World”

Subtraction

3020-12 is 3008

*

Multiplication

2*4 is 8

/

Division

7/2 is 3.5

%

Modulo Division

7%2 is 1

**

Power

2%5 is 32

++

Increment

in.n++

Decrement

in.n--

Negative Number value

-9

Ivy Script Data Types

Boolean

A boolean has the values true and false. The IvyScript Boolean is based on the java.lang.Boolean but has a simplified class reference definition. Type conversion and format methods has been added while most other methods are hidden.

Date

The Date class represents a date without time of day.

  • Date constant objects are entered in the ISO-8601 format as 'yyyy-mm-dd', where yyyy is for the year, mm for month and dd for day.

  • Accepted is also the format: 'dd.mm.yyyy'.

  • new Date() returns the current date.

DateTime

The DateTime class represents a date with time.

  • Constant DateTime objects are entered in the ISO-8601 format as 'yyyy-mm-dd hh:nn' or 'yyyy-mm-dd hh:nn:ss'. yyyy is for the year, mm for month, dd for day hh for hours, nn for minutes and ss for seconds.

  • Accepted is also the format: 'dd.mm.yyyy hh:nn or 'dd.mm.yyyy hh:nn:ss'.

  • new DateTime() returns the current date and time.

Time

The Time class represents a time of day.

  • Time constants are entered as 'hh:mm' or 'hh:mm:ss', where hh is for hour, mm for minutes and ss for seconds

  • new Time() returns the current time.

Duration

The Duration class represents time periods.

  • You enter a duration in the ISO 8601 time period format such as: '12h20m' or '12h20m30s'

  • An example for the full format is: 'P3Y6M4DT12h30m10s'

Number

IvyScript Numbers are Java Numbers. Number objects are integer or fixed-point numbers or floating point numbers.

  • Integer are entered as: 23 or -10

  • Fixed Point number are entered as: 0.1 or -123.57458

  • Floating point numbers are given with exponent: 1.2345E3 or 42.3234E-4

  • The IvyScript Numbers are java.lang.Number objects but has a simplified and extended class reference definition. Format methods has been added for convenience.

String

String objects represent character strings.

  • You enter a String literal in double quotes: "Hello John"

  • Strings can be concatenated with the + operator: "Hello "+"John"

  • The IvyScript Strings are java.lang.String objects but has a simplified and extended class reference definition. Conversion and format methods has been added for convenience.

Record

Usually Records are obtained in the context of data base queries, where they represent a row in a table. Record objects are similar to a List where each element has an assigned field name.

Recordset

A RecordSet may be the result of a database query representing part of a table.

XML

The Xml class is used for the processing of XML documents. You can create XML Documents or apply XPath expression to filter and extract values.

Tree

The Tree data type holds the data for a tree. A tree is a hierarchy of nodes and sub nodes. A node in the tree contains a value object and an info string and might have any number of attached children sub nodes.

Binary

A Binary object is a wrapper object for a byte array.

List

List objects can contain any number of other objects of any type. Each object in a list has an index which starts at zero.

  • Examples are: [1,2,3] a list with three numbers

  • [1,"Red",2,"Green",3,"Blue"] a list with different objects.

  • Beside this general list type, so called typed list exists. A typed list can only contain objects of certain type.

  • Those list types are written as follows: List<aClass>

File

A File object can be used to read/write temporary or persistent data. IvyScript Files are created in a confined area that belongs to the running application. Temporary files are created in a session-specific file area and are automatically deleted if a session ends. Temporary Files can be made persistent.

IvyScript Files are always addressed relatively, i.e. absolute addressing will lead to errors. You can create folders and files, i.e. a hierarchical structure, but you can not navigate outside the confined area (which is also the reason why absolute File paths are disallowed).

Tip

You can always use java.io.File as an alternative to the IvyScript File object. However, in this case you must always use the Java File fully qualified, i.e. you can not import the class. Any IvyScript File can be transformed into a Java File (e.g. if needed to pass as parameter to a Java method).

The Environment Variable ivy

The ivy environment variable is provided to access the context of the current process. The environment information is available as fields on the global ivy variable, e.g. to access the CMS of the current project you use:

String okMessage = ivy.cms.co("/text/messages/ok");

Note

Access from IvyScript:

The variable ivy is available everywhere, where IvyScript can be used, e.g. on Step elements or in output tables of other elements.

Access from Java:

You can also access ivy from a Java context, e.g. from helper classes. To do so, simply import the ch.ivyteam.ivy.environment.Ivy class and use it’s static API.

Please note that it is necessary that the Java code which makes use of the ivy context variable must run within an Ivy request. Otherwise context information will not be available, most likely resulting in an EnvironmentNotAvailableException.

Access from JSP:

The ivy variable is also accessible from JSP. You can import the class ch.ivyteam.ivy.page.engine.jsp.IvyJSP and declare the variable ivy in your JSP as follows:

<%@ page import="ch.ivyteam.ivy.page.engine.jsp.IvyJSP"%>
<jsp:useBean id="ivy" class="ch.ivyteam.ivy.page.engine.jsp.IvyJSP" scope="session"/>

The following environment objects are available on ivy (details of the objects are described in the Public API):

  • cal - an IDefaultBusinessCalendar object that gives access to business calendar informations and calculations.

  • request - an IProcessModelVersionRequest object, the representation of the request against the server to execute the current step

  • response - an IResponse object, the response of the Axon.ivy Engine on the request to execute the most current step

  • wf - an IWorkflowContext object giving access to all workflow objects (all tasks, all cases) of all users for the application under execution. Can be used to build a whole workflow administration UI application, find tasks, cases, do statistics, etc. There is a workflow context for each application and vice versa.

  • session - an IWorkflowSession object gives access to all workflow objects (task and cases) that belongs to the user of the current session. A workflow object belongs to a user if:

    • A task is assigned to him or a role he owns.

    • A task he is currently working on.

    • A task he worked on in the past (needs permission).

    • A task that a member of a role he owns has worked on in the past (needs permission).

    • A case he has started (needs permission).

    • A case that have been started by a member of a role he owns (needs permission),

    • A case that has a task which he worked on (needs permission).

    • A case that has a task which a member of a role he owns has worked on in the past (needs permission).

  • task - an ITask object, the representation of the user’s current work unit in the process under execution.

  • case - an ICase instance that represents the current process under execution

  • cms - a IContentManagmentSystem object representing the CMS used in this project.

  • html - a IHtmlDialogContext object specifies the Axon.ivy HTML environment

  • log - a Logger object. You can define log outputs here that will be collected for each run. You can see these log entries in the Runtime Log View.

  • extensions - a IExtensions instance allowing access to Axon.ivy extensions

  • datacache - the reference to the IDataCacheContext instances for the application and session (see Data Caching)

  • persistence - references to the existing persistence units in this application (see Persistence Configuration Editor and Persistence API for more information about the API of the Persistence)

  • var - references to the global variables that are defined for this application (see Global Variables for more information)

  • rules - references to the rule engine integration within Axon.ivy.

Note

The html object is only available within a business process.