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 Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/992da6a980f827486b1fe245e2db9d3f?s=64&d=mm&r=g) |
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 1256 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 message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/a59247482a11edb9544247f102223e8d?s=64&d=mm&r=g) |
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 #612585 is a reply to message #612574] |
Tue, 22 April 2014 04:47 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/992da6a980f827486b1fe245e2db9d3f?s=64&d=mm&r=g) |
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 message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
mist598 wrote on Tue, 22 April 2014 08:28Hi,
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.
|
|
|
|
|
Goto Forum:
Current Time: Thu Sep 05 23:08:15 CDT 2024
|