How to limit date fields between 2 values

Hi I have two date fields and I can use min and max to limit them between two values. But what I wanna do is make it so that the user can only insert values before June 30th each year. So if a value is over that it gives an error. Right now I can do it but would have to change the year each year because I specify it as
Min june 30th 2011
Max june 30th 2012
I want this but so I don't have to change it to 2013 in a year.
Thanks and best regards

The validator should only allow dates in the range between June 30th this year and July 1st of next year. But with next year defined as current year + 1 year, not as a straight number which would have to be changed every year.
Does this make sense?
Here is a little background I have a vacations table and in it fields user, start, end, and ID. Now Start and End are the date fields. I have this query which gives a number of vacation days a user has spent excluding saturday and sunday. Now the problem in this query is that when the user inserts his vacation dates he can insert them for 10 years from now which messes with the query. So I was thinking if there was a way to limit the user to only be able to insert dates for the given business year which in my company (for some reason) goes from July 1st. That is the cut off date.
In other words in my company you have to use your vacation days by july 1st. Then you get the vacation days for next year which you can again use, until July 1st of next year. If you haven't used last year's vacation days by then you lose them. I just want to somehow incorporate this into the application.
Here is the sql query (and props to user Pollywog)
WITH t AS (  SELECT id,
                    MAX (strt) strt,
                    MAX (finish) finish,
                    SUM (dys) days_off
               FROM (SELECT id,
                            strt,
                            finish,
                            CASE
                               WHEN TO_CHAR (dy, 'day') LIKE 'saturday%' THEN 0
                               WHEN TO_CHAR (dy, 'day') LIKE 'sunday%' THEN 0
                               ELSE 1
                            END
                               dys
                       FROM vacations
                     MODEL
                        PARTITION BY (ID id)
                        DIMENSION BY (0 d)
                        MEASURES (POCETAK strt, KRAJ finish, POCETAK dy)
                        RULES
                           (dy [FOR d FROM 1 TO finish[0] - strt[0] INCREMENT 1] =
                                 (NVL (dy[CV () - 1], dy[CV ()]) + 1)))
           GROUP BY id
           ORDER BY id)
SELECT t.id,
       t.strt,
       t.finish,
       t.days_off,
       vacations.korisnik,
       SUM (
          CASE
             WHEN finish < TO_DATE ('01/07/2011', 'dd/mm/yyyy') THEN days_off
             ELSE 0
          END)
       OVER (PARTITION BY vacations.korisnik ORDER BY t.id)
          this_years_running_total,
       SUM (
          CASE
             WHEN finish < TO_DATE ('01/07/2011', 'dd/mm/yyyy') THEN days_off
             ELSE 0
          END)
       OVER (PARTITION BY vacations.korisnik)
          this_years_grand_total,
       SUM (
          CASE
             WHEN finish >= TO_DATE ('01/07/2011', 'dd/mm/yyyy')
             THEN
                days_off
             ELSE
                0
          END)
       OVER (PARTITION BY vacations.korisnik ORDER BY t.id)
          next_years_running_total,
       SUM (
          CASE
             WHEN finish >= TO_DATE ('01/07/2011', 'dd/mm/yyyy')
             THEN
                days_off
             ELSE
                0
          END)
       OVER (PARTITION BY vacations.korisnik)
          next_years_grand_total
  FROM t, vacations
WHERE t.id = vacations.idEdited by: Dino2dy on Jun 6, 2011 5:44 AM

