Skip to main content

Introduction to the Retrieve Data Tag

What Is the Retrieve Data Tag?

The Retrieve Data Tag (formerly known as the "Query Tag") lets you run a query against your data source and store the result in a variable — without displaying anything in your output. That variable can then be referenced by other tags throughout your template using ${VariableName} syntax.

This is especially useful when you need to fetch a piece of data once and reuse it in multiple places, rather than querying the same data source repeatedly.

Why Use a Retrieve Data Tag?

In many templates, the same data is needed in several locations — a customer name in the header, the body, and the footer, or a summary value used in multiple calculations. Without a Retrieve Data Tag, each tag would make its own call to the data source, which can slow down output generation, especially with large SQL databases.

The Retrieve Data Tag solves this by:

  • Running the query once and storing the result in a reusable variable
  • Reducing database calls, saving time and system resources
  • Making data available to all tags that follow it in the template
note

The Retrieve Data Tag stores a single row or node. If the query returns multiple rows or nodes, only the first one is accessible through the variable.

Retrieve Data Tag vs. Set Tag

Both the Retrieve Data Tag and the Set Tag create variables, but they work differently:

Retrieve Data TagSet Tag
ValueThe first row or node from a data source queryA static string, number, or expression
Data sourceRequired — runs a queryNot required — value is defined directly
Use caseStore queried data for reuseStore a constant or calculated value

How Do I Use a Retrieve Data Tag?

  1. Connect to a data source — Your template must be connected to a data source before inserting a Retrieve Data Tag.
  2. Insert a Retrieve Data Tag — Use the Tags button on the Fluent Designer ribbon and select Retrieve Data Tag.
  3. Write a query — Use the Tag Editor to write a select statement that returns the data you want to store. For best results, write a query that returns a single row.
  4. Name the variable — Set the var property (e.g., employeeData). This is the name you'll use to reference the data elsewhere.
  5. Reference the variable — In other tags throughout your template, use ${employeeData} to access the stored row, or ${employeeData.FieldName} to access a specific field within that row.
tip

Place Retrieve Data Tags at the top of your template, before any tags that need to reference their variables. The variable is only available to tags that come after the Retrieve Data Tag in the document.

Example

Suppose you have an employee database and want to display an employee's name, title, and hire date in several places throughout a letter. Instead of querying the database each time, you can:

  1. Place a Retrieve Data Tag at the top of the template that queries SELECT * FROM Employees WHERE EmployeeID = 1 and stores it in a variable called emp.
  2. Anywhere in the template, use ${emp.FirstName}, ${emp.LastName}, ${emp.Title}, or ${emp.HireDate} to display specific fields.

The Retrieve Data Tag itself produces no visible output — it simply makes the data available for other tags to use.

Learn More

For a complete breakdown of all properties and configuration options, see the Retrieve Data Tag Reference.

For a step-by-step walkthrough, see How Do I Use a Retrieve Data Tag?.