Dynamic Placeholders in Publish Lite

Placeholders can be added to your text fields and replaced with values from your slicers when you build your publication. This is useful if you want the text to tell your reader something about the slicer selection.

For example, if your publication uses a slicer to filter a Sales pie chart by country, you might want to name that country in the page heading or in a paragraph of text describing the visual. Since the country filter applies when building your publication, it is not appropriate to write a country name in static text, you should instead add a placeholder and replace that with the slicer value that also filters the visual.

Adding a placeholder

This end-to-end example describes how to incorporate a placeholder into one of the text fields on your page and then replace that placeholder with the value selected from a country slicer at build time.

Before you begin

To follow these steps in full, you need to have a publication. We also recommend that you add a visual to your publication as this allows you to create your functioning placeholder and see how the slicer both updates the text placeholder and filters the visual.

  • Click here for instructions describing how to build a new publication
  • Click here for instructions describing how to create a simple, one off, visual

Step 1: Create a placeholder

Add a basic text box to your canvas and then add one or more placeholders that will be replaced with slicer values when building the publication.

  1. From the Toolbox, click Text (orange arrow above) and then click the canvas.
  2. A text box is created on the canvas at your selected location.

  3. Add static text to the text box and format it as required (blue arrow).
  4. Note: In the preceding example, the style Heading 1 has been applied to the page name using the style options on the ribbon.

  5. Place your cursor where you would like to create your placeholder and click Placeholder on the ribbon (green arrow).
  6. The placeholder variable is created and added to the text field at the selected location (purple highlight).

If you were to build your publication now, your placeholder would not be visible on the page. This is because there is nothing to replace the placeholder with at this stage.

Step 2: Create a slicer to placeholder interaction

Connect the placeholder to the slicer that will provide the replacement value when you build your publication:

  1. Add or view your slicer:
    • If you need to create a new slicer, click New Slicer (black arrow above) in the toolbox and select the relevant hierarchy for your slicer (for example, click Countries in the current model). For more information about creating slicers, see Creating Slicers in Publish Lite.
    • If there is already a relevant slicer associated with this publication, click Interaction Manager (yellow arrow) in the ribbon.
  2. In both cases, the Interaction Manager opens at the bottom of the page. The Placeholder and slicer are both present in the view.

  3. Create the interaction between the Country slicer and PlaceHolder2 by selecting the checkbox between the two items (purple highlight).
  4. This interaction will cause the placeholder to be replaced with the selected value from the Country slicer when you build the publication.

  5. Optionally, create an interaction between the same slicer and the visual on the same page (green arrow).

An interaction is added between the Country slicer and both PlaceHolder2 and the Sales discovery called New Discovery 1. When you build the publication, the placeholder text will be replaced with the Country selected from the slicer and the discovery will be filtered to show sales data from that selected country too.

Step 3: Test your placeholder

To test that your placeholder is replaced as expected, you should build your publication with a particular value selected and check that the replacement is applied.

From the ribbon:

  1. Click Run Publication (purple highlight) or press your F2 key to open the Print & Export dialog and manually print your publication.
  2. Set up your Print properties:
    1. On the Output tab, select PDF.
    2. You do not need to change any of the other settings, the intention is just to run a test that shows the placeholder replacement in action.

    3. Click the Slicer tab, and select the option from your slicer that you'd like to apply to the publication:
  3. Click Export.
  4. Your PDF builds and downloads.

  5. Open the PDF and check its content:
  6. In the preceding example:

    • The placeholder is replaced by the selected slice in the page (purple arrow above).
    • Since the Heading 1 style was applied to the whole of the string, including the placeholder, it also appears in the document outline (blue arrow) and would also be included in any Table of Contents in the publication.
    • Since breadcrumbs are shown in the visual and the slicer is used to filter the visual, the selected filter is also shown in the breadcrumbs (green arrow). The placeholder does not affect this value.

Editing your placeholder

To change the replacement value for the placeholder, update the interaction in the Interaction Manager. Important: You can only create interactions from one slicer to one placeholder. If you want to change which slicer is connected to your placeholder, you must first remove the existing interaction:

To change the appearance of the placeholder in the publication, change the style or font formatting applied to it on the canvas. The placeholder behaves as any standard text would.

Delete your placeholder

To delete a placeholder from your publication, simply select and delete the "variable" (PlaceHolderX) from the canvas.