You must use proper syntax when adding transform functions to your script, or your script won't run properly. You can reference all transform functions using functional notation, as described in this topic.
geotagAddress function to an attribute called address:
geotagAddress(address)
<attribute>.<function>()
toString function to convert an attribute called quantity to a String:
quantity.toString()
Note:
You can only use dot notation for original Groovy functions. For the BDD-specific transform functions, you must use functional notation.Function chaining
Function chaining allows you to apply multiple functions to an attribute in a single statement. You chain functions by passing an attribute to one function, then passing that function to another function. The innermost function (the one receiving the attribute as a parameter) is evaluated first, and the outermost function is evaluated last.
// Performs two transformations on a single attribute using one line of code: toUpperCase(geotagIPAddressGetCity(IP_address))
// The same two transformations as above, without chaining. // 'city_name' is a temporary variable that stores the output of geotagIPAddressGetCity() def city_name = geotagIPAddressGetCity(IP_address) toUpperCase(city_name)
As you can see in the examples, function chaining makes your code cleaner and easier to read. Additionally, not having to include placeholder variables, such as city_name in the second example, helps make your code less error prone.