Dynamic Text Editor
Dynamic text is user-built data-driven text that is linked to a data discovery. The text includes dynamic PQL or MDX functions in order to obtain and display the required information. When the publication is rendered, the dynamic text will show the current data-driven values of the given dynamic functions.
Dynamic text is constructed in the Dynamic Text Editor in Present, Publish, or Illustrate.
Navigate the Dynamic Text Editor
With your text box selected, click the Dynamic Text button (purple highlight below) to open the Dynamic Text Builder. Alternatively, open the Dynamic Text drop-down button to build dynamic place holders, or add dynamic text fields.
From the Dynamic Text Editor:
- Open the Content drop-down (orange highlight below) and select the required grid that will be queried.
- Write your dynamic text expression in the script editor (red highlight).
- Use the PQL Functions library (yellow highlight) to add SQL expressions to your script.
- Select the relevant cells from the grid (purple highlight) to populate the given PQL expressions,
PQL Functions
The Pyramid Query Language or PQL (pronounced 'Prequel') is a language built into Pyramid's PYRANA engine to allow users to construct queries that can run against the many SQL data stacks that Pyramid can query natively. PQL includes a vast array of operations and functions that allows users to query data and build analytical logic.
The Dynamic Text Editor exposes Dynamic and Common functions. Dynamic functions are a set of specialized method that are designed to act on a given query 's result set. Common functions are a set of methods that are found in most programmatic and mathematical function libraries. These functions are used to perform logic on basic data without concern for data structures, context, or even source.
To add a PQL function from the library to the script editor, simply double click on it. You will then need to inject values into the function.
You can build dynamic text from within Publish, in order to add dynamic text on an ad-hoc basis.
STEP 1
Add a textbox to the page by clicking the Text icon in the canvas menu. In the textbox, write the required text.
STEP 2
Remove the words that should be dynamic, and place the cursor in the space where the dynamic text should appear. Click the Dynamic Text button from the Component ribbon. In the Content panel, find and select the content you want to base your dynamic text on. Once selected, the grid or visual area will appear in the editor.
STEP 3
Select the relevant cell, and apply any relevant query, math, or date functions and define the format. Test your dynamic text, and then click Apply. If you have multiple dynamic elements in the text, configure each one separately.
STEP 4
Your dynamic text will be added to the page.
Using the Generative AI-Driven PQL Function
Pyramid's Generative AI integration enables you to use AI to generate scripts and images, dynamic text and infographics, calculations and lists, schedules, colors, and more. This allows you to generate a range of content, including complex code, by simply providing a text prompt.
Use the LLM PQL Function (from the Common PQL functions) to generate dynamic text. While this function cannot tell you about your data set, it can add additional information and background to your presentation. You can also use your data to drive the generated results by creating interactions between visualizations and / or slicers, and the dynamic text where the LLM PQL Function is injected.
Warning: AI-generated assets are generated from public domain algorithms, which can produce both erroneous and inconsistent or random results. Use at your own risk.
- Click here to learn about slicers.
In this example, an interaction was added from a Country slicer to both the Map visualization and the dynamic text, driven by the LLM function. The result is that both the visual and the dynamic text are simultaneously filtered by the same slicer, so that the dynamic text returns a result based on the given country.
When the publication is rendered, it returns results for the selected slicer element:
The dynamic text is written against a simple grid containing the same country hierarchy that comprises the slicer.
The expression entered in the script window is as follows:
LLM("what landmarks is " + label(1,0,0) + " famous for.")
From the Interaction Manager, interactions were added from the slicer (yellow highlight below) to both the visual and the dynamic text (red highlight below).
When the publication is rendered and the given slicer is applied, the underlying grid will be filtered to include only a single row (the country selected from the slicer). The dynamic text expression will then return a description of landmarks for the given country.
Using Tabulate for Multiple Source Grids
Users requiring dynamic text from disparate data based on multiple queries can use Tabulate as the source for the dynamic text. Tabulate allows you to blend queries from multiple data sources into a single Tabulation. You must then define a Visual Area that can be used as a single data source for the dynamic text. The Visual Area can then be used as a source for the data grid that the dynamic text is based on.
Step 1
In Tabulate, drag and drop different queries onto the canvas. In this example Sales and Returns is dropped on the left hand side of the Tabulate canvas and the Expenses and Margin query is dropped on the right hand side of the canvas.
Step 2
Select the required area including both queries.
Step 3
Set the Visual Area by clicking on the Set Visual Area button from the Visual Area drop-down on the Tabulate ribbon, name the visual area and save the Tabulate worksheet
Note that you must save the Visual Area in the Tabulation and the Tabulate worksheet in order to use it in an Illustrate item.
Step 4
Build your dynamic text (as per previous example), select the Visual Area as the source for the data grid.
From the Content drop down, select the Country Sales and Expenses Tabulate item, then select the Visual Area - "Sales_And_Expenses". This will be used as the data grid for the dynamic text.
Step 5
You can now use any data from the Visual Area in your dynamic text. In this dynamic text formula (orange box) we have subtracted New South Wales Expenses (green box) from New South Wales sales (red box). The result of $47,051.61 can be seen in the dynamic text (orange box). This demonstrates how data from disparate sources can be used to generate dynamic text.