5 Replies Latest reply: Dec 15, 2010 7:18 AM by jwellsnh RSS

    Disable Days and Months in Date Pciker

    795070
      APEX 4.0
      10g

      Good day, I have a question. How to disable the months and days in the apex date picker? I want the year only because Im creating a school year. So I want only the year in the date picker. How will I do that? thanks
        • 1. Re: Disable Days and Months in Date Pciker
          jwellsnh
          Edit your date picker like so:

          Format Mask YYYY
          Show Other Months N0
          Navigation List for Year

          But why not use a Select List populated with Years?

          Jeff
          • 2. Re: Disable Days and Months in Date Pciker
            795070
            thanks for the reply, How will I do that select list?
            • 3. Re: Disable Days and Months in Date Pciker
              jwellsnh
              Depending on your requirements, there are many options.

              You could certainly build a Static List of Values (LOV).

              Since I work with Finance data a great deal, we have a Calendar table for each day of the year for decades into the future with Fiscal Year, Year, Month, Week, etc...... From that table we can build dynamic LOVs based on our needs

              If you need just the current year then this code
              SELECT Extract(YEAR FROM SYSDATE) d,
                     Extract(YEAR FROM SYSDATE) r
              FROM   dual  
              could be used to define a Dynamic LOV.

              What specifically are your requirements? Do you need prior years, current year, future years.........?

              Jeff
              • 4. Re: Disable Days and Months in Date Pciker
                fac586
                You can create a dynamic LOV for use in a select list that generates values in a number of ways depending on the requirements.

                For example, one way to get a projection of the next 10 years from this year using an integer sequence generator:
                select
                          y l, y v
                from          
                          (select
                                    extract(year from sysdate) + rownum - 1 y
                          from
                                    dual connect by rownum <= 10)
                order by
                          v
                
                L                      V                      
                ---------------------- ---------------------- 
                2010                   2010                   
                2011                   2011                   
                2012                   2012                   
                2013                   2013                   
                2014                   2014                   
                2015                   2015                   
                2016                   2016                   
                2017                   2017                   
                2018                   2018                   
                2019                   2019                   
                Or another, to get an interval of this year ± 5 years using the model clause:
                select
                          y l, y v
                from        
                          (select
                                    y
                          from
                                    dual
                          model
                                    return updated rows
                                    dimension by (
                                      0 n)
                                    measures (
                                      extract(year from sysdate) - 5 y)
                                    rules
                                      iterate (10) (
                                        y[iteration_number] = y[0] + iteration_number))
                order by
                          v
                
                L                      V                      
                ---------------------- ---------------------- 
                2006                   2006                   
                2007                   2007                   
                2008                   2008                   
                2009                   2009                   
                2010                   2010                   
                2011                   2011                   
                2012                   2012                   
                2013                   2013                   
                2014                   2014                   
                2015                   2015
                You could generate some complex result sets using the model clause. A pipelined function would be another option.

                Generating values ex nihilo like this is useful if your system doesn't have existing reference/dimension tables of the type Jeff describes.
                • 5. Re: Disable Days and Months in Date Pciker
                  jwellsnh
                  Paul,

                  Your queries are going into my date toolbox today. Thanks for sharing this.

                  The site referenced by your first link is phenomenal.

                  Jeff

                  Edited by: jwellsnh on Dec 15, 2010 8:18 AM