Skip to main content
OnCommand Workflow Automation 5.1

Examples of MVEL syntax

Contributors

MVFLEX Expression Language (MVEL) syntaxes are used in several OnCommand Workflow Automation (WFA) sample workflows. You should review some sample MVEL syntaxes to learn how to use MVEL in WFA.

The following sections provide some examples of MVEL syntaxes used in WFA.

Conditional execution

The following MVEL expression is used for conditional execution of a command when the number of volumes found is lesser than 4:

$NoOfVolumes < 4

Incremental naming

The following MVEL expression is used for incremental naming of an object:

last_volume.name+last_volume.state

This MVEL expression uses the last created volume name and the state of the last created volume for naming.

String representation in commands

The following MVEL syntax is used as a string representation:

DestinationCluster + ":" + DestinationVserver + "/" + DestinationVolume

Templates

The following MVEL syntax is used in a template:

calculateSnapReserveSize(calculateVolumeSizeFromDataSize((int)($fs_size*1.01),$snap_space),$snap_space)

This MVEL syntax is used to calculate the percentage of volume capacity to be reserved for Snapshot copies.

Command details

The following MVEL function is used in the attributes section of a parameters:

actualVolumeSize($VolumeSizeInGB * 1024, volume.snapshot_reserved_percent)

The following MVEL syntax is used in the attributes section of a parameter:

$VolumeName+'test001'

Workflow constants

The following MVEL syntaxes are used for constants in workflows:

convertNullToZero(infinite_volume.max_namespace_constituent_size_mb)
$Size_TB*1048576L

Return parameters

The following MVEL syntax is use to validate whether the requested size can be allocated:

size_remaining == 0 ? '' : throwException('Not sufficient space in capacity_class_aggregate or data constituent of size less than 1 TB can not be created: Total size requested='+$Size_TB+'TB'+' ,Size remaining='+size_remaining/TB_TO_MB+'TB'+', Infinite volume name='+infinite_volume.name+', Storage class='+CAPACITY_CLASS_LABEL)

Function definition

The following MVEL syntax is used in a function definition, which is used to convert null to zero:

def convertNullToZero (data)
{
  if(data == null)
  {
    return 0;
  }
  else
  {
    return data;
  }
}

Repetition of a specific row

The following MVEL expression uses a user input to indicate the number of times a row has to be repeated to create LUNs:

$NumberOfLunsToBeCreated

Conditional expressions for a row

The following MVEL expression uses a user input to indicate if the row will be executed:

$SetupSnapMirror