Home » Developer & Programmer » Forms » Not able to enable the field if once disabled (Oracle 10g, Windows 7)
Not able to enable the field if once disabled [message #612568] Tue, 22 April 2014 02:05 Go to next message
afzaa2yahoocom
Messages: 24
Registered: April 2011
Location: Dubai
Junior Member
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 you are 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.
  • Attachment: FUJOTHRS.fmb
    (Size: 1.13MB, Downloaded 1101 times)
Re: Not able to enable the field if once disabled [message #612569 is a reply to message #612568] Tue, 22 April 2014 02:14 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi afzaa2yahoocom

welcome to the forum & please use the below Formatter

http://www.dpriver.com/pp/sqlformat.htm

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; 



WBP Code:
--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; 

Re: Not able to enable the field if once disabled [message #612570 is a reply to message #612568] Tue, 22 April 2014 02:28 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi,

Can you please use Set_Item_Instance_Property instead of Set_item_property
(OR)

Set_Custom_Property('YOUR_BLOCK.ITEM_NAME',:SYSTEM.TRIGGER_RECORD, 'ENABLED', FALSE);


Try please..
Re: Not able to enable the field if once disabled [message #612574 is a reply to message #612568] Tue, 22 April 2014 03:13 Go to previous messageGo to next message
Littlefoot
Messages: 21805
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
afzaa2yahoocom

... the above code is not working.


What does "not working mean"? Do you get any error? If so, which one?

Note that re-enabling an item that you previously disabled can't be done just by setting the ENABLED property to true - you'll have to enable some more properties, such as NAVIGABLE and UPDATE_ALLOWED.
Re: Not able to enable the field if once disabled [message #612585 is a reply to message #612574] Tue, 22 April 2014 04:47 Go to previous messageGo to next message
afzaa2yahoocom
Messages: 24
Registered: April 2011
Location: Dubai
Junior Member
Hi Mist,
Set_Item_Instance_Property was giving error as unknown property.

Hi Little,
As you said, I provided the other navigable properties it resolved the issue.

thanks a looooooooooooooooooot.

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

Regards,
Afzal.
Re: Not able to enable the field if once disabled [message #612677 is a reply to message #612570] Wed, 23 April 2014 04:45 Go to previous messageGo to next message
cookiemonster
Messages: 13915
Registered: September 2008
Location: Rainy Manchester
Senior Member
mist598 wrote on Tue, 22 April 2014 08:28
Hi,

Can you please use Set_Item_Instance_Property instead of Set_item_property

Can you please check what things do before offering advise. You can't set enabled with set_item_instance_property. If you'd bothered to check form builder help you'd know that.

[quote title=mist598 wrote on Tue, 22 April 2014 08:28]
(OR)

Set_Custom_Property('YOUR_BLOCK.ITEM_NAME',:SYSTEM.TRIGGER_RECORD, 'ENABLED', FALSE);


Set_custom_property is for interacting with java components, I have no idea why you thought it was relevant.
Re: Not able to enable the field if once disabled [message #612679 is a reply to message #612677] Wed, 23 April 2014 05:05 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:

Can you please check what things do before offering advise. You can't set enabled with set_item_instance_property. If you'd bothered to check form builder help you'd know that.


Modifies the current item instance in a block by changing the specified item property.

If you want to change all instances of an item in a multi-record block, use SET_ITEM_PROPERTY


If i did any wrong post i am really sorry..
Re: Not able to enable the field if once disabled [message #612685 is a reply to message #612679] Wed, 23 April 2014 05:28 Go to previous message
cookiemonster
Messages: 13915
Registered: September 2008
Location: Rainy Manchester
Senior Member
And the form builder help topic for set_item_instance_property includes a complete list of all the properties it can change. You didn't bother to check the list.
Previous Topic: 10g Installation Developer Suit & Application Server Configuration
Next Topic: how the form disable commit?
Goto Forum:
  


Current Time: Mon Mar 18 23:52:07 CDT 2024