Array value check in jelly script

Ketan Pandey
Tera Expert

In my UI Page,I have called the  Script Include which return the Array object.

 

How to check the Array has value or not in jelly script

2 REPLIES 2

Sohithanjan G
Kilo Sage
Kilo Sage

Hi @Ketan Pandey 

You can use the below 

<j:if test="${myArray != null && myArray.length > 0}">
  <!-- Code to execute if the array has values -->
  <p>Array has values!</p>
</j:if>

<j:if test="${myArray == null || myArray.length == 0}">
  <!-- Code to execute if the array is empty or null -->
  <p>Array is empty!</p>
</j:if>



please mark as accepted & helpful

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)

Ankur Bawiskar
Tera Patron
Tera Patron

@Ketan Pandey 

Please share your script here

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader