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), find and select the content you want to base your dynamic text on. You must select a grid from a Discovery or a Visual Area from a Tabulation.
- Tabulate allows you to blend queries from multiple data sources into a single grid, enabling the dynamic text to be based on multiple data sources. Note that you must save the grid from Discovery or the Visual Area in the Tabulation in order to use it in an Illustrate item. Once selected, the grid or visual area will appear in the editor.
- 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,
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.
Add a textbox to the slide by clicking the Text icon in the canvas menu. In the textbox, write the required text.
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 to open the Dynamic Text wizard.
In the Content panel, find and select the grid you want to base your dynamic text on. You must select a grid as dynamic text is supported for grids only. Note that you must save the grid from Discovery in order to use it for dynamic text. Once selected, the grid will appear in the editor.
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.
Your dynamic text will be added to the slide.
Pyramid's OpenAI 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 ChatGPT AI-driven 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 results generated by OpenAI's ChatGPT by creating interactions between visualizations and/ or slicers, and the dynamic text where the ChatGPT PQL function is injected.
Warning: AI-generated assets are generated from public domain algorithms, which can produce both erroneous and inconsistent/ random results. Use at your own risk.
In this example, the Chat GPT function is was to generate a product category label for the given cell:
chatgpt("product category for: " + label(1,0,0))
That generated label is then injected into the dynamic text:
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.
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.
Select the required area including both queries.
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.
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.
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.