1. General

With Velocity script, you can expand the functionality of Intrexx. Click here for more information about where the Groovy script editor can be found and used in the Intrexx Portal Manager. The following links provide additional helpful information about using Velocity in Intrexx:
The corresponding, sufficient programming knowhow is required to use Velocity in Intrexx. Please note that United Planet is not liable for errors, loss of data or security flaws that arise as a result of incorrect Velocity scripts.

2. Intrexx Standard Library

In the Velocity script editor, you can access the Intrexx Standard Library on the Libraries tab. If you select an entry in the library, you can access these buttons at the bottom right of this area:

Show description
Shows the description of the currently selected function with an example script.

Open link
Links to the corresponding page that provides more information. The page that opens also shows the classes, interfaces, methods or properties that the currently selected function can be used for.

2.1. Application structure

2.1.1. Application property

Read an application property.
#set($app = $RtCache.getApplication("<app_GUID>"))
#set($appPropValue = $!app.getProperties().get("<propertyname>"))
Interface ApplicationInfo

2.1.2. Data group property

Read a data group property.
#set($dg = $RtCache.getDataGroup("<datagroup_GUID>"))
#set($dgPropValue = $!dg.getProperties().get("<propertyname>"))
Interface DataGroupInfo

2.1.3. Data field property

Read a data field property.
#set($fld = $RtCache.getField("<field_GUID>"))
#set($fldPropValue = $!fld.getProperties().get("<propertyname>"))
Interface FieldInfo

2.1.4. Application info

Information about the application with the stated GUID.
#set($appInfo = $RtCache.getApplication("C6F004594EEA424B2AACCD105181AD7F0660DF6D"))
Interface ApplicationInfo

2.1.5. Data group info

Information about the data group with the stated GUID.
#set($dgInfo = $RtCache.getDataGroup("93B1A993C5FCF2895C93E1B7BF3BDDC847DC2BCD"))
Interface DataGroupInfo

2.1.6. Data field info

Information about the data field with the stated GUID.
#set($fldInfo = $RtCache.getField("8E2B87AE9F9BD1FD2FE38AD6856347F3A0D358AD"))
Interface FieldInfo

2.1.7. Page info

Information about the page with the stated GUID.
#set($pageInfo = $RtCache.getPage("D867C6B9AC0D17E3F524ED5A5E164463046F8F01"))
Interface PageInfo

2.2. Current user

2.2.1. Login name of current user

Returns the login name of current user.
Interface IUser

2.2.2. Email address of current user

Returns the email address of current user.
Interface IUser

2.2.3. Determine user memberships

Determine group memberships of the current user and execute further actions based on this.
#set($groupGuids = ['EF16F15EDA8562E19D7CD56BF2E43001F119193C', '47DD42CF4203EFDC7B1596E0158BB5B1E810D583'])
#set($userMembership = $Portal.getOrgStructure().getMembershipSets($User))

##Returns true, if $User is member of at least one group, which is defined by its guid in $groupGuids
#if ($userMembership.intersects($groupGuids))
	##Not implemented yet
Class VelocityOrgStructureWrapper

2.3. Objects in the Velocity context

2.3.1. $AccessController

Class that can be used to check access permissions to applications, data groups etc. Objekt zur Überprüfung von Zugriffsrechten an Applikationen, Datengruppen etc.
Class IxAccessController

2.3.2. $AsynchronousRequestHandler

Object for processing asynchronous requests.
Class AsynchronousRequestHandlerCallable

2.3.3. $BCM

Object for accessing the cache manager and the update sequence number (USN) of individual objects.
##Returns the USN of the transferred view page
Class BrowserCacheManager

2.3.4. $BpeeFactory

Class BpeeFactory

2.3.5. $Browser

Object for requesting browser information.
##Returns the user agent string of the calling browser.
Class BrowserCallable

2.3.6. $CalcUtil Introduction

In the following, the Velocity context object "$CalcUtil" for calculating values will be presented and explained using code examples. With the function calculate(), complex calculation and comparison operations can be performed. The '( )' brackets can be used to structure the operation. The values for the calculation and comparison operations being performed can be read from data fields, sessions, requests, table cells or SharedStates. Operators

The following operators are available in a calculation formula: Other type categories and methods

In addition to the operators described above, there are additional options to call certain variables or methods in formulae:

