Question
Louis Dreyfus Company
BG
Last activity: 17 Jul 2019 10:34 EDT
Highlighting a row thru Inline style - how to check if property has a value
Hi Team,
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.
Kind Regards,
Petar Hr.
***Edited by Moderator: Lochan to update platform capability tags***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Louis Dreyfus Company
BG
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.
Steps:
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.
Cheers!
Kind Regards,
Petar Hr.
Cognizant
GB
Louis Dreyfus Company
BG
Hi Fahan,
Thank for the reply.
Can you please elaborate on what when rule are you referring to?
Also, if inline styles is not recommended, what is the best approach to have a row in a section conditionally highlighted when the property .NumericPrice is missing?
We are using Pega 8.2.2 btw.
Kind Regards,
Petar Hr.
Cognizant
GB
Louis Dreyfus Company
BG
Thanks for the clarifications! It's clear now.
Petar Hr.
Cognizant
GB
Louis Dreyfus Company
BG
Updated: 11 Jul 2019 11:58 EDT
Cognizant
GB
Accepted Solution
Louis Dreyfus Company
BG
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.
Steps:
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.
Cheers!
Kind Regards,
Petar Hr.
-
Mohammed Shahbaz