Working with Macros
pasTransfer supports a custom macro language that can be used when constructing mapping to assist in the conversion of data from the source to the destination. The macro language is both flexible and powerful allowing for the extraction of values from the available data, external conditions, and additional files. With the ability to contain nested macros and perform conditional processing, pasTransfer's macro language facilitates easy translation of data from source to destination.
Macros are specified by being wrapped in square brackets [ ]. Macros that do not start and stop with square brackets will not be properly parsed and will cause errors. Most macros consist of multiple arguments. These arguments are separated with a pipe character |. Each macro will contain a different number of arguments, and some of the arguments may be required while others may be optional. If an opening bracket, closing bracket, or pipe character needs to be part of one of the arguments in the macro a backslash \ can be used as an escape character which will prevent the very next character from being interpreted.
Example: [Lower|This contains \[brackets\]]
Returns “This contains [brackets]”.
NOTE: The escape character is macro language and will only be parsed inside of a macro statement.
Within pasTransfer, macros have the ability to contain other macros. This is referred to as nesting and allows for added flexibility when dealing with macros such as If, Copy, or Attribute. There is no limit to how many macros can be nested. All of the macros that are available can be nested inside any other macro.
With the added flexibility of the macro language, there opens up the possibility that an error may happen when parsing due to malformed macros. pasTransfer exposes 4 different ways of dealing with these errors. The first is to display a message box detailing the error encountered within the macro. This is useful and recommended when processing data with pasTransfer manually. The second is to preserve the unparsed macro in the resulting string. The third is to insert nothing into the string. The fourth is to insert the reason for failure within the string. The last three options are recommended when using pasTransfer in an automated scenario.
The names of the macros themselves are not case sensitive, meaning that Upper is the same as UPPER. Arguments for the macros may or may not be case sensitive, so please consult the documentation for the specific macro that is being used.
Copyright © 2023 pasUNITY, Inc.
Send comments on this topic.