Method Description Example
datafield Value from a data field datafield("C68F6...D3DE7")
datafieldAsNumber Value from a data field as a number datafieldAsNumber("C68F6...D3DE7")
session Value from an existing session of the currently logged-in user session("sessionValue")
sessionAsNumber Value from an existing session of the currently logged-in user as a number sessionAsNumber("sessionValue")
sharedState Value from the current processing context sharedState("sharedStateValue")
sharedStateAsNumber Value from the current processing context as a number sharedStateAsNumber("sharedStateValue")
requestAsNumber Value from the current request as a number requestAsNumber("rq_requestValue")
abs Absolute value abs(-1)

For the types with the suffix "AsNumber", Intrexx will attempt to cast the incoming values, provided it is technically possible. Without this cast, an exception will occur when you use string data fields, for example. The Boolean values "true" and "false" will be cast accordingly to 1 and 0, respectively. It is also possible to state a fallback as a second method parameter. This fallback is used if the first parameter is null or empty. This fallback value can also be a formula.
//returns -1, if access to the SharedState variable
"sharedStateValue" returns null or the value is not defined.
sharedState("sharedStateValue", -1)

//returns 5, if access to the request variable "rq_custom" returns null
or the value is not defined.
requestAsNumber("rq_custom", (10/2))

//returns 0, if the data field contains null or has not been defined.
datafield("C68F6...D3DE7", 0) Error handling

To catch potential errors (e.g. dividing by 0), the following methods can be used in a formula:

Method Description Example
zeroOnError Returns 0 in the case of error zeroOnError(10/0) == 0
oneOnError Returns 1 in the case of error oneOnError(10/0) == 1
fallbackOnError Returns the fallback value in the case of error fallbackOnError(10/0, 2) == 2 Rounding functions

Number values can be rounded in formulae. The parameter "scale" describes the number of decimal places.

Method Description
roundLong Round half away from zero
roundLongHalfAwayFromZero Corresponds to roundLong
round(scale) Round half away from zero to the number (scale) of decimal places (roundLong corresponds to round(0))
roundLongHalfAwayFromZero(scale) Corresponds to round(scale)
roundLongHalfDown(scale) Case differentiation

Conditions in formulae can be checked in advance with case differentiation, and based on their result, certain formulae or values can be used.
case(<booleanExpression>, <Formula for true>, <Formula for false>)
Für den boolschen Ausdruck bestehen hierbei folgende Regeln: If logical operators are used for the calculation, false becomes 0 and true becomes 1. This results in the following:
5 > 0 + 0 > -1 == 2 Examples

The calculation call with the function "calculate()" on view pages always has three parameters: Simple addition of two values
Here is a simple example for adding values from data fields. To address a data field, you can either state its GUID or the name of the control in single quotation marks.
##Parameters to be transferred to the method calculate():
## $ProcessingContext (fixed value)
## $DC 
## '<Control name of the first summand>'
## <Operator>
## '<Control name of the second summand>'
$CalcUtil.calculate($ProcessingContext, $DC, 'dataField("integervcontrol1") + dataField("integervcontrol2")')

##Same example but with the data field GUID instead of the control
$CalcUtil.calculate($ProcessingContext, $DC, 'dataField("3BB...5B3") + dataField("C95...950")')
The methods described above can be combined and nested to use values from different sources (session, request etc.).
## Combination of data field and session value.
$CalcUtil.calculate($ProcessingContext, $DC,'dataField("3BB...5B3") + session("calcutil_example")')

## Combination of data field and request value.
$CalcUtil.calculate($ProcessingContext, $DC, 'dataField("floatcontrol02E5") + requestAsNumber("rq_calcUtil")')

## Less than comparison with request value.
#set($term = '(dataField("B5F472ED66DCA878683B52CE8F979F4F1DDA172B") * 2) + session("calcutil_value") <
$CalcUtil.calculate($ProcessingContext, $DC, $term)

## Case differentiation for request value
#set($term = '(dataField("B5F472ED66DCA878683B52CE8F979F4F1DDA172B") * 2)')
$CalcUtil.calculate($ProcessingContext, $DC, "case(requestAsNumber('rq_calcUtil') <= 100, $term, -1)") Aggregate functions for tables

