ServcieNow - UI Page - Length of an array

Viewed 8

How to get the value of len as 4 and not as 4.0, OR, Is there another way I can find the length of the array using the jelly it-self and use it from there?


    <?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

    <g2:evaluate>
        var transport = ["cars", "trains", "buses", "bikes"];
        var len = transport.length; <!-- len = 4 -->
    </g2:evaluate>
    <p>len = $[len]</p> <!-- len = 4.0 -->
    
    <j2:forEach begin="0" end="$[len]" step ="1">
        <p>Hello</p>
    </j2:forEach>
</j:jelly>

I just get one Hello as output, instead of 4 Hellos

Output

0 Answers
Related