Hitachi Vantara Pentaho Community Forums
Results 1 to 9 of 9

Thread: How to provide dynamic start date for Date Input Component

  1. #1

    Default How to provide dynamic start date for Date Input Component

    Hi,

    I am using 'Date Input Component' in my dashboard. In this, we have one property as 'Start Date' where we can specify start date in calendar, so that earlier dates before start date will be disabled. I can provide hard coded value. But I want to set 'Start Date' as first date of current year.

    Please help, how to provide dynamic start date value in 'Date input component'.

    Thanks.

  2. #2
    Join Date
    Feb 2013
    Posts
    530

    Default

    Hi,

    This post may give you the idea on custom date input parameter default values. Get current date using java script/jquery and place it in place of parameter in the code that you will see in post.

    Link : http://pentaho-bi-suite.blogspot.in/...t-in-date.html

    Not tested - hope it helps you.

    Cheers.!
    - Sadakar Pochampalli

  3. #3

    Default

    Hi Sadakar,

    I have already referred that link, but unable to provide dynamic start date. I don't want to change parameter value, instead I want to set start date of date input component.
    Thanks.

  4. #4
    Join Date
    Feb 2013
    Posts
    530

    Default

    You can try similar to this stack overflow thread for your parameter default value.

    http://stackoverflow.com/questions/1...-in-javascript

    Thanks
    - Sadakar Pochampalli

  5. #5

    Default

    In "Pre Execution" set start date like this.

    function f(){
    render_[Date Input Component Name].startDate = new Date().getFullYear() + "-01-01";
    }
    Hope this helps.

  6. #6

    Lightbulb Use Pre Execution

    You can use the following function in Pre Execution

    Code:
    function f(){
        render_[Name of the Date Component].startDate = new Date().getFullYear() + "-01-01";
    }

  7. #7

    Default

    Hi,

    In this thread, how to form year first date is given. What I want is, dynamically provide range for calendar. Like if I provide '01-01-2015' as start date property value, then user won't be able to select previous date like '30-Dec-2014' in calendar. I know how to provide hard coded value, but don't know how to provide dynamic value.

    Thanks.

  8. #8

    Default

    Hello Friends,

    One of our friend helped me with this issue. Solution is, use below code in 'pre execution' of date input component.

    function f(){
    render_Date_Input_Control_Name.startDate = new Date().getFullYear() + "-01-01";
    }

  9. #9
    Join Date
    Feb 2017
    Posts
    4

    Default

    Hello, same code not working for me. Its just setting start date of date range input component to specified date in pre execution function.But what i want is user won't be able to select earlier dates for start date and later dates for end date.

    function f(){
    render_[Date Input Component Name].startDate = new Date().getFullYear() + "-01-01";
    }

    Anyone knows how to do that?

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.