|
|
|
|
|
|
Re: How to REJECT or APPROVE the request in APEX4.1 [message #553873 is a reply to message #553871] |
Wed, 09 May 2012 01:17 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Right, the report! Didn't read carefully enough your initial post, sorry.
My suggestion was based on a FORM, not a report. However, it is easy to create a LINK on a report column which would pass LEAVE_ID (or anything else you need) to another (FORM) page, which would do what I described. I suppose that supervisors wouldn't like it much (as they would need to navigate forth and back for every leave requirement).
Therefore, perhaps you should switch from a report to a tabular form (updateable report). In there, fetch all columns you fetch now, plus additional APPROVE checkbox. Supervisor would check these checkboxes (for people whose leave requests are approved), and it would require a single SUBMIT button whose process would loop through all records in a tabular form, check whether the checkbox is checked and UPDATE a record in a table.
If you didn't do that yet, here's how the loop looks like (excerpt from one of my tabular forms):
for i in 1 .. apex_application.g_f01.count loop
if apex_application.g_f02(i) = 1 then -- g_f02 is a tabular form checkbox
select p.naziv
into l_naziv
from dg_slike_popis p
where p.id = apex_application.g_f01(i);
utl_file.putf(file_handler, l_naziv || '\n');
end if;
end loop;
For more information about tabular forms items, see the documentation.
|
|
|
|
|
|
|
|
|
Re: How to REJECT or APPROVE the request in APEX4.1 [message #553897 is a reply to message #553892] |
Wed, 09 May 2012 02:54 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
This is my region source query:select
id,
id id_display,
naziv,
cb_delete
from dg_slike_popis
order by 1
CB_DELETE is NUMBER(1).
It is displayed as a "Simple checkbox".
Its List of values definition is "1,0" (put 1,0 into that field, without quotes) (1 is checked value, 0 is unchecked).
(For you, it might be CB_APPROVE instead. I'm deleting records, so I named the column CB_DELETE).
This is how my report attributes look like. Pay attention to "Edit" check mark.
It means that
- apex_application.g_f01 = ID => will be LEAVE_ID for you
- apex_application.g_f02 = CB_DELETE => will be CB_APPROVE for you
Process loops through all records in a tabular form ("for i in 1 .. apex_application.g_f01.count") and does *something* (I'm selecting, you'll be UPDATE-ing) IF a checkbox is checked ("if apex_application.g_f02(i) = 1" - as we said, g_f02 = CB_DELETE).
You'd do something like this:
update your_table set
status = case when apex_application.g_f02(i) = 1 then 'APPROVED'
else 'REJECTED'
end
where leave_id = apex_application.g_f01(i);
-
Attachment: edit.png
(Size: 5.49KB, Downloaded 3268 times)
|
|
|
|
|
|
|
|
|
|
|