Contact Us 1-800-596-4880

Runtime (dw::Runtime)

This module contains functions for interacting with the DataWeave runtime, which executes the language.

To use this module, you must import it to your DataWeave code, for example, by adding the line import * from dw::Runtime to the header of your DataWeave script.

Functions

Name Description

dataFormatsDescriptor

Returns an array of all DataFormatDescriptor values that are installed in the current instance of DataWeave.

Experimental: This function is an experimental feature that is subject to change or removal from future versions.

eval

Evaluates a script with the specified context and returns the result of that evaluation.

Experimental: This function is an experimental feature that is subject to change or removal from future versions.

evalUrl

Evaluates the script at the specified URL.

Experimental: This function is an experimental feature that is subject to change or removal from future versions.

fail

Throws an exception with the specified message.

failIf

Produces an error with the specified message if the expression in the evaluator returns true. Otherwise, the function returns the value.

location

Returns the location of a given value, or null if the location can’t be traced back to a DataWeave file.

locationString

Returns the location string of a given value.

orElse

Returns the result of the orElse argument if the previous argument to try fails. Otherwise, the function returns the value of the previous argument.

orElseTry

Function to use with try to chain multiple try requests.

prop

Returns the value of the property with the specified name or null if the property is not defined.

props

Returns all the properties configured for the DataWeave runtime, which executes the language.

run

Runs the input script under the provided context and executes the script in the current runtime.

Experimental: This function is an experimental feature that is subject to change or removal from future versions.

runUrl

Runs the script at the specified URL.

Experimental: This function is an experimental feature that is subject to change or removal from future versions.

try

Evaluates the delegate function and returns an object with success: true and result if the delegate function succeeds, or an object with success: false and error if the delegate function throws an exception.

version

Returns the DataWeave version that is currently running.

wait

Stops the execution for the specified timeout period (in milliseconds).