CA Service Management

  • 1.  Get inputControl date value to JasperStudio

    Posted Oct 26, 2018 09:51 AM

    Hi everyone,

    I'm trying to pull the selected date value from filter in Jasper Server but getting the error running report.


    So, If someone had experienced this kind of issue, please help

     

    It works fine with java.lang.String or java.util.Collection Java Class when it a dropdown or multiselect.

     

    Uploading some screenshots, so if someone has an idea, it would be great.

     

    Thanks in andvance,

     

    Domagoj



  • 2.  Re: Get inputControl date value to JasperStudio

    Posted Nov 07, 2018 06:52 AM

    Hi,

     

    so the first thing I've figured is that the parameter class should be: net.sf.jasperreports.types.date.TimestampRange

     

    After that I get a value display like: net.sf.jasperreports.types.date.FixedTimestamp@c77faa

     

     

    How to convert this to TimeStamp format?

    Best Regards,

     

    Domagoj



  • 3.  Re: Get inputControl date value to JasperStudio

    Posted Nov 07, 2018 06:28 PM


  • 4.  Re: Get inputControl date value to JasperStudio

    Posted Nov 08, 2018 02:17 AM

    The link doesn't work, I get an Unauthorized message on the page.



  • 5.  Re: Get inputControl date value to JasperStudio
    Best Answer

    Posted Nov 08, 2018 03:13 AM

    Figured it out,

     

    1. Create new parameter with the same name as inputControl under AdHoc (ex. open_date_1)

    2. Set the class of the parameter net.sf.jasperreports.types.date.TimestampRange

    3. Drag and drop eariler created parameter to report canvas, douple click to open Expression Editor and add at the end .getStart() function (ex. $P(open_date_1).getStart())

    4. Select the field of the parameter, on the right open tam TextField and add needed TimeStamp pattern (ex. dd.MM.yyyy HH:mm)

     

    If you created a between filter (ex. open_date_start and open_date_end), then you'll have two parameters (ex. open_date_1 and open_date_2).

    Do the same thing as described earlier and you will display the selected values from filter like:

     

    Selected start date: $P(open_date_1).getStart()

    Selected end date: $P(open_date_2).getStart()

     

    Hope that it would help somebody,

     

    Best Regards,

     

    Domagoj