You can also process values from table columns using "$CalcUtil". The calculation operations listed in the table below are available for this: The call of methods for tables always have two parameters:
$CalcUtil.calculate($ProcessingContext, $DC, 'sum(table("8E9...1B3"), row("integervcontrol3621234C"))')
$CalcUtil.calculate($ProcessingContext, $DC, 'sum(table("8E9...1B3"), row("integervcontrol3621234C"))')
The values are calculated when the page is opened. If the table has a navigation element and this is used, the values of the Velocity statements and calculations are not updated because they the table is reloaded dynamically via AJAX. If you want to perform table calculations after navigation within the table, the corresponding VTL Include (or VM) need to also be reloaded via AJAX. As a workaround, we recommend creating the table to be calculated in such a way that navigation is not required.
Method Description
sum Calculates the sum of the column values from the data that is displayed on the current page.
min Calculates the minimum of the column values from the data that is displayed on the current page.
max Calculates the maximum of the column values from the data that is displayed on the current page.
count Calculates the number of data records shown on the current page.

Please note that the following methods are computation intensive. If you have a large amount of data, you may encounter corresponding delays.

Method Description
totalSum Calculates the sum of the column values of all data records.
totalMin Calculates the minimum of the column values of all data records.
totalMax Calculates the maximum of the column values of all data records.
totalCount Calculates the number of all data records.

Please note: If the table does not contain any data, the methods above will return the number 0.
## Example output of an info text beneath an article table
#set($sum = 'totalSum(table("8E9F10DCB24CBB4B27FF67A3230CE7753521E1B3"), row("integervcontrol3621234C"))')
#set($count = 'totalCount(table("8E9F10DCB24CBB4B27FF67A3230CE7753521E1B3"), row("floatvcontrol256AC41"))')
$CalcUtil.calculate($ProcessingContext, $DC, $count) articles have been ordered with a total value of $CalcUtil.calculate($ProcessingContext, $DC, $sum) €.

2.3.7. $Chat

Object for sending and receiving chat messages.
Class ChatProxy

2.3.8. $Codec

Object for coding and encoding strings.
$Codec.hexEncodeString("", "UTF-8")
Class Codec

2.3.9. $CollectionFactory

Object for creating collections.
Class CollectionFactory

2.3.10. $Constants

Object for accessing the constants of a class.
Class Constants

2.3.11. $DC

Object for accessing a collection of data objects (e.g. the current data record).
##Returns the record ID of the current data record as a string

2.3.12. User-defined $DC in emails

Manual initialization of context object $DC (short for $Loader.getDataCollection()) for using in emails with content generated from Velocity. With <APP-GUID>, the GUID of the application, which is the source of the data records to be processed, has to be provided. The following conditions must be met:
#set($template = $Loader.process($ProcessingContext, "<APP_GUID>", "data"))
#set($DC = $Loader.getDataCollection())

2.3.13. $DC - Read value of a control

Read the value of a control (e.g. value of a view field). Use the name of the control, where the value should be read from, as the parameter. Within free layout tables tables, use the context object $drRecord instead of $DC.

#set($value = $DC.getValueHolder('textvcontrol1234').getValue())
#set($value = $DC.getValueHolder('<CONTROL_NAME>').getValue())

2.3.14. $DEBUG

Object for inspecting individual objects and elements in more detail.
##Returns detailled information about the current user object.
Class ObjectInspector

2.3.15. $defaultLanguage

The default language of the portals.

2.3.16. $DIMHelper

Objects for accessing Office Integration instances
Class DIMWrapper

2.3.17. $DataTransferCallable

Object for accessing data transfer connections.
##Returns the JobHistory of the data transfers job with the stated GUID
Class DataTransferCallable

2.3.18. $DbUtil

Object for accessing database connections and managing transactions of database operations.
#set($conn = $DbUtil.getConnection("IxSysDb"))
Class DatabaseUtil

2.3.19. $DefaultMaker

Class DefaultMaker

2.3.20. $DistributionControl

Object for accessing distribution controls.
Class VCDistributionControl

2.3.21. $DoubletService

Object for searching for duplicates in data records of an application.
Class DoubletServiceCallable

2.3.22. $drRecord

Object for accessing the current record in a free layout table.
Interface IRow

2.3.23. $DtUtil

Object for date calculations.
Class DateTimeUtil

2.3.24. $ESC

Present characters that are normally escaped in Velocity.
##Present a hash (#)
Class EscapedCharacters

2.3.25. $Error

Object for analyzing exceptions.
Class ErrorObject

2.3.26. $ExceptionUtil

Object for throwing exceptions.
$ExceptionUtil.throwException("", "The file stated does not exist.")
Class VelocityExceptionUtil

