The Script Adapter widget
provides a way for you to insert logic that transforms event data.
The logic is implemented with JavaScript code
and the returned value of the code is the outgoing event payload.
Scripts are limited to basic JavaScript and
should be viewed as the body of one single function. You cannot use
Dojo commands such as console.debug(); you must use
the alert() statement to display information about
the values in the script.
Before you begin
Before you begin, make sure that there is a wire between a
source widget and the
Script Adapter and
a wire between the
Script Adapter and
a target widget. The source widget broadcasts an event that the
Script Adapter receives
and transforms its data. The Script Adapter then sends the transformed
data to the target widget.
Procedure
- Click Edit Page.
- Click the widget menu icon and then select Edit
Settings. The Script Adapter Edit window
appears.
- Type the JavaScript code
that you want to use to transform the event data. End the script with
a Return statement.
Tip: You may want to convert
the Script Adapter widget
into a debugger while you are developing the script. When it is acting
as a debugger, the Script Adapter displays
the source event payload so that you can see the data that the script
needs to transform.
- Optional: Hide the Script Adapter widget
so that it is not visible to the user.
- Click OK.