Skip to main content Skip to complementary content

Managing PixelPerfect conditional output using formatting rules

You can use formatting rules to conditionally change the format of objects in a PixelPerfect report. For example, you can create a report that shows a chart only for each country where the sales are more than a selected threshold. You can also highlight cells in a table that match specific conditions.

When using formatting rules, you set criteria by using a formula, and then create a related format. The format that you specified is applied when the formula is true. A rule can be associated with many different objects on the same report, and you can also associate many rules to the same report object.

We recommend using the built-in formula editor to avoid errors when creating the criteria formulas.

Create a new filter

First create a new filter before creating the report. Filters must be created before they can be applied to a report.

Do the following:

  1. Click Filters under the Apps menu.
  2. Click Create filter to create a new filter.
  3. Enter a name for the filter.
  4. Select an app from the App drop-down list. For example, select Sales Demo.
  5. Click Create to create the filter.
  6. Click Fields.
  7. Click Add field.
  8. Select the Connection to the QlikView document that contains the object you want. For example, select Sales Demo.
  9. Select Salesman from the Name drop-down list.
  10. Select Value is from the drop-down list in the Values pane.
  11. Select an existing user in the right box.

    To learn how to create users, see: Creating users with filters and groups.

  12. Click Create to confirm.

Create new PixelPerfect report

Do the following:

  1. Select Reports in the Qlik NPrinting main menu, and then click Create report.
  2. Enter a Title for the report, for example: PixelPerfect Report Conditional Table Display.
  3. Select PixelPerfect from the Type drop-down list.
  4. Select an app from the App drop-down list. For example, select Sales Demo.
  5. Click Create to create the report.

Apply the filter

Do the following:

  1. In the report window, click Filters.
  2. Move the filter you created earlier from Available Items to Selected Items.
  3. Click Add Filters.
  4. Click Overview to return to report overview window.

Create a new PixelPerfect report template

Do the following:

  1. Click Edit template to open the Template Editor.
  2. Right-click the Levels node, and then select Add levels.

Insert a QlikView table as a level

Do the following:

  1. Select the Connection to the QlikView document that contains the object you want. For example, select Sales Demo.
  2. Select Sales by Country - CH304 from the objects list.
  3. Click OK.

Change the visible property in the details band

Do the following:

  1. Create a new table, as you would normally in a PixelPerfect report, based on CH304.
  2. Select DetailReport - "CH304_Level".
  3. Change the Visible property from Yes to No.

The detail band will not normally be visible. The formatting rule will make the band visible only for countries with sales over the selected threshold.

Create new rule and apply it to the table

This form shows all the available rules in a report.

Do the following:

  1. Click the smart tag arrow > of the Detail1 band.
  2. Click the three dots on the right of Formatting Rules.

    The Formatting Rules Editor window appears.

  3. Click Edit Rule Sheet to open the Formatting Rule Sheet Editor.
  4. Click the + button to add a new rule.
  5. Select CH304_Level from the Data Member drop-down list.
  6. Click the Condition form, and then open the Conditional Editor by clicking on the dots that appear on the right.

    In the bottom left column, you can see the list of categories of objects that you can use to create the condition

  7. Click on Fields to see the list of fields available in the Data Member.
  8. Double-click Sales to add it to the condition.
  9. Click on the > symbol to add it.
  10. Type 30000, so the final formula will be [Sales] > 30000.

    Only charts related to countries with sales over 30000 will be displayed.

  11. You can also insert [Sales] > 30000 by typing it in the Condition property.

  12. Set the Visible property to Yes from the drop-down list.

    The objects with the condition applied will be made visible when the condition is true.

  13. Click OK to confirm the condition.
  14. Enter ShowSalesOverThreshold as the Name.

    Use a meaningful name for when you need to maintain the report template. Spaces are not allowed.

  15. Click Close.

Apply the formatting rule to the report object

Do the following:

  1. Click on ShowSalesOverThreshold in the Rules available in a report column to select it.
  2. Move the rule to the Rules applied to a control column by clicking on the > arrow.

    Only formatting rules added to this column will be applied to the control.

  3. Click OK.

Add the chart as an image

Do the following:

  1. Add the Sales by Categories - CH212 to the Images node.
  2. Increase the height of the Detail1 band by selecting the bottom border line and dragging it down.
  3. Drag and drop the CH212 into the Detail1 band, and then enlarge its dimensions by selecting and dragging the bottom right corner.
  4. Click the smart tag arrow > to open the Picture Box Tasks.
  5. Select Squeeze from the Sizing drop-down list to fill the available space with the chart image.
  6. Close the Picture Box Tasks window by clicking on the template area.

Preview and save

Do the following:

  1. Click Preview.
  2. Check the report, close it, and then edit the template again if necessary.
  3. Click Save and Close to save the template and close the Template Editor.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!