2.3.27. Objects for Microsoft Exchange

These objects can only be used in conjunction with the Intrexx MediaGateway. $ExchangeCallable

Callable for Exchange authentications.
Class ExchangeCallable $ExchangeConnectionCallable

Callable for Exchange connections.
Class ExchangeConnectionCallable $ExchangeMailboxCallable

Callable for accessing the mailbox of an Exchange user.
##Returns the out-of-office message of the current user.
Class ExchangeMailboxCallable $ExchangeMessageCallable

Callable for accessing message objects.
##Saves the message with the ID $strMessageId as an EML file in $strDestinationPath.
$ExchangeMessageCallable.saveMessageAsEML($strMessageId, $strDestinationPath)
Class ExchangeMessageCallable $ExchangeItemCallable

Callable for accessing Exchange objects.
##Saves attachments of the with the ID $strMessageId in $strDestinationPath.
$ExchangeItemCallable.saveAttachment($strMessageId, $strDestinationPath)
Class ExchangeItemCallable $ExchangeUserMailboxCallable

Callable for mailbox information of an Exchange user.
Class ExchangeUserMailboxCallable

2.3.28. $FCKConnectorResponseFactory

Class FCKConnectorResponseFactory

2.3.29. $Factory

Generate or access objects such as users without them having been predefined in the Velocity context.
Class ObjectFactory

2.3.30. $FieldFormatter

Class FieldFormatter

2.3.31. $FileHelper

Object for file operations such as inserting a file into an Intrexx data group.
##Deletes the file from the data field 
##identified by the GUID and the data record identified by the RecID "1".
$FileHelper.deleteFileFromIntrexx($ProcessingContext, "079A397D11EE732857CD1017C3AC6A55D0D112DA", "1")
Class VCFileHelper

2.3.32. $FileUtil

Object for analyzing files in a folder hierarchy.
Class FileUtil

2.3.33. $Filter

Collection of diverse filters for collections used in the Velocity context.
Class Filter

2.3.34. $ForumInfo

Object for accessing forum, thread and post information.
Class ForumInfo

2.3.35. $FramesetHelper

Object for creating a new URL based on the current request and a list of additional parameters.
Class FramesetHelper

2.3.36. $HelperFactory

Converts the characters <, >, & and " into their corresponding HTML entity.
Class HelperFactory

2.3.37. $I18N

Object for accessing language constants.
Class LanguageConstantsCallable

2.3.38. $JSON

Auxiliary functions for creating and working with JSON objects.
Class JSONUtil

2.3.39. $lang

Current portal language.

2.3.40. $layout

Name of the current layout.

2.3.41. $LayoutManager

Access layout information.
Class LayoutManagerCallable

2.3.42. $ListBoxControl

Object for accessing drop-down lists.
Class VCListBoxControl

2.3.43. $ListFormatter

Auxiliary functions for formatting lists.
Class ListFormatter

2.3.44. $Loader

Processes incoming requests. You can, for example, access the current database connection via the $Loader.
Class BuslogicCaller

2.3.45. $Locales

Access regional settings for number and date values.
Class VCLocales

2.3.46. $LogAnalyzer

Object for generating application, user and statistic reports.
Class LogAnalyzer

2.3.47. $MBGallery

Object for processing and copying/moving/deleting images.
Class Gallery

2.3.48. $MassMailCallable

Class MassMailCallable

2.3.49. $Math

Object for diverse arithmetical operations.
Class MathUtil

2.3.50. $Menu

Object for accessing the menu structure.
Class MenuCallable

2.3.51. $MenuCloud

Object for accessing a menu cloud.
Class MenuCloud

2.3.52. $NewsControllerUtil

Object for access news from a newsletter.
Class NewsControllerUtil

2.3.53. $ObjectHelper

Object for null objects and ValueHolders.
Class ObjectHelper

2.3.54. $PageLister

Object for accessing application pages.

2.3.55. $PageUtil

Object for accessing controls and data on the view page of a data record.
#set($renderer = $RendererFactory.getDefaultRenderingContext($ProcessingContext, $User, $lang))
#set($page = $PageUtil.process($RenderingContext, $ProcessingContext, $Request.get("rq_AppGuid"), $DC))
The rendering and processing context as well as the GUID of the current application and a DataCollection are required for initialization
## Example output
## [textvcontrol60C5B1A8, datetimevcontrol88EFC15D, checkvcontrol68B97F7C, integervcontrolE018B980]

