|
|
|
Re: Creating items based on a pl/sql function OR referencing report columns in a pl/sql query [message #544114 is a reply to message #544093] |
Mon, 20 February 2012 04:11 |
c_stenersen
Messages: 255 Registered: August 2007
|
Senior Member |
|
|
Are the checkpoints in another table? If you want an editable field then you can use the APEX_ITEM package. So in your region you could then have
select
apex_item.display_and_save(1, checkpoint) checkpoint,
apex_item.date_popup2(2, null, 'DD-MON-YY') milestone_date
from checkpoints
where <<whatever conditions you have>>
And in your process (assuming P1_PROJECT_ID holds the id of the recently inserted project):
begin
for i in 1..apex_application.g_f01.count loop
--apex_application.g_f01 holds the values for items you've given number 1 to
--and g_f02 holds the ones with number 2
insert into milestones(project_id, checkpoint, date)
values(:P1_PROJECT_ID, apex_application.g_f01(i), apex_application.g_f02(i));
end loop;
end;
If you don't have this checkpoint table then there is still a technique for doing this, but unless you actually need it I won't confuse you with it Just let me know if this is what you needed.
|
|
|
Re: Creating items based on a pl/sql function OR referencing report columns in a pl/sql query [message #544118 is a reply to message #544114] |
Mon, 20 February 2012 04:30 |
|
balckbandit5
Messages: 104 Registered: December 2011
|
Senior Member |
|
|
Quote:but unless you actually need it I won't confuse you with it
haha thank you for the consideration
As far as I can tell this is what I was after
just one thing, my checkpoint table has the ID and the Checkpoint name, so to display the name but have the ID in the other table would this work:
select
apex_item.hidden(1, checkpoint_ID) Checkpoint_ID,
apex_item.display_and_save(2, checkpoint) checkpoint_name,
apex_item.date_popup2(3, null, 'DD-MON-YY') milestone_date
from checkpoints
then
begin
for i in 1..apex_application.g_f01.count loop
insert into milestones(project_id, checkpoint_ID, date)
values(:P1_PROJECT_ID, apex_application.g_f01(i), apex_application.g_f03(i));
end loop;
end;
thanks
[Updated on: Mon, 20 February 2012 04:31] Report message to a moderator
|
|
|
Re: Creating items based on a pl/sql function OR referencing report columns in a pl/sql query [message #544123 is a reply to message #544118] |
Mon, 20 February 2012 04:40 |
c_stenersen
Messages: 255 Registered: August 2007
|
Senior Member |
|
|
Yes it would work. But what I would rather do is:
select
apex_item.hidden(1, checkpoint_ID) || checkpoint checkpoint_name,
apex_item.date_popup2(2, null, 'DD-MON-YY') milestone_date
from checkpoints
What you can see is that I removed the "display_and_save" for the text of the checkpoint name (you don't need it in your process, so there's no need to save it), and I just concatenated your hidden value with the checkpoint name. If you put the hidden field in a column of its own the report will show an empty column. By concatenating the hidden field with the display value you will see the name of the checkpoint, but the id is what's stored. Then you can just use the process from my previous post.
|
|
|
|
Re: Creating items based on a pl/sql function OR referencing report columns in a pl/sql query [message #544132 is a reply to message #544127] |
Mon, 20 February 2012 05:17 |
|
balckbandit5
Messages: 104 Registered: December 2011
|
Senior Member |
|
|
Hi again, got a bit of a problem,
THe MILESTONE table has a Primary Key on 'ID', so I need another hidden column with a new ID for each checkpoint...
I tried:
begin
for i in 1..apex_application.g_f01.count loop
insert into PMO_MILESTONES(MILESTONE_ID, CHECKPOINT_ID, PROJECT_ID, DATE)
values((select S_PROJECT_MILESTONE.nextval next_val from dual),
apex_application.g_f01(i), :P4_PROJECT_ID, apex_application.g_f02(i));
end loop;
end;
but it didn't like me doing that...(it said: sequence number not allowed here )
Can I put a default value in a hidden apex_item?
thanks
|
|
|
|
|
|
|