Macros
Macros are used in CaRMeN configuration for dynamic data manipulation. With the use of macros, most pre-processing needs are able to be met, and copy-and-pasting can be avoided. Usually only complex data structures require manual pre-processing.
Macros are objects with a single field that starts with a $
symbol followed by the name of the macro. The value that gets returned depends on type of macro being invoked. Internally, macros are just functions, and the macro object in a file describes how to invoke the respective function. When the macro is invoked, the whole macro object is replaced by its return value.
The following table lists the currently available macros in CaRMeN along with their arguments and return values.
Macro | Description | Argument | Return value |
---|---|---|---|
$ref |
Reference another value in the file | {string} Name of the referenced value |
Mixed (depends on the value referenced) |
$resource |
Access the parsed file contents of the resource | {string} Name of the resource |
Mixed (depends on the format of the resource) |
$filter |
Filter tabular data using MongoDB query syntax. | {object} |
{TabularData} |
$merge |
Merge two objects into one. | {object} |
{TabularData} |
$data |
Access values in specified column from data file. | {string} Name of column in data file |
{array} |