## Example output
## [4A21CF034953825EE93093E0C8E51C959D193C5F, 4B953139D2E394C42BD20919A2C1CA757EC10A1A]
The variable "$page" can be used to access controls and data fields on the page.

2.3.56. $PolicyBrowserFactory

Class Factory

2.3.57. $PollHelper

Object for requesting poll properties.
Class PollCallable

2.3.58. $Portal

Object for accessing portal properties (e.g. name).
Class Portal
Object for accessing the organizational structure of the portal.

Class VelocityOrgStructureWrapper

2.3.59. $PortalLayoutFactory

Object for accessing the portal layout.

2.3.60. $PreparedQuery

Object for creating and performing database requests.
Class DbQuery

2.3.61. $ProcessingContext

Object of the current processing context.
Class BusinessLogicProcessingContext

2.3.62. $QNameFactory

Object for creating a new xsd:QName namespace.
Class QNameFactory

2.3.63. $RDFCallable

Object for accessing tags provided in a portal.

2.3.64. $Renderer

Object for creating diverse renderers.
Class StandardUtilRendererFactory

2.3.65. $Rendering context

Object for accessing the current, default portal rendering settings.
$Rendering context
Class Rendering context

2.3.66. $Request

Object for setting and reading request variables.
Class IServerBridgeRequest

2.3.67. $Response

Object for setting and reading properties of an HTTP response.
Class HttpResponseWrapper

2.3.68. $RtCache

Runtime cache object with information about applications, data groups etc.
Class VelocityRtCache

2.3.69. $SaucMenu

Objects for setting menu permissions in the web CMS.
Class SaucMenuPermission

2.3.70. $SearchUtil

Object for search queries.
Class SearchUtil

2.3.71. $Session

Access the session of the current user.
Class Session

2.3.72. $SettingsHelper

Object for reading settings.
Class VCSettingsHelper

2.3.73. $SharedState

Set and read user-defined values in the processing context.
Read a value from the processing context:


Write a value to the processing context:

$SharedState.putAt("myVariable", "myWert")
$SharedState.putAt("<paramName>", "<paramValue>")
Class SharedState

2.3.74. $Sort

Auxiliary object for sorting lists.
Class Sort

2.3.75. $TextUtil

Auxiliary object for different types of string manipulations.
Class TextUtil

2.3.76. $TickerMan

Object for accessing the RSS provider.
Class TickerManager

2.3.77. $Unique

Object for generating unique variables.
Class Unique

2.3.78. $UrlBuilder

Object for creating URLS.
Class UrlBuilder

2.3.79. $User

Object for accessing information of the current user.
Class User

2.3.80. $VDiff

Object for displaying diffs of wiki entries.
Class VDiff

2.3.81. $VH

Object for createing ValueHolders.
Class ValueHolderFactory

2.3.82. $VHHelper

Auxiliary class for reading values in ValueHolders.
Class VCValueHolderHelper

2.3.83. $VelocityContext


2.3.84. $VelocityUtil

Class VelocityUtil

2.3.85. $Wiki

Class WikiRenderer

2.3.86. $Zebra

Class ZebraFactory

2.4. Databases

2.4.1. Current database connection

Gets the current system connection to the database.

2.4.2. Access an external data connection

Access an external data connection.

2.4.3. Get all column names of a data group

Returns a list of column names from the data group with the stated GUID.
#set($fields = $RtCache.getFields())
#set($columnNames = [])

#foreach($field in $fields)
	#if($field.getDataGroupGuid() == "<DG_GUID>")
		#set($bResult = $columnNames.add($field.getColumnName()))

2.4.4. Prepared statement with SELECT

Executes a SELECT query on a database table.
#set($statement = $PreparedQuery.prepare($DbConnection, "SELECT <COLUMNS> FROM DATAGROUP('<DATAGROUP_GUID>') WHERE <CONDITION>"))
##$statement.setString(1, "Example text")
##$statement.setInt(2, 123)
##$statement.setBoolean(3, true)
#set($rs = $statement.executeQuery())
#foreach($element in $rs)
Class DbPreparedStatement

2.4.5. Prepared statement with INSERT

