

If you want your search macro to use a generating command, remove the leading pipe character from the macro definition. When you use generating commands such as search, inputlookup, or tstats in searches, put them at the start of the search, with a leading pipe character. Pipe characters and generating commands in macro definitions When using a search macro with the eval command, a literal string in the search macro definition must be surrounded by double quotation marks. For example, eval command syntax requires that any literal string in the expression is surrounded by double quotation marks. The SPL in a search macro definition must comply with the syntax requirements of the search command that uses it. For example, $arg1$ might be the first argument in a search macro definition. If your search macro definition has variables, the macro user must input the variables into the definition as tokens with dollar signs on either side of them. The fundamental part of a search macro is its definition, which is the SPL chunk that the macro expands to when you reference it in another search. This message appears when the argument values that invoke the search macro fail the validation expression. (Optional) Enter a Validation error message if you defined a validation expression.The validation expression is an eval expression that evaluates to a Boolean or string value. (Optional) Enter a Validation expression that verifies whether the argument values used to invoke the search macro are acceptable.The string cannot contain repetitions of argument names. Argument names may only contain alphanumeric characters (a-Z, A-Z, 0-9), underscores, and dashes. This is a comma-delimited string of argument names. (Optional) Enter any Arguments for your search macro.(Optional) Click Use eval-based definition? to indicate that the Definition value is an eval expression that returns a string that the search macro expands to.In Definition, enter the search string that the macro expands to when you reference it in another search.For example, if your search macro mymacro includes two arguments, name it mymacro(2). If your search macro includes an argument, append the number of arguments to the name. Enter a unique Name for the search macro.Select a different app from the Destination app list if you want to restrict your search macro to a different app. (Optional) Check the Destination app and verify that it is set to the app that you want to restrict your search macro to.

Select Settings > Advanced Search > Search macros.(Optional) If your search macros require the search writer to provide argument variables, you can design validation expressions that tell the search writer when invalid arguments have been submitted.See Insert search macros into search strings.You can also specify whether the macro field takes any arguments. Search macros can be any part of a search, such as an eval statement or search term, and do not need to be a complete command. Search macros are reusable chunks of Search Processing Language (SPL) that you can insert into other searches.
