A atiaust Active Member Licensed User Longtime User Oct 23, 2016 #1 Hi All, I posted this question with the library but I think that may have been the wrong place so reposted here. I have this library working with Next Reports Designer and Engine v9.1. Does anyone know how to pass a 'date' variable to to the engine. Strings & numbers are fine but I get an error with dates. I have a report with 'start_date' and 'end_date'. The report works in the designer. "ro.nextreports.engine.ReportRunnerException: ro.nextreports.engine.ReportRunnerException: java.lang.ClassCastException: javafx.scene.control.DatePicker cannot be cast to java.util.Date" Thanks
Hi All, I posted this question with the library but I think that may have been the wrong place so reposted here. I have this library working with Next Reports Designer and Engine v9.1. Does anyone know how to pass a 'date' variable to to the engine. Strings & numbers are fine but I get an error with dates. I have a report with 'start_date' and 'end_date'. The report works in the designer. "ro.nextreports.engine.ReportRunnerException: ro.nextreports.engine.ReportRunnerException: java.lang.ClassCastException: javafx.scene.control.DatePicker cannot be cast to java.util.Date" Thanks
Erel B4X founder Staff member Licensed User Longtime User Oct 23, 2016 #2 It is a mistake in the library. You can use this code to create a Java date object: Code: Sub TicksToDate (ticks As Long) As Object Dim jo As JavaObject jo.InitializeNewInstance("java.util.Date", Array(ticks)) Return jo End Sub Upvote 0
It is a mistake in the library. You can use this code to create a Java date object: Code: Sub TicksToDate (ticks As Long) As Object Dim jo As JavaObject jo.InitializeNewInstance("java.util.Date", Array(ticks)) Return jo End Sub
A atiaust Active Member Licensed User Longtime User Oct 23, 2016 #3 Thanks Erel, I now get this error. java.lang.NumberFormatException: For input string: "(DatePicker) DatePicker@59afc4[styleClass=combo-box-base date-picker]" Any clues? Thanks Upvote 0
Thanks Erel, I now get this error. java.lang.NumberFormatException: For input string: "(DatePicker) DatePicker@59afc4[styleClass=combo-box-base date-picker]" Any clues? Thanks
A atiaust Active Member Licensed User Longtime User Oct 23, 2016 #4 Hi Erel, I think I have figured it out. I will update this post once I get it tested. Thanks Upvote 0
A atiaust Active Member Licensed User Longtime User Oct 23, 2016 #5 Erel, The problem was a code error on my behalf. I wasn't getting the ticks value from the Datepicker. Should have been: Code: Dim t As Long ' t = dpDateFrom.DateTicks inputlist.add("start_date") inputlist.add(TicksToDate(t)) ' t = dpDateTo.DateTicks inputlist.add("end_date") inputlist.add(TicksToDate(t)) This now allows me to select a Next Reports report by date range and I am very impressed how it works. Thanks Upvote 0
Erel, The problem was a code error on my behalf. I wasn't getting the ticks value from the Datepicker. Should have been: Code: Dim t As Long ' t = dpDateFrom.DateTicks inputlist.add("start_date") inputlist.add(TicksToDate(t)) ' t = dpDateTo.DateTicks inputlist.add("end_date") inputlist.add(TicksToDate(t)) This now allows me to select a Next Reports report by date range and I am very impressed how it works. Thanks