Suppose that by the time you are creating the transformation, the weights for calculating the weighted average are unknown. You can modify the transformation by using parameters. Let's do it:
Open the transformation of the previous section and save it with a new name.
Press Ctrl+T to open the Transformation properties dialog window.
Select the Parameters tab and fill it like here:
Replace the JavaScript step by a new one and double-click it.
Expand the Transform Scripts branch of the tree at the left of the window.
Right-click the script named
Script 1
, select Rename, and typemain
as the new name.Position the mouse cursor over the editing window and right-click to bring up the following contextual menu:
Select Add new to add the script, which will execute before your main code.
A new script window appears. The script is added to the list of scripts under Transform Scripts.
Bring up the contextual menu again, but this time clicking...