How can you modify the value of a column in a Data Transform to replace no-value with a value that will hide it in the PDF?

Share with Love

In Pega, if you have a PDF report or section with a column that displays the value “no-value” and you want to hide it when it doesn’t have any meaningful data, you can use the following approaches depending on the situation:

1. Using a Data Transform

You can modify the value of the column in a Data Transform or Activity before generating the PDF. If the value is “no-value,” you can set it to null or an empty string, which will make it hidden in the report.

Example in Data Transform:

.yourColumnName = .yourColumnName == "no-value" ? "" : .yourColumnName

This will replace the value "no-value" with an empty string (""). If the value is empty, it will typically be hidden in the PDF.

2. Using Visibility Conditions in the Section

If the column is being rendered in a Dynamic Layout or Table, you can apply visibility conditions based on whether the value of the column is "no-value".

Steps:

  • Open the section containing the PDF.
  • Select the control for the column you want to hide.
  • In the Visibility section, set a condition:
    • For example, use a property condition like yourColumn != "no-value".

This will hide the column if the value is "no-value".

3. CSS to Hide “no-value”

If you cannot directly modify the data or use visibility conditions, you can use CSS to hide the text no-value when it appears in the PDF.

Steps:

  • Use an HTML or text element to apply the CSS:
    <style>
    .no-value {
    display: none;
    }
    </style>
  • Ensure that the column element has the no-value class when the value is "no-value".
  • This way, the "no-value" text will not be visible in the rendered PDF.

4. Report Definition Customization (if PDF is from a report)

If the column is part of a Report Definition, you can customize the report by adding a condition to exclude rows where the value is "no-value". This is often done at the report level before rendering it.

  • Open the Report Definition.
  • Add a filter condition for the column: yourColumnName != "no-value".
  • This will exclude any rows where the value is "no-value" from being included in the report, effectively hiding the column for those rows.

5. PDF Specific Settings

If you are using a PDF Generation rule in Pega, you can control the display of columns based on whether the value exists or not by customizing the template or adding logic to skip the rendering of the column when it’s empty or contains "no-value".

Conclusion:

The best approach depends on how the “no-value” is being generated and whether you’re working in a section, report, or PDF generation rule. In most cases, using a visibility condition or a data transform is the easiest and most efficient solution to make it hideable. Let me know if you need more details on any of these approaches!