Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Inline style condition on row value does not work Repeat Layouts

SA-1301

Summary


The Developer has written an in-line When rule for the purposes of changing the in-line style of a cell in a grid, dependent on an underlying property value.

For example: -

 
<pega:choose> <pega:when java='<%= (tools.getStepPage().getString(".MyProperty")=="0")%>'> background-color: red; </pega:when>     <pega:otherwise> background-color: green; </pega:otherwise></pega:choose>

However, when the grid was displayed at run-time all of the cells appeared with the same colour, regardless of the property value.


TECHNIQUE
As portion of the HTML is embedded in between '<%'  and '>%' symbols this indicates that this is server-side code (Java). So a more viable comparision would be to replace the '==' with a call to the method equalsIgnoreCase.

Similarly, you may want to get a better understanding of the values that MyProperty may have.
So, for example, changing the above line with the code below will output the actually property value to the PegaRULES log

 
<% 
ClipboardPage myTempPage = tools.getStepPage(); 
if (myTempPage != null) { 
    oLog.infoForced("Full contents of page: " + myTempPage.getXML()); 
  
    String strIsLimitApprove = myTempPage.getString(".IsLimitApprove"); 
    oLog.infoForced(".IsLimitApprove = [" + strIsLimitApprove + "]"); 
  
    String strIsLimitApprove = myTempPage.getString(“IsLimitApprove"); 
    oLog.infoForced("IsLimitApprove = [" + strIsLimitApprove + "]"); 
  
} else { 
    oLog.infoForced("DEBUG :: step page not found"); 

%> 
<pega:choose> <pega:when java='<%= (tools.getStepPage().getString(".MyProperty")=="0")%>'> background-color: red;     </pega:when>     ​<pega:otherwise> background-color: green; </pega:otherwise></pega:choose>


TIP: To get instant feedback on the contents of the PegaRULES log file you may wish to use the command 'tail -f' to send the most recent contents directly to the stdout.

Syntax: -
prompt$ tail -f PegaRULES.log

Or, for systems running on a Windows OS you may wish to use BareTail

https://pdn.pega.com/designer-studio/thirty-three-favorite-free-or-cheap-developer-aids-and-add-ons


 

Published January 31, 2016 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us