Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

can any one help how to use less than operator in jelly script.

ranjithkumark19
Tera Expert

Can any one help how to use less(<) operator in jelly script.

My problem is

<j:if test="${prob.percent_complete >=50}">

    <svg height="100" width="100">

<circle cx="50" cy="50" r="5" stroke="black" stroke-width="1" fill="yellow"/>

</svg>

</j:if>

 

it is working fine. While implementing (less than)

<j:if test="${prob.percent_complete <50}">

    <svg height="100" width="100">

<circle cx="50" cy="50" r="5" stroke="black" stroke-width="1" fill="yellow"/>

</svg>

</j:if>

 

it is not working.

6 REPLIES 6

Community Alums
Not applicable

Here is the wiki document for Escape codes for special characters using Jelly.



How to Escape in Jelly - ServiceNow Wiki


ahaz86
Mega Guru

you can write &lt; for < or &lt;= for <=


That may not be displaying as intended. Replace a less than sign with the dollar sign, left bracket, "AMP", right bracket, "lt;".


Maybe this will show up right:



$[AMP]lt;


ssb
Tera Guru

As per other comments.


The other way to approach this is to create a Script Include with those comparisons as functions, then your Jelly code becomes something like:


<g:evaluate>


var myOb = new ObScript();


</g:evaluate>


<j:if test="${myOb.halfDone(prob.percent_complete)}">


...