Using macros

Macros are like variables that can be passed between operators. They can be used as operator values to control execution. They can also be modified during processing as well as set to specific values based on attribute values or from properties of example sets as a whole. Processes have Contexts (use the GUI view menu item to see this view), where macros can be defined. Furthermore, macros can act as parameters to a process when it is run under the control of an external server, for example, RapidAnalytics.

Macros are referred to by name and are enclosed by the reserved characters %{}. The following expression shows a macro called MyMacro being referred to:

%{MyMacro}

The percent sign and curly braces delimit the macro, and during the execution of the process, the value of the macro is substituted. How the value is interpreted depends on the context and the value itself. String values are usually interpreted as attribute names, and during execution, the end result will be that the attribute's value will be used. Placing double quotes around the macro reference ensures that it is treated as a string.

Macros are used everywhere. Chapter 4, Parsing and Converting Attributes, uses them extensively while generating attributes, and this chapter is recommended to get more exposure to their use. This use continues in Chapter 7, Transforming Data, where more advanced data transformation using macros is performed. Chapter 9, Resource Constraints, uses them to measure process performance and Chapter 10, Debugging, mentions using them for debugging.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset