Print Counter using XML code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2024 01:47 AM
Hi,
I was trying to print counter of numbers in a table using JSP code in servicenow. However, the counter is not working as excepted, its throwing null values. Please find my script below and correct me.
Thanks in advance!
----------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2024 02:27 AM
@Lokesh5 It looks like the issue is that the counter jsCounter is being incremented using JavaScript within the JSP while loop. However, JavaScript runs client-side, while the JSP <j:while> loop is processed server-side. This mismatch can lead to unexpected behavior, as jsCounter will not increment as expected across server-side iterations.
To handle this correctly, you should maintain the counter using JSP Server side code.
Hope this will help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2024 06:44 AM
Hi @Abhay Kumar1 ,
Thanks for the quick response. I have followed the way which you suggested and its working. However, the counter is returning in decimal values like 1.0, 2.0..... I have tried all the conversion menthods but no luck. Could you please check my below code and suggest the way to eliminate decimals.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2024 06:34 PM