Executes an INSERT query on a database table.
#set($conn = $DbConnection)
#set($statement = $PreparedQuery.prepare($conn, "INSERT INTO DATAGROUP('<DATAGROUP_GUID>') (<COLUMNS>) VALUES ()"))
##$statement.setString(1, "Example text")
##$statement.setInt(2, 123)
##$statement.setBoolean(3, true)
##$statement.setTimestamp(4, $DtUtil.utcNow())
Class DbPreparedStatement

2.4.6. Prepared statement with UPDATE

Executes an UPDATE query on a database table.
#set($l_conn = $DbConnection)
#set($statement = $PreparedQuery.prepare($l_conn, "UPDATE DATAGROUP('<DATAGROUP_GUID>') SET <COLUMN> = ? WHERE <CONDITION>"))
##$statement.setString(1, "strValue")
##$statement.setInt(2, 123)
##$statement.setBoolean(3, true)
##$statement.setTimestamp(4, $DtUtil.utcNow())
Class DbPreparedStatement

2.4.7. Prepared statement with DELETE

Executes an DELETE query on a database table.
#set($conn = $DbConnection)
#set($statement = $PreparedQuery.prepare($conn, "DELETE FROM DATAGROUP('<DATAGROUP_GUID>') WHERE <CONDITION>"))
##$statement.setString(1, "Example text")
##$statement.setInt(2, 123)
##$statement.setBoolean(3, true)
##$statement.setTimestamp(4, $DtUtil.utcNow())
Class DbPreparedStatement

2.4.8. Read a single value using a prepared database query (with fallback)

Reads a single value from a database query. If the result set is empty, or the value is null, the fallbackValue is returned. If the return data type should be defined more precisely, typed method calls such as executeAndGetScalarBooleanValue(...) can be used.
#set($statement = $PreparedQuery.prepare($DbConnection, "SELECT <COLUMN> FROM DATAGROUP('<DATAGROUP_GUID>') WHERE <CONDITION>"))
##$statement.setString(1, "Example text")
##$statement.setInt(2, 123)
##$statement.setBoolean(3, true)
#set($result = $statement.executeAndGetScalarValue(<FALLBACK_VALUE>))
Class DbPreparedStatement

2.4.9. Determine the database type

Gets the database type of the system connection. Compare the database type with following identifiers: Unsupported system databases:
#set($strType = $DbConnection.getDescriptor().getDatabaseType())

Class DbPreparedStatement

2.4.10. Timestamp for system values

This variable contains the timestamp of the current transaction and remains unmodified until the end of this transaction.

2.5. Troubleshooting

2.5.1. Inspect an object

Class ObjectInspector

2.5.2. Write info to log file

Class ObjectInspector

2.5.3. Write warning to log file

Class ObjectInspector

2.5.4. Write error to log file

Class ObjectInspector

2.5.5. Stopwatch - Start

Class ObjectInspector

2.5.6. Stopwatch - Take split time

Class ObjectInspector

2.5.7. Stopwatch - Restart

Class ObjectInspector

2.6. Portal data

2.6.1. Portal name

Returns the name of the current portal as a string.
Class Portal

2.6.2. Time zone

Gets the portal's default time zone.
Class Portal

2.6.3. Users online

Returns a list of GUIDs of all logged-in users of the current portal. The parameter true/false defines whether anonymous users are included in the result list.
Example (also returns anonymous users):
Class Portal

2.6.4. Active sessions

Gets the number of active portal sessions.
Class Portal

2.7. Calculate

2.7.1. Add

Adds two integer, float or double values.
$Math.add($value1, $value2)
Class MathUtil

2.7.2. Subtract

Subtracts two integer, float or double values.
$Math.sub($value1, $value2)
Class MathUtil

2.7.3. Multiply

Multiplies two integer, float or double values.
$Math.mult($value1, $value2)
Class MathUtil

2.7.4. Divide

Divides two double values.
$Math.div($value1, $value2)
Class MathUtil

2.7.5. Maximum

Calculates the maximum of two values.
$Math.max($value1, $value2)
Class MathUtil

2.7.6. Minimum

Calculates the minimum of two values.
$Math.min($value1, $value2)
Class MathUtil

2.8. Renderer

2.8.1. Current date

Creates and formats a date according to the specified portal settings.
$DefaultDateTimeRenderer.writeOutput($Response.getWriter(), $$User.getTimeZone()))

2.8.2. Current date in user-defined format

Creates and formats a date according to a user-defined renderer.
Output in this example (last value defines the calendar week): 21.09.2009 12:14:35 39
#set($dateTimeRenderer = $RendererFactory.createDateTimeRendererWithParameters($RenderingContext, false, false, null, "dd.MM.yyyy CW", "", null))
$dateTimeRenderer.writeOutput($Response.getWriter(), $$User.getTimeZone()))

2.8.3. Rendering context

Access the current rendering context.
$Rendering context
Class Rendering context

2.9. Date

2.9.1. Localize date

Creates and formats a date according to the specified location. Please note: The specified location needs to be defined as a portal language in the portal properties.

2.10. Session

2.10.1. Session ID

Returns the ID of the current session.
Class Session

2.10.2. Read session variable

Returns the value of a session variable.
Class Session

2.10.3. Write session variable

Writes a session variable.
Class Session

2.11. Escaping

2.11.1. $ Dollar sign


2.11.2. # Number sign; hash


2.11.3. " Quotation mark


2.11.4. ! Exclamation mark


2.11.5. \ Backslash


2.11.6. CR Carriage return


2.11.7. LF Line feed


2.11.8. CRLF Line break


2.11.9. TAB horizontal tabulation


2.12. TextUtil

2.12.1. Convert an array into a string

Converts an array list into a string, using the default delimiter | and escape character 0. To use different delimiter and escape characters, call the function with additional parameters.
//Using default delimiter and escape characters.
//Using user-defined delimiter and escape characters.
$TextUtil.arrayToString(p_array, "$", "!")
Class TextUtil

2.12.2. Convert a string into an array

Converts a string into an array, if the string was previously created using arrayToString(p_myArray) with default delimiter (|) and escape character (0).
Class TextUtil

2.12.3. Split a string

Splits a string to an array using the stated separator.
$TextUtil.split(p_string, "$")
$TextUtil.split(p_string, p_delimiter)
Class TextUtil

2.12.4. Parse an integer string

Parses an integer string to an integer.
Class TextUtil

2.12.5. Parse a float string

Parses a float string to an integer.
Class TextUtil

2.12.6. Parse a double string

Parses a double string to a double.
Class TextUtil

2.13. ValueHolder

2.13.1. Create a ValueHolder

Creates a ValueHolder from the given object.
Class ValueHolderFactory

2.13.2. Create a ValueHolder with the current date

Creates a ValueHolder with the current date.
Class ValueHolderFactory

2.14. Connector for Microsoft Exchange

2.14.1. Current Exchange connection

Returns the current Exchange connection.
#set($conn = $ExchangeConnectionCallable.getConnection())
Class ExchangeConnectionCallable

2.14.2. Folder information

Returns information about an Exchange folder (the inbox folder in this example)
#set($inbox = $ExchangeMailboxCallable.getInboxFolderHref($strMailboxName))
Class ExchangeMailboxCallable

2.14.3. Mailbox name of the current Exchange user

Returns the mailbox name of the current Exchange user.
#set($strMailboxName = $ExchangeUserMailboxCallable.getMailboxInfo().getMailboxName())
Class ExchangeUserMailboxInfo

2.14.4. Account of the current Exchange user

Returns the account connected to the current Exchange connection.
#set($account = $ExchangeUserMailboxCallable.getMailboxInfo().getUserAccount())
Class ExchangeAccount

2.14.5. Set the out of office messsage

Writes the out of office message and sets its status to active. The text is set for internal and external out of office messages.
#set($strMessage = "Out of office till 2010/12/31")
Class ExchangeMailboxCallable

2.14.6. Mark a messsage as read

Marks the message with the stated ID as read.
Example usage (e.g. on an email view page):
Class ExchangeMessageCallable

2.14.7. Message attachments

Returns the attachments of the mail with the stated ID.
Example usage (e.g. on an email view page):
Class ExchangeItemCallable

2.14.8. Create an Exchange appointment

Creates an appointment for the current user.

$startDate - Start date of the appointment
$endDate - End date of the appointment
$subject - Subject of the appointment
$body - Description of the appointment

If additional properties are set or updated with set()-methods after creating the appointment, they have to be saved with $ afterwards.

#set($appointment = $ExchangeAppointmentCallable.createNewAppointment($startDate, $endDate, $subject, $body))

#set($appointment = $ExchangeAppointmentCallable.createNewAppointment($startDate, $endDate, $subject, $body))
Class ExchangeAppointmentCallable

2.14.9. Create an Exchange contact

Creates a new contact for the current user.

