spagobi

Two dates difference in SpagoBI Studio javascript code?


I want to know the format to get the number of days between two dates in spagoBI studio? I have StartDate and EndDate and I want to know the Number of days between these dates.


Solution

  • The first question to ask is what type of document are you creating in SpagoBI studio? Is it a BIRT or Jasper Report? It is a chart ? Almost everything coming in from a SpagoBI dataset is treated as a String.

    If you were using JavaScript in a BIRT report, you would need to covert those ENDDATE And STARTDATE row values to equivalent JavaScript date objects before performing calculations .

    What about modifying the dataset query to perform the date difference in SQL and pass that back as a column?