I am giving code like this
But getting the output as Nan
var totalTicketOpenCountFromWidget = sunriseReportObj.getIncidentDsrTotalTicketOpenCount(sunriseReportTestData.totalOpenTicketsWidgetName);
console.log("totalTicketOpenCountFromWidget :", totalTicketOpenCountFromWidget);
var totalTicketOpenCountFromWidgetIntVal = parseInt(totalTicketOpenCountFromWidget);
If you have the way to ensure totalTicketOpenCountFromWidget would be a number you can do:
totalTicketOpenCountFromWidgetIntVal = parseInt(totalTicketOpenCountFromWidget);
or
totalTicketOpenCountFromWidgetIntVal = parseInt(totalTicketOpenCountFromWidget, 10);
the 10 aims to decimal.
Read more here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
or the easier way:
totalTicketOpenCountFromWidgetIntVal = +totalTicketOpenCountFromWidget;
Also, you can wrap your conversion in a try ... catch block to handle the response if totalTicketOpenCountFromWidget is not a number. Read more here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch