Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Not able to enable the field if once disabled

Afzal MogalApr 22 2014 — edited Apr 22 2014

Hi All,

I developed one custom form in 10g, for apps R12.1.3.

Registered and everything is ok with apps.

The form have 31 fields to enter OT hours, If the employee is on leave then the respective fields will get disabled, while selecting the month (List).

1.  To disable the fields based on leave days. ( when-list-changed trigger)

--IF TO DISABLE THE FIELDS OF LEAVE DAYS THE CODE STARTS FROM HERE
DECLARE

CURSOR C1 IS

select TO_CHAR ( start_date + LEVEL - 1, 'fmDD' )  AS DAYS

from(

SELECT  start_date,employee_number, end_date

FROM    v_leave_details

where employee_number = :XXFUJOTHRS.EMPLOYEE_NUMBER--'5527'

)

WHERE start_date + LEVEL - 1  >= TO_DATE ('01'||:XXFUJOTHRS.OT_MONTH||:XXFUJOTHRS.OT_YEAR, 'dd-mm-yyyy')

AND     start_date + LEVEL - 1  <  LAST_DAY(TO_DATE ('01'||:XXFUJOTHRS.OT_MONTH||:XXFUJOTHRS.OT_YEAR, 'dd-mm-yyyy')) + 1

CONNECT BY  LEVEL               <= 1 + end_date - start_date

        AND  PRIOR employee_number        =   employee_number -- or whatever is unique

        AND  PRIOR start_date   = start_date

        AND  PRIOR SYS_GUID ()  IS NOT NULL;

BEGIN

            FOR J IN C1 LOOP

                    --DBMS_OUTPUT.PUT_LINE(J.DAYS);

                    set_item_property('OT_DAY'||J.DAYS,enabled,property_false);

                    END LOOP;

END;

But I am facing two issues.

1. When I query any employee and if employee has leave days in month (Jan-14 for 1-10 days), (by pressing down key) then other months also showing the 1-10 days disabled along with days disabled if any leaves in their respective months.

2. If any employee return early before end date , let say his leave is from 01-jan-14 to 10-jan-14, and he returned on 08-jan-14, he has OT on 09-jan-14.

So I kept one button as show in the form and code is as below.

Trigger on Button (When-Button-Pressed)

--TO MAKE THE FIELD ENABLE AGAIN IF THEY R DISABLED BY THE LEAVES

DECLARE

    CURSOR C1 IS

    SELECT  1 + LEVEL - 1 DAYS

FROM DUAL

CONNECT BY LEVEL <= to_char(last_day(to_date('01'||:XXFUJOTHRS.OT_MONTH||:XXFUJOTHRS.OT_YEAR,'dd-mm-rrrr')),'dd');

BEGIN  

    for i in c1 LOOP

    --dbms_output.put_line(i.days);

            set_item_property('OT_DAY'||i.DAYS,enabled,property_true);

END LOOP;

END;

This code is working fine, if u r entering new record and press the button, but if u query the same employee and click the SHOW button, the above code is not working.

Kindly suggest this two issues.

I tested keeping the codes in post-query-trigger also, same issue.

Thanks & Regards,

Afzal.

This post has been answered by 994122 on Apr 22 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 20 2014
Added on Apr 22 2014
6 comments
312 views