Similar Messages

  • How to manipulate Date Fields of MSSQL server

    I build a database link from my oracle Database to an sql Server , i can run any select statement that i want with no problem but when i try to run the above :
    select empl."emp_id", "emp_code", "emp_first", "emp_last" ,
    "empio_dtin", "empio_dtout", "section_id",
    to_date ( "empio_dtin" , 'dd/mm/yyyy hh24:mi:ss')
    from "dbo.employees"@ATERMON empl INNER join "dbo.empio"@atermon empio on empl."emp_id" = empio."emp_id"
    where "empio_dtin" > '05/01/09'
    order by "section_id", "emp_code"
    i took the message :
    ORA-02070: database ATERMON does not support TO_DATE in this context
    The problem is the time because when i run the select statement the date fields brings as value only the dates values for example "01/05/09" without the time value that i need most,
    i try to insert the values into an oracle table with Date format fields but i take only the dates values again.

    Is the empio_dtin field defined with a date datatype or a character datatype?? If the field is a date, try using TO_CHAR instead of TO_DATE:
    to_char ("empio_dtin" , 'dd/mm/yyyy hh24:mi:ss')
    Assuming that empio_dtin is defined as a date datatype, you might want to try directly converting the string '05/01/09' to a date rather than letting Oracle impliciting covert the string to a date.
    "empio_dtin" > to_date('05/01/2009', 'MM/DD/YYYY')
    Edited by: user1983440 on Jun 24, 2009 9:58 AM
    Edited by: user1983440 on Jun 24, 2009 9:59 AM
    Edited by: user1983440 on Jun 24, 2009 10:00 AM
    Edited by: user1983440 on Jun 24, 2009 11:30 AM

  • How to insert row where DB date field has default value.

    APEX 4.1, Oracle 11.2
    I'm trying to insert a row using "javascript:addRow();" where the report query is an SQL Query (Updateable Report).
    1)  Several of the fields are display-only with defaulted values.
    2)  No problem with the VARCHAR2 fields.
    3)  And if RUN_DT is a text field, the insert works.
    4)  But I get errors when trying to make RUN_DT (DD-MON-YYYY) display-only and default it to P63_RUN_DT.  I display P63_RUN_DT so I see it is correct.
    Now, this is not a new question.  See:
    Error inserting sysdate with time in tabular form region  https://forums.oracle.com/thread/2551916  (Not answered)
    Date value in tabular form  https://forums.oracle.com/thread/2478358 (Not answered)
    Help! Unable to set default date value for Tabular form DB date field! https://forums.oracle.com/thread/2473208  (Not answered)
    Default Value Date Picker Field https://forums.oracle.com/thread/2468973  (Not answered)
    Tabular Form Default Value PL/SQL https://forums.oracle.com/thread/2464192  (Not answered)
    Display 1st region invoice date into tabular form invoice date column. https://forums.oracle.com/thread/2458561  (Not answered)
    Default System date and time in Tabular form https://forums.oracle.com/thread/2449615 (Not answered)
    Setting default value of Tabular form item is not working https://forums.oracle.com/thread/2396024 (Not answer)
    apex tabular form https://forums.oracle.com/thread/2337098 (Not answered)
    Various folks recommended using Default PL/SQL and SYSDATE when SYSDATE was the desired default value.  That worked for some and not for others.  I could not get it to work for me.  The errors I receive are "•Column must have a value. (Row 1) " and "ORA-01410: invalid ROWID".   I believe the ROWID error is an example of spurious error cascade caused by the RUN_DT problem.   I believe it will disappear once the RUN_DT problem is solved.
    I will try to replicate on apex.oracle.com
    Thoughts?
    Howard

    Update: At least in my case, it seems the RUN_DT date column cannot be Standard Report Column.  I made it "Display as Text (saves state)".  Standard Report Column works for the defaulted VARCHAR2 columns.  Go figure! 
    (more)  And I could not get it to work with "Item" (P63_RUN_DT) as the Default.   However, it seems to work -- so far -- using Default PL/SQL of TO_DATE(:P63_RUN_DT,'DD-MON-YYYY').

  • How to reset Date field

    Hi
    I want to reset the Date field of the form.
    I hava a search cirtaria in that i have the folling fields
    1. Indent No
    2. Start Date      and   End Date:
    when i select Indent No:  the Start and End Date should be null;
    When i select Start Date and End Date the Indent No Should be null.
    When i first select Start Date and End Date select search the data displaying between dates
    one again i select Indent No the Start date and End date will be like that only
    now i want to set Start data and end  Date with null or Empty values.
    and let me know what is the default value of the Date
    regards
    mmukesh

    Hi Mukesh ,
    To set date to null..
    Date d = null;
    wdcontext.<Element>.set<dateAttribute>(d);
    Regards,
    Sunitha

  • Portal Forms - How to make a Field with DEFAULT value NON-EDITABLE by Users

    I HAVE A FORM WITH A DATE FIELD ON IT WITH DEFAULT VALUE.
    THIS IS A TABLE-FIELD.
    I WANT THE FIELD TO BE DISPLAYED ON THE FORM BUT NOT TO ALLOW
    USERS TO EDIT/CHANGE IT.
    HOW CAN I DO THIS?
    TKS IN ADVANCE

    Hi,
    see Re: sequencing problem-Forms
    Regards Michael

  • How to display data depend upon ListBox value?

    Hi Experts and Particularly Hema,
    As I asked before how to display data in the ListBox, I got an very good response from you all(particularly Hema) .
    Now what my doubt is asked with sample scenario below:
    In Screen Painter -
    Two fields namely : One List Box and other is I/O used only for displaying purpose i.e., only for output, not for input purpose.
    List Box is filled by primary key field(C1) value from one table(T1) when the screen load.(i.e., such code is written in PBO).
    Now what I need is :
    If the user select any one value in the List Box then it automatically display the corresponding C2 value from T1 in the I/O field.
    I think you may all understand what I am trying to ask.Please let me know the solution.
    Thanks in advance,
    Regards,
    Raghu

    Simply attached a function code for the listbox... when the user changes the value, you will be able to pick this up in the PAI and loop back to the PBO and redisplay the corresponding output field.
    Jonathan

  • Concatenate 2 data fields and put values in single line

    Hello,
    I am pretty new to BI Publisher. I want to concatenate 2 data fields (Product and ProductType). These concatenated values then I want to put them on a single line.
    eg.
    the values should look like
    ProductType1.Product1,ProductType2.Product2, ProductType3.Product3..........
    Thanks.

    The XML is
    - <ServiceAgreement>
    <AccountId>1-abcde</AccountId>
    <AgreementNumber>1-685</AgreementNumber>
    <AgreementStartDate>07/08/2010 13:46:18</AgreementStartDate>
    <AgreementStatus>Awaiting</AgreementStatus>
    <ContactFirstName />
    <ITIStreetAddress />
    <ITIStreetNumber />
    - <ListOfOrderEntry-Orders>
    - <OrderEntry-Orders>
    <ITIMoneyToCollect />
    <OrderDate>07/08/2010 13:46:53</OrderDate>
    <OrderNumber2>1-685579</OrderNumber2>
    <OrderStatus>Pending</OrderStatus>
    <OrderType>Sales Order</OrderType>
    - <ListOfOrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>Hollywood 18m</Product>
    <ProductType />
    <PromotionId>123456</PromotionId>
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName>Hollywood 18m</ProdPromName>
    <Product>n TV</Product>
    <ProductType>Root</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>HBO + nFilmHD</Product>
    <ProductType />
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>HBO</Product>
    <ProductType>Opcje dodatkowe</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>nFilmHD</Product>
    <ProductType>Opcje dodatkowe</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>nbox HDTV</Product>
    <ProductType>Dekoder</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>Cinemax</Product>
    <ProductType>Opcje dodatkowe</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>Filmbox</Product>
    <ProductType>Opcje dodatkowe</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>Upust za zakup 3-ego pakietu</Product>
    <ProductType>Upusty</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>Pakiet Informacja i Rozrywka</Product>
    <ProductType>Pakiety</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>Opłata aktywacyjna za nbox HDTV</Product>
    <ProductType />
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>Pakiet Dzieci</Product>
    <ProductType>Pakiety</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    - <OrderEntry-LineItems>
    <OrderType2>Sales Order</OrderType2>
    <ProdPromName />
    <Product>Pakiet Sport i Motoryzacja</Product>
    <ProductType>Pakiety</ProductType>
    <PromotionId />
    <ServiceId />
    </OrderEntry-LineItems>
    </ListOfOrderEntry-LineItems>
    </OrderEntry-Orders>
    </ListOfOrderEntry-Orders>
    </ServiceAgreement>
    </ListOfBipServiceAgreement>
    As per the above XML I want to see
    Pakiet Dzieci.Pakiety , Pakiet Sport i Motoryzac ja.Pakiety.....
    Thanks

  • How to display date field in ALV in format 'YYYY-MM-DD'?

    Hi experts,
    I am not getting displayed the date field in ALV in the format 'YYYY-MM-DD' if it is different than my user setting's format (DD.MM.YYYY).
    Tried with the edit mask
    LVC_S_FCAT-EDIT_MASK = '____-__-__'  but it does not work.
    I could not find the conversion routine for this. Is it possible to write customer conversion routine?
    I have to use DATE field, otherwise if I display this format in CHAR10 field , sorting in ALV does not work for this field.
    PLEASE ANY HELP!
    Kind regards,
    Danijela

    Hi,
    Use FM FORMAT_DATE_4_OUTPUT.
    TYPE-POOLS : slis, KKBLO.
    TYPES: BEGIN OF t_data,
           sel     TYPE char1,
           matnr   TYPE matnr,
           bldat   type char10,
           END OF t_data.
    DATA: it_tab TYPE STANDARD TABLE OF t_data,
          it_fcat TYPE slis_t_fieldcat_alv.
    DATA: wa_tab TYPE t_data,
          wa_fcat TYPE slis_fieldcat_alv,
          wa_layout type SLIS_LAYOUT_ALV.
    data: lv_repid    TYPE syrepid.
    data : lv_date    type NLEI-IBGDT,
           lv_outdate type RN1DATUM-DATEX,
           lv_format  type RN1DATUM-FORMAT value 'YYYY-MM-DD'.
    lv_repid = sy-repid.
    lv_date = sy-datum.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000001'.
    APPEND wa_tab TO it_tab.
    lv_date = sy-datum + 1.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000002'.
    APPEND wa_tab TO it_tab.
    lv_date = sy-datum + 2.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000003'.
    APPEND wa_tab TO it_tab.
    wa_fcat-fieldname = 'SEL'.
    wa_fcat-ref_fieldname = 'XCHPF'.
    wa_fcat-ref_tabname = 'MARA'.
    wa_fcat-edit = 'X'.
    wa_fcat-checkbox = 'X'.
    APPEND  wa_fcat TO  it_fcat.
    CLEAR :  wa_fcat.
    wa_fcat-fieldname = 'MATNR'.
    wa_fcat-ref_fieldname = 'MATNR'.
    wa_fcat-ref_tabname = 'MARA'.
    APPEND  wa_fcat TO  it_fcat.
    CLEAR :  wa_fcat.
    wa_fcat-fieldname = 'BLDAT'.
    wa_fcat-ref_fieldname = 'BLDAT'.
    wa_fcat-ref_tabname = 'BKPF'.
    APPEND  wa_fcat TO  it_fcat.
    call 'REUSE_ALV_GRID_DISPLAY'' after this
    Edited by: Ankur Parab on Oct 1, 2009 2:50 PM
    Edited by: Ankur Parab on Oct 1, 2009 2:51 PM

  • How to validate date fields in the flash form

    i want to validate the date fields to make sure the values
    are not greater than today's date and from-date is less than or
    equal to to-date in the flash form. Does the actionscript have a CF
    DateDiff function for the validatation?
    Thanks

    I finally (after much reading up on actionscript) figured out
    my problem with date validation...which was similar to yours...
    I posted the solution I found for my AS date validation issue
    here:
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=22&threadid=1232361
    I hope it helps!!!

  • How to make Date fields Editable or Non-Editable based on Call Staus

    Hi,
    We are using CRM2007 Web GUI for Service call creation. We are using date profile to populate the dates. Here my requirement is if call status is 'Call created' then some set of date fields to be appeared in display mode(Non Editable) and some set of date fields to be appeared in change mode(Editable). How to achieve this. Kindly suggest me.
    Regards,
    Steve

    Hello,
    Kindly check the following thread which is giving many solutions for your requirement:
    Re: how to make field non-editable (display mode)
    Kind regards,
    Nicolas Busson.

  • How to load date field from a remote Oracle DB with DB Connect

    Hi,
    Does any one have experience extracting Date field from a remote Oracle database through DB Connect to BW?  I am experiencing data format issue.  The extracted data shows '04-Oct-0' for '10/4/05'.  It works fine if I create a view in Oracle database to preformat the data to '20051004'.  But, I am not allowed to create view in Remote DB.
    Any suggestion is very appreciated.
    Regards,
    Frank

    You have to change it to a varchar2 field. YYYYMMDD. I do not know of any other option.

  • How to make date fields in CRMD_ORDER as GRAY (i.e non editable)

    hi Experts,
    i am new to SAP -CRM ,, here i have one queiry related to CRMD_ORDER.
    In my requirement at the time of creating the leases in the CRMD ORDER The date option for Build up period should be grayed out means non editable, and it should be available to amend later means when user want change the order in CRMDORDER it should be editable..
    is it possible in CONFIGURATION level or we need to modify any BADi's..
    please suggest..
    thanks in advance..
    Best regards,
    pradeep.

    Hi Pradeep,
    If u are talking about the date field which are from date pfofile then i date profile u can set the date types as a non-editable (display only) the the user will not able to edit the dates.
    Date Profile->Date Types->Screen Areas: Dates->tick checkbox(only display field)
    Regards,
    DD's

  • How to read data/fields of the pdf form

    Hi,
    i want to orchestrate a process where input is interactive forma and output is xml data.
    i mean i want to read data/fields of the pdf form.
    Which activity do i use on workbench.
    Regards
    Sunil

    Dieter,
    I am talking about 3rd senario, where we create one process on workbench, and pass filled pdf as input and then output of process is xml file.
    What is the process name here (Like renderPDF process) which extract data from pdf.
    regards
    Sunil

  • How to do data migration between single node and multi node HANA systems ?

    Data migration between single node and multi node HANA systems ?
    What are limitations ?
    What should be the best practices ?

    Data migration between single node and multi node HANA systems ?
    What are limitations ?
    What should be the best practices ?

  • How to find common fields between two tables

    Hi friends,
    Is there any way to find out common fields between tables and linking the tables based on common fields.
    Thanks and Regards,
    Chitty.

    Hi Chitty,
      Try using joins it will give the fields which are only common to both the fields.
    Here s an example,
    SELECT mara~matnr
           marc~werks
    INTO   TABLE t_material
    FROM   mara AS mara INNER JOIN marc AS marc
    ON     maramatnr = marcmatnr
    WHERE  mara~mtart = p_mtart.
    Much Regards,
    Amuktha.

Maybe you are looking for

  • Having issues with my mac, wanted to do the "Disk repair" but it wont letme

    i've been having some problems with my mac recently, some programs just keep shutting down for no reason apparently, so i though maybe i go into disk utility and tried to press Repair Disk button, but i cant because it transparent and you cant press

  • Change item category in a PO

    Hi experts, I'm would like to change the item category (from L to empty or vice versa) while creating a PO in reference to a PR (the PR has been created through a project, CJ20N). But I'm always getting the error message "Requisition has different do

  • MicroPhoto Media Source is

    I previously had a 5gig Zen Micro and just upgraded to a Photo. I installed all the stuff from the new CD, but now when I use Media Source, there are no Artist and Album window panes as there were with my Zen Micro. This makes it a big pain in the bu

  • Germany - Cannot Find my Online Number

    Hello there, I purchased an online number several days ago here in Germany and still have not received it. I have search in my skype account and the only references about a skype number is how to buy one. I know that in Germany one has to wait a bit

  • Cann't start up from Tiger to uninstall Leopard

    I'm trying to uninstall Leopard and reinstall Tiger, However, I Can't install Tiger. When I start up holding down the C key I get message I can't install on this computer?! I installed it before and then installed @#%$^&&* Leopard over it. I'm using