Highlighting a row thru Inline style - how to check if property has a value
We have a section displaying a table. The table has it's columns dynamically sourced thru a report. In our application we also have two properties for a price field - numeric and text.
We are working on a requirement to highlight the rows which have only text price listed and no numeric price.
In similiar community post I found that we can use the below as inline style for the section:
<%=tools.getProperty(".pyID").getStringValue().startsWith("DXC") ? "background-color: red;" : "" %>
to highlight the specific row that has case ID starting with DXC, for example.
What method can I use to see if a property has a value or not? I need the activity to check if .NumericPrice property has a value in pyWorkPage for the specific item.
***Edited by Moderator: Lochan to update platform capability tags***
Hi Fahad, All,
After couple of attempts and the assistance of an LSA we've managed to get this requirements to work. Here are the full details for future reference:
Need: Highlight a row in a table, based on a When condition (for example property is missing a value). The table source is a report definition.
Step 1. Apply the below inline style on the row:
<pega:when name="WhenConditionToBeChecked"> color:red; </pega:when>
where WhenConditionToBeChecked is your When rule. Be sure that the section, when rule and report definition are in the same class.
Step 2. The property from the When condition should be present in the report definition. In my case the property NumericPrice needed to be added into the report definition with the option for the column to be hidden. This way the information was extracted from the report, it is used in the background from the When rule and the column is not displayed in the final view, keeping the UI as per the initial requirements.
Step 3. Justify the use of this inline style (with the full conscience that inline styles are not recommended as per the guardrails).
This thread can be now marked as resolved/completed.
Keep up to date on this post and subscribe to comments