Re: Forms5 help

From: Robin Quasebarth <robinq_at_digitalpoint.com>
Date: Mon, 06 Dec 1999 09:55:58 -0800
Message-ID: <384BF8AE.9B3C8B9F_at_digitalpoint.com>


Here' s the check I talked about in the private email I sent this morning.. It pivots on 20. This is not Y10K compliant nor even Y2.1K compliant. But this is all I had time for today. Both could be done.

It is really best if you force the user to enter DD-MON-YYYY format. Also, if you time-travelled back to the 1800's you would have to modify this trigger to deal with centuries other than 1900's that begin in 1......I doubt that you will time travel with your application in hand.....but I just want to be sure you take note just in case:

--Checks to see if user entered from 01-JAN-00 thru 31-DEC-19 and
--sysdate is before 2000 .  If that is the case, add 100 years because
--the user probably is looking to the next century.
    IF                   TO_DATE(:text_field1,'DD-MON-YY')  <
TO_DATE('01-JAN-20')
                AND  TO_NUMBER(SUBSTR(TO_CHAR(SYSDATE,'YYYY'),1,1)) = 1   then
                                    TO_DATE(:text_field1,'DD-MON-YY') :=
                                                   add_months
(TO_DATE(:text_field1,'DD-MON-YY'), 1200);

    END IF;

--
--Checks to see if user entered a date >= sysdate and sysdate is >= 01-JAN- 2000
.
--If that is the case, subtract 100 years because the user probably is
--looking for info from the past century.
    IF                  TO_DATE(:text_field1,'DD-MON-YY')  >=  TRUNC(SYSDATE)
               AND  TO_NUMBER(SUBSTR(TO_CHAR(SYSDATE,'YYYY'),1,1)) > 1   then
                                   TO_DATE(:text_field1,'DD-MON-YY') :=
                                                  add_months
(TO_DATE(:text_field1,'DD-MON-YY'), -1200);
    END IF;
--
--Does the same as above for text_field2:
    IF                   TO_DATE(:text_field2,'DD-MON-YY')  <
TO_DATE('01-JAN-20')
                 AND TO_NUMBER(SUBSTR(TO_CHAR(SYSDATE,'YYYY'),1,1)) = 1   then
                                    TO_DATE(:text_field2,'DD-MON-YY') :=
                                                   add_months
(TO_DATE(:text_field2,'DD-MON-YY'), 1200);
    END IF;
--
    IF                  TO_DATE(:text_field2,'DD-MON-YY')  >=  TRUNC(SYSDATE)
                AND TO_NUMBER(SUBSTR(TO_CHAR(SYSDATE,'YYYY'),1,1)) > 1   then
                                   TO_DATE(:text_field2,'DD-MON-YY') :=
                                                   add_months
(TO_DATE(:text_field2,'DD-MON-YY'), -1200);
    END IF;
--
--Checks to see that the second date is greater than the first:
    IF                 TO_DATE(:text_field2,'DD-MON-YYYY') <
TO_DATE(:text_field1,'DD-MON-YYYY') then
                                  :text_field2 := null;
                                   message('Date2 is incorrect in relation to
Date1 is !');
                                   raise form_Trigger_failure;
    end if;


RQ



wozi wrote:


> using scott.emp table as example.
>
> I created a multi-record block and placed it on canvass. I also place
> 2 non-base text items and a button on the canvass.
>
> The button basically performs execute_query and that workds fine since all
> records in the emp table are displayed. However, when I enter dates in the
> 2 text items, I want to set_block_property('emp', default_where, ???) such
> that
> the hiredate in the table would show those records that are between the date
> ranges enetred in the canvass.
>
> I need help constructing the default_where statement. Thanks very much.
> Reply also to tyc77_at_hotmail.com
Received on Mon Dec 06 1999 - 18:55:58 CET

Original text of this message