Important Nexla Help Center Update:
Nexla's Zendesk Help Center pages are being deprecated and will soon no longer be available.
Nexla Documentation is now the home for Nexla's User Guides, with improved formatting and categories that are easier to navigate, providing a better overall user experience.
Please update any bookmarks to the new Nexla Documentation site (docs.nexla.com/user-guides).
_______________________________________________
This article provides instructions for using macros to input variables into text fields, URLs, API calls, and other fields in Nexla.
Contents:
1. Macros Available in Nexla
2. Using Macros in API Calls
2.1 Customize an API Call with Macros
2.2 Macros in Chained API Calls
2.3 Lookup Values as Macros in API Calls
3. Using Metadata Macros
3.1 How to Add Metadata to a Nexset
3.2 Metadata Macros in API Calls
4. Using Macros in Formatting for Destinations
1. Macros Available in Nexla
In Nexla, macros allow users to include variables related to Nexsets and data flows in text fields, URLs, API calls, and other applications.
Several categories of macros are available for use in the applications described in the following sections. These categories include the following:
- System macros - These macros correspond to Nexla's pre-built functions, such as date/time macros.
- Date/time macros can be used to specify relative times, such as now, yesterday, tomorrow, etc. Users can select the date format used in system macros from the associated Date Format for Date/Time Macros pulldown menu.
- Mathematical operations can be used to specify any relative time, and users can select the time unit used in these mathematical operations from the Time Unit for Operations menu.
For example, "{now-5}" would indicate 5 days ago when "Day" is selected.
- Date/time macros can be used to specify relative times, such as now, yesterday, tomorrow, etc. Users can select the date format used in system macros from the associated Date Format for Date/Time Macros pulldown menu.
- Metadata macros - These macros correspond to information about the data contained in a Nexset. They can be used in API calls, output filenames, custom headers for output files, and other applications.
To use metadata macros, the corresponding metadata attributes must be included in the selected Nexset. For information about adding metadata macros to Nexsets, see Section 3.1 below.
- Loookup column value macros - These macros are variables representing the values of key columns in Nexla static or dynamic lookups.
- API response macros - These macros correspond to response values from an API source and are used in chained API calls.
2. Using Macros in API Calls
When setting up an API source or destination, macros can be used to customize the data requested in the API call. Macros can also be used to incorporate data returned from one API into the request sent to another API when chaining API calls. The following subsections describe how to use macros in each of these applications, as well as how to use lookup values as macros in API calls.
2.1 Customize an API Call with Macros
After completing the initial steps of setting up the API source or destination, any number of macros can be incorporated into the API call in the configuration step—.
For information about the initial steps of setting up an API source or destination, see the corresponding article in the Help Center section Create a Data Source.
- Click
to expand the URL Macros panel and access associated controls.
- In the Set API URL field, type a left curly bracket, "{", at the position where the macro should be added to access a dropdown menu containing all available macros that can be applied.
- To add a macro listed in the dropdown menu to the Set API URL field, click on the macro in the list, and it will be added at the current position.
- Optional: To specify the date-time format to which Nexla should convert date-time macro values, select the desired format from the Date Format for Date/Time Macro pulldown menu.
- Optional: To specify the date or time unit that Nexla should use to perform mathematical operations on date-time macro values, select the desired unit from the Time Unit for Operations pulldown menu.
2.2 Macros in Chained API Calls
When chaining API calls in Nexla, call responses can be used in subsequent API calls in the chain by adding the responses as macros in the Set API URL field.
- After setting up the preceding API call, click
at the bottom of the screen to configure the next API call.
- In the Set API URL field in the newly added step, type a left curly bracket, "{", at the position where the response macro should be added. Responses from previous API calls will now appear in the dropdown menu of available macros.
- To add a response macro listed in the dropdown menu to the Set API URL field, click on the macro in the list, and it will be added at the current position.
2.3 Lookup Values as Macros in API Calls
Column values in any Nexla static or dynamic data lookup accessible to the user can also be added as macros in API calls.
For information about creating and using data lookups in Nexla, see the Help Center articles Create a Static Lookup, Create a Dynamic Lookup, and Transforming with Data Lookups.
- In the URL Macros panel, select the lookup containing the value(s) to be used in the API call from the Add Lookups to Supported Macros pulldown menu.
- When a lookup is selected from this menu, it will be listed in the Add Lookups to Supported Macros field.
- To remove a lookup from the Add Lookups to Supported Macros list, also removing its column values from the available macros dropdown menu, click
on the lookup in the list.
- When a lookup is selected from this menu, it will be listed in the Add Lookups to Supported Macros field.
- Once the lookup is selected, type a left curly bracket, "{", at the position where the lookup column value macro should be added. All key columns in the selected lookup will now be displayed in the dropdown menu of available macros.
- To add a lookup column value macro listed in the dropdown menu to the Set API URL field, click on the macro in the list, and it will be added at the current position.
3. Using Metadata Macros
Any metadata captured in Nexsets can also be used in macros. This section provides instructions for capturing metadata in a Nexset as well as using that metadata in macros within Nexla.
Metadata can be added to automatically detected and/or transformed Nexsets.
For information about adding a data source in Nexla, see the articles in the Help Center section Create a Data Source. For information about transforming Nexsets, see Nexset Designer Overview and other articles in the Help Center section Transformations.
3.1 How to Add Metadata to a Nexset
-
- To create a new Nexset that contains metadata information from a detected Nexset, click the Transform icon
on the Nexset to which metadata should be added. This will open the Nexset in the Nexset Designer.
- To add metadata information to an existing transformed Nexset, find the Nexset in My Data Flows, and click
to open the Nexset menu.
- If the Nexset is active, click
to pause the Nexset. Then, click
on the Nexset again.
- Click
to open the Nexset for editing in the Nexset Designer.
- If the Nexset is active, click
- To create a new Nexset that contains metadata information from a detected Nexset, click the Transform icon
- Click the
button in the Nexset Rules panel in the middle of the screen, and select
from the menu that appears.
- In the Function pulldown menu, select "Equal to Attribute".
- Under "Equal to", select "Metadata" from the pulldown menu.
- The Apply on Attribute pulldown menu lists all metadata attributes available for the selected Nexset. Select the metadata type that should be added to the output Nexset from this menu.
- Enter a name for the output metadata attribute in the Output Attribute Text field.
- Click
in the top right corner of the Nexset Rules panel to generate a preview of the output metadata attribute values in the Nexset Output panel on the right.
- Optional: To include additional metadata attributes in the output Nexset, click
at the bottom of the rule group, and repeat Steps 3-7 in this section.
- Optional: When including metadata to a new output Nexset, ensure that all other needed attributes are also included in the output Nexset. This can be done within the same Transform rule group or by adding one or more new groups for easier viewing.
For more information about adding output attributes to Nexsets, see the Nexset Designer Overview article in the Help Center.
3.2 Metadata Macros in API Calls
- To incorporate a metadata macro when sending a Nexset that contains metadata attributes to an API destination, type a left curly bracket, "{", at the position where the macro should be added in the URL field. This will open a dropdown menu containing all available macros that can be added.
Available metadata macros from the Nexset will be listed under the "Data Attributes" category.
- To add a metadata macro listed in the dropdown menu to the URL field, click on the macro in the list, and it will be added at the current position.
4. Using Macros in Formatting for Destinations
In Nexla, some data destinations include options such as designating a custom filename prefix and adding custom headers to output files in step in the Send Nexset to Destination screen. System and/or metadata macros can also be included in these fields.
Below, instructions are provided for using macros in custom filename prefixes, but the same process can be followed to add macros to other fields in data destination configuration.
- To include one or more macros in a custom filename prefix, check the box next to
in step
in the Send Nexset to Destination screen.
- In the text field that appears below Set Custom File Name Prefix, type a left curly bracket, "{", at the position where the system or metadata macro should be added. This will open a dropdown menu containing all available macros that can be applied.
The dropdown menu will contain all system and metadata macros available for the selected Nexset. Macros corresponding to any metadata attributes contained in the Nexset will be shown under "Data Attributes".
To learn how to add metadata to a Nexset, making it available for use in this and other applications, see Section 3.1. - To add a system or metadata macro listed in the dropdown menu to the custom filename prefix, click on the macro in the list, and it will be added at the current position.
Comments
0 comments
Please sign in to leave a comment.