Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: How can I delimit that a From-Date parameter not to be smaller than 6 month ago?

  1. #1
    Join Date
    May 2012
    Posts
    13

    Default How can I delimit that a From-Date parameter not to be smaller than 6 month ago?

    I want that my From-Date parameter is not smaller than Today()-180, so if the user input a smaller data, the value must be Today()-180.

    I have defined a hidden parameter FromDatMin = DATEVALUE(TODAY()-180) and I tried to put something like this in the 'Post-Processing Formula' of the FromDat parameter:

    =IF([FromDat]<[FromDatMin];[FromDatMin];[FromDat])

    but it doesn't work, my FromDat parameter results <Null>.

    Certainly the Formula Editor screen shows the message "Formula:Not enough data for computation", so the formula itself seems to be wrong.

    Someone can help? Thanks!

  2. #2

    Default

    in your query, you can do something like this:

    select * from table where dt >= LEAST(FromDat, current_date() - interval 180 day);



    * current_date() - interval 180 day evaluates to 180 days ago
    * FromDat is the date paramater that the person chose from the date picker
    * the MySQL "LEAST" function will use whichever one is older (smaller)

  3. #3
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    Is your FromDatMin parameter declared *before* your FromDat parameter? If not, then you wont see a valid result, as parameters are evaluated in order, and your FromDatMin has not been evaluated in that case.

    Btw: You dont need an extra parameter, you can inline everything into the Post-Processing formula.

    =IF([FromDat]<DATEVALUE(TODAY()-180);DATEVALUE(TODAY()-180);[FromDat])
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  4. #4
    Join Date
    May 2012
    Posts
    13

    Default

    Tthank you again, resolved!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.