$lastName - Last name of the contact
$firstName - First name of the contact
$mail - Email address of the contact
$mailbox - The user's mailbox that the contact should be added to. If null, the current users mailbox is used.

If additional properties are set or updated with set()-methods after creating the contact, they have to be saved with $ afterwards.

#set($contact = $ExchangeContactCallable.createNewContact($lastName, $firstName, $mail, $mailbox))

$contact.setJobTitle("Developer") $
#set($contact = $ExchangeContactCallable.createNewContact($lastName, $firstName, $mail, $mailbox))
Class ExchangeContactCallable

2.14.10. Create and end Exchange email

Creates a new email for the current Exchange user.

$from - Sender address
$to - Recipient address
$subject - Subject text
$body - Message text

If additional properties are set or updated with set()-methods after creating the message, they have to be saved with $ afterwards.

#set($message = $ExchangeMessageCallable.createNewDraft(strSender, strRecipient, strSubject, strBody))

#set($message = $ExchangeMessageCallable.createNewDraft(strSender, strRecipient, strSubject, strBody))
Class ExchangeMessageCallable

2.14.11. Create an Exchange note

Creates a note for the current user.

$text - Text of the note
$mailbox - The user's mailbox that the note should be added to. If null, the current user's mailbox is used.

#set($note = $ExchangeNoteCallable.createNewNote("My note", null))
#set($note = ExchangeNoteCallable.createNewNote($text, $mailbox))
Class ExchangeNoteCallable

2.14.11. Create an Exchange task

Creates a task for the current user.

$start - The tasks start date
$due - The tasks due date
$subject - The tasks subject
$mailbox - The user's mailbox that the task should be added to. If null, the current user's mailbox is used.

#set($task = $ExchangeTaskCallable.createNewTask(${cursor}dtStart, dtDue, "Task subject", null))

#set($task = $ExchangeTaskCallable.createNewTask(dtStart, dtDue, "Task subject", null))
Class ExchangeTaskCallable

2.15. If Else

Code snippet for an if else condition.
	##code for condition1
	##code for condition2
	##code if no condition matches

2.16. For each loop

foreach loop code snippet.
#foreach($element in )

2.17. Define a variable

#set( $id = 1)
#set( $userName = "Administrator")
#set($variable = aValue)

2.18. Output variable in local format

Outputs a variable in the portal's local format. The variable has to be defined in a ValueHolder. The following types can be used as the RENDERING_TYPE: integer, datetime, date, time, currency, number, boolean, author

#set($vhValue = $VH.getValueHolder(1))
#writeVH($vhValue, "currency", true, false, false)
#set($vhValue = $VH.getValueHolder($object))
#writeVH($vhValue, "<RENDERING_TYPE>", true, false, false)

2.19. Read request parameter

Read a request parameter.
Class IServerBridgeRequest

2.20. Write request parameter

Write a request parameter.
$Request.put("rq_param", "strValue")
Class IServerBridgeRequest

2.21. All data groups of an application

Returns the names of all data groups of the current application.
#set($datagroups = $AppWalker.getDatagroupsFromApplication($Request.get("rq_AppGuid")))
#foreach($datagroup in $datagroups)
	Name: $datagroup.getName()
Class ApplicationWalker

2.22. Dynamic identification of a table name per sysident

To identify the table name via sysident, the expert attribute sysident has to be defined on the Expert tab of the data group properties.
#set( $tablename = $AppWalker.getTableNameBySysident($Request.get("rq_AppGuid"), "MEIN_SYSIDENT"))
Class ApplicationWalker

2.23. Current date with the current user's time zone

Creates a current date considering the time zone of the current user.
Class CalendarAwareDate

2.24. Creates a JSON response

Creates a JSON response.
## This is necessary: Prevents the response from having line breaks, unwanted outputs, etc.

## You can write your Velocity code here without effecting the response by mistake
## e.g. set a variable
#set($myVar = "Hello client!")

## This may help you: Use a java.util.Map to make JSON formatting easier later.
#set($map = $CollectionFactory.createMap())
## Add everything required into the map with a reliable key.
$map.put("myJSONAnswer", $myVar)

## This is necessary: Format the response so the server delivers JSON.
$Response.setHeader("Cache-Control", "no-cache")
$Response.setHeader("Content-Type", "application/json;charset=UTF-8")

## Format the map to be escaped for the JSON string.

2.25. Create a GUID

Generates a new GUID.