Master-detail editing or inserting
Hi,
I'm very sorry because I don't write English well...
I'm studying ADF and I want to know master-detail editing(inserting) method using ADF.
I know master-detail view and deleting.
I need one master row editing(inserting) and multi detail row editing(inserting) in the same page(.JSP file) and Form tag.
For reference, I read and practice below URL.
http://www.oracle.com/technology/products/jdev/tips/mills/JSP_Multi_Row_Edits.html
Please help me..
Have a nice day..
Thank you...
May..
Have you looked at our Oracle JHeadstart offering? If you truly need multi-row editing, it extends the base ADF DataAction to easily generate pages that handle multi-row operations of all kinds.
A complete tutorial is available here:
http://www.oracle.com/technology/products/jdev/tips/muench/jhstutorial/index.html
Otherwise, you'll need to indicate more about what's not working for you after you have read Duncan's tutorial you cite above.
Similar Messages
-
Use master-detail as both insert-edit mode
Guys,
I am again in need for your expert suggestions....(I am using Jdev 11.1.1.3 and really new to adf world)
I need to implement a scenario where user will click the menu item and system should open a detail page in insert mode.
I have a page fragment for headers.... which has menu bars.... and one the of item in the menu bar is "Create new Record"
My application has master-detail page (master with multiple details). I would like (don't have to) to use the same master-detail for Insert and Edit
More detail scenario: 1. User will click "Create new Record" menu item
2. Load the master-detail page in insert mode
3. when they save the record, page should turn to edit mode...
any help is greatly appreciated......
Edited by: raj-acha on Sep 2, 2010 9:22 AMI can use goMenuItem to open the master-detail page. Do you think any issue with this?
Also, Can i use the master-detail page for both Insert and Edit? if so, please suggest me possible solution. (I have master-detail page and only opens in edit mode)
-R -
Master-Detail Multi-Row Insert
Im still using Oracle forms 6i. How do we create here in ADF for the transaction in master-detail operation specially in inserting multi-row in detail. In forms we can use key-next item trigger next_record for new record transaction for drugs or we can use bar code scanning to insert new records & automatically go to next records waiting for another input...
pls help me i want to upgrade & pls sorry for my english...
just want this adf behave like forms in terms of master-detail transaction entry...
i appreciate if someone can help me or give me demo file to download & play with it...
Edited by: user8983555 on Nov 10, 2010 10:30 AMtnx for the fast reply..
im new with jdeveloper and no knowledge in java or html. im concentrated in pl/sql , forms 6i.We still using this until now in character base in unix environment but some module in gui mode.im working in hospital which is complete informations sytem (stock,pharm..etc...gl...) which in bulk transactions specially patients outclinic & inpatients charges.now we have also this reservations system for out clinics thats the reason im like to develop for in a web that a patient can reserve on line and i dont like running our application in different front end (forms 6i &jdeveloper).
(now currently checking form10g & just set up AS10g which is working.can deploy and connect,LAN). but im very interested in ADF when i see the demo on Oracle website.
now our company pplanning to change our application to power builder whiich is not good in performance regarding in hadling big databases (slow query,needs burst AS...) thru to the demonstration of the
apllication vendors.
im very glad if you can help. can you post a links or demo file to do this as you said....(You can replicate the code in the button in some other event on your page, for example when the value of the last field in the row is changed.
It all comes down to the question of when you actually want to create a new row, and in that event you call the createInsert method.)
this is my only problem now to make this master-detail multi-row insert like ora form.
again sorry for my english... -
Master detail form initial insert issue on details sub-region
Hello,
I created a master detail form with report which should do insertion on master and detail region/subregion.
On insert mode I enter with data master and detail block, when I press "Create" button, insertion happens only on master block (order table) not and on detail block (order_item table).
On EDIT mode it does insertions/updates on master and detail block without problems.
Application Express 4.2.1.00.08
Oracle Database 11g Express Edition Release 11.2.0.2.0
I appreciate your help.
RegardsSomething like this should do the work:
CREATE OR REPLACE TRIGGER order_item_table_tr
BEFORE INSERT
ON order_item_table
FOR EACH ROW
BEGIN
IF :NEW.order_id IS NULL
THEN
:NEW.order_id := v ('P1_ORDER_ID');
END IF;
END order_item_table_tr;
/Make sure the Automatic Row Processing (DML) of the order table returns key into item > Return Key Into Item > P1_ORDER_ID (or however the primary key of the order table is named)
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.apress.com/9781430235125
http://apex.oracle.com/pls/apex/f?p=31517:1
http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
------------------------------------------------------------------- -
Master-Detail and Auto Insert Detail rows
Apex 3.0
I'm trying to do a Master-Detail form. I have it set to stay on the same page when I Create a new Master Record.
Now, what I would like to do is auto insert data into the Detail Rows some predefined information and have it ready for the user to enter the rest of the information. I did this by creating a Page Process to trigger on the Add Row button for the Details region. The code I used is:
begin
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'General');
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'Automobile');
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'Excess');
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'Workers Comp');
insert into purch_insurance_type (Contract_ID, INSURANCE_TYPE) values(:P7_Contract_ID, 'Others (Builders Risk)');
end;
P7_Contract_ID is the PK on the Master table and I predefine the Insurance Type. The rest of the table the user is able to enter as needed.
When I run it, the new rows show up but the Insurance Type is NULL and browsing from one record and back the new rows are gone. It seems like the PK for the Detail rows are not being filled. I have a Sequence Trigger set to fire on Update:
CREATE OR REPLACE TRIGGER "BI_PURCH_INSURANCE_TYPE"
before insert on "PURCH_INSURANCE_TYPE"
for each row
begin
if :NEW."INSURANCE_TYPE_ID" is null then
select "PURCH_INSURANCE_TYPE_SEQ".nextval into :NEW."INSURANCE_TYPE_ID" from dual;
end if;
end;
ALTER TRIGGER "BI_PURCH_INSURANCE_TYPE" ENABLE
What am I missing? Any ideas or suggestions?Hi All!
I think there is no solution to this problem, only single selection is the solution.
If any one has anyother solution plz let me know.
Thanks and regards.
Abbasi -
Adding button to report to link to master detail form
I want to add a button to a report to direct me to a blank master detail form to insert a new record. I have used the following code in the additional PL/SQL code section:
htp.formopen('PORTAL30.wwa_app_module.new_instance?p_moduleid=1271601405');
htp.formsubmit('p_request','Create New');
htp.formClose;
When I click this I get 'Page Not Found'.
But if I hit refresh I am directed to the correct form with the same url.
Any ideas on what the issue is?
Thanks.Hi,
Check this sample code.
tables:sscrfields. "Fields on selection screens
selection-screen function key 1.
selection-screen function key 2.
Initialization.
sscrfields-functxt_01 = 'Report'.
sscrfields-functxt_02 = 'Exit'.
at selection-screen.
if sscrfields-ucomm = 'FC01'.
perform f_alv_sub.
elseif sscrfields-ucomm = 'FC02'.
endif.
Hope it helps. -
Requerying on Master Detail form
Hi,
Does anyone know how to set up PL/SQL code to automatically requery on a master detail form after insert/update? For example, if I insert a record on the master part of the form, I would like that record to automatically show up after the insert/update. Also, if I insert a record on the detail part of the form, I would like that record to automatically show up after an insert/update.
Thanks,
MartinHi Krishnamurthy,
Thank you very much for the code. The code for the most part acts like I want it to except when I initally insert a master record. In my case, I have the form set up so you have to insert a master record before you can insert any detail records. Therefore, after the user clicks save, that master record needs to come up. The code you gave me only brings up the current master record if you are inserting detail records (which is great, that is what I want it to do). I have modified the code you gave me so when a user is just inserting the master record, the master record automaticaly comes up rather than the first record in the table. However my code makes the form run slow (about 13 seconds to save). Do you know of another way that I can make the form act like I want it to. Below is my code.
Thanks again,
Martin
declare
l_msg varchar2(255);
l_key_value number(10);
l_key_value2 number(10);
v_get_id number(9);
v_check_detail number(9);
CURSOR GET_ID IS
SELECT MAX(A.PCH_ID)
FROM PORTAL30.PCHEADER A;
CURSOR CHECK_DETAILS IS
SELECT DISTINCT B.PCD_ID
FROM PORTAL30.PCDETAILS B WHERE B.PCD_PHC_ID = v_get_id;
begin
/*get the key field value from the Master Detail form to requery the details since the form will be cleared out after update */
l_key_value := p_session.get_value_as_NUMBER(
p_block_name => 'MASTER_BLOCK',
p_attribute_name => 'A_PCH_ID',
p_index => 1
doSave;--- This is the default handler
OPEN get_id;
FETCH get_id into v_get_id;
CLOSE get_id;
OPEN check_details;
FETCH check_details into v_check_detail;
IF check_details%NOTFOUND
THEN
CLOSE check_details;
/*get the key field value from the Master Detail form to requery the details since the form will
be cleared out after update */
l_key_value2 := v_get_id;
/*get the message which is going to be displayed after update */
l_msg := p_session.get_value_as_varchar2(
p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_STATUS');
/*now set the key field value in the Master Detail */
p_session.set_shadow_value(p_block_name => 'MASTER_BLOCK',
p_attribute_name => 'A_PCH_ID',
p_value => l_key_value2,
p_language => PORTAL30.wwctx_api.get_nls_language);
WWV_MASTER_GENSYS_1(p_block_name => null,
p_object_name => null,
p_instance => null,
p_event_type => null,
p_user_args => null,
p_session => p_session);
/*put the message(like 'Updated one master record' ) back in the screen */
p_session.set_value(p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_STATUS',
p_value => l_msg);
p_session.set_value
(p_block_name => 'MASTER_BLOCK'
,p_attribute_name => '_MASTER_ACTION'
,p_value => 'NONE');
p_session.save_session();
ELSE
CLOSE check_details;
/*get the message which is going to be displayed after update*/
l_msg := p_session.get_value_as_varchar2(
p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_STATUS');
/*now set the key field value in the Master Detail*/
p_session.set_shadow_value(p_block_name => 'MASTER_BLOCK',
p_attribute_name => 'A_PCH_ID',
p_value => l_key_value,
p_language => PORTAL30.wwctx_api.get_nls_language);
WWV_MASTER_GENSYS_1(p_block_name => null,
p_object_name => null,
p_instance => null,
p_event_type => null,
p_user_args => null,
p_session => p_session);
/*put the message(like 'Updated one master record' ) back in the screen*/
p_session.set_value(p_block_name => 'MASTER_BLOCK',
p_attribute_name => '_STATUS',
p_value => l_msg);
p_session.save_session();
END IF;
END; -
How to set the Master Action of a master detail form?
Hi,
I have a regular form navigates to a master detail form in
insert mode. How do I make the MASTER_ACTION show up
as "Insert" instead of "None"? If I call the Master detail form
in auto query mode, it will show up as "Update" in the
MASTER_ACTION. How do I make the MASTER_ACTION show up as
"Insert" instead of "None"?
Any ideas are highly appreciated.
Thanks;
Kelly.Just have a look over these two statements if it solves your problem
one time where clause
Set_Block_Property('BLOCK_NAME',ONETIME_WHERE,your form item);
dynamic where clause
set_block_property('BLOCK_NAME'default_where, your form itme)
you can where clause at run time from any procedure or some triggers -
Procedure in master/detail form
NOTE: The basic purpose of this procedure is to return records from another table that match records that were just inserted in the detail table.
My problem is that this procedure processes one set of values at a time. I would like to adapt this procedure to execute after processing a master/detail form that inserts multiple detail records. How and where in the form should I call this procedure to process all the detail records?
INDT IN VARCHAR2,
PRIM_REPORTER IN VARCHAR2,
SEC_REPORTER IN VARCHAR2 DEFAULT NULL)
as
begin
DECLARE
cursor rpt_cursor is
SELECT
F_NAME,
L_NAME,
INDT,
CO_DEFT,
REPORTER,
PROCD,
PROCD_DATES
FROM NYSPCR.RETURNED_TRANSCRIPTS
WHERE NYSPCR.RETURNED_TRANSCRIPTS.INDT=INDT
AND REPORTER=PRIM_REPORTER
OR REPORTER=SEC_REPORTER;
rpt_record rpt_cursor%ROWTYPE;
BEGIN
OPEN rpt_cursor;
LOOP
fetch rpt_cursor into rpt_record;
exit when rpt_cursor%NOTFOUND;
htp.p('Our records show that one or more of the transcripts you have just requested may already exist.<P>It appears that co-defendants '||rpt_record.F_NAME||' '|| rpt_record.L_NAME||' or '||rpt_record.CO_DEFT||' already had these minutes transcribed by Court Reporter '||rpt_record.REPORTER||' for this '||rpt_record.PROCD||'proceeding on these dates '||rpt_record.PROCD_DATES||'.<P> Get up off your ass and look for it!');
end loop;
end;
end;UPDATE!!!!! I tried to amend the code to loop thru the detail records. Here it goes..feel free to jump in at any time.lol..
// Set local variables to receive parameters being passed
//from detail records
declare
INDTS VARCHAR2(15);
PRIM_REPORTERS VARCHAR2(35);
SEC_REPORTERS VARCHAR2(35);
p_session portal30.wwa_api_module_session;
i integer;
rpt_record rpt_cursor%ROWTYPE;
begin
p_session := portal30.wwa_api_module_session.create_session
( p_module_id => 51078584518,
p_version => 1
i:=1;
//Print first line of alert.
htp.p('Our records show that one or more of the transcripts you have just requested may already exist.');
//Loop through all details records to find any matches as long as INDTS is not null.
while indts is not null LOOP
INDTs:= p_session.get_value_as_varchar2
p_block_name => 'DETAIL_BLOCK',
p_attribute_name => 'A_INDT',
p_index => i
PRIM_REPORTERs:=p_session.get_value_as_varchar2
p_block_name => 'DETAIL_BLOCK',
p_attribute_name => 'A_PRIM_REPORTER',
p_index =>i
SEC_REPORTERs := p_session.get_value_as_varchar2
p_block_name => 'DETAIL_BLOCK',
p_attribute_name => 'A_SEC_REPORTER',
p_index =>i
cursor rpt_cursor is
SELECT
F_NAME,
L_NAME,
INDT,
CO_DEFT,
REPORTER,
PROCD,
PROCD_DATES
FROM NYSPCR.RETURNED_TRANSCRIPTS
WHERE NYSPCR.RETURNED_TRANSCRIPTS.INDT=INDTs
AND REPORTER=PRIM_REPORTERs
OR REPORTER=SEC_REPORTERs;
OPEN rpt_cursor;
LOOP
fetch rpt_cursor into rpt_record;
exit when rpt_cursor%NOTFOUND;<P>
htp.p('It appears that co-defendants '||rpt_record.F_NAME||' '|| rpt_record.L_NAME||' or '||rpt_record.CO_DEFT||' already had these minutes transcribed by Court Reporter '||rpt_record.REPORTER||' for this '||rpt_record.PROCD||'proceeding on these date(s) '||rpt_record.PROCD_DATES||'.');
i:=i+1;
end loop;
end; -
Master-Detail Forms (Populating a Foreign Key Automatically)
Master-Detail Form
When inserting a MD Form, the Master ID (e.g. Deptno,the Primary Key) is generated.
How is it possible for this also to be generated in the Detail Form (as the Foreign Key)? The requirement is for the foreign key to be populated automatically.
Any help would be much appreciated.
Thanks.This item is discussed earlier in this group.
It's solved in version 3.0.8
Regards,
Anna -
Hi -
How do I create a simple Master-Detail page in JSP like Oracle Forms type.
I want to show/enter one master record and multiple child records and let the users enter data. I DO NOT WANT TO CREATE SEPERATE MASTER AND SEPERATE DETAIL JSP PAGE. I want the basic Master-Detail Form like Oracle Forms.
I am using JDeveloper 3.2
Thanks for your help !
FahimIn our current release, we dont generate a single-page master-detail editing page. You would are missing an editable data-grid tag for this to be possible. You can create this control yourself using the provided datatags.
-
Hi all,
i need to create master details of p.o. entry jsp web application. can u tell me jdeveloper 10g can do it ?
(my meaning of master details is dynamic insert new
record at detail scope at same page . no need link to
another page. idea like oracle9i forms.)
best regards
borisNeon wrote:
I have mapped a createInsert action in the blinding layerThis is OK.
Neon wrote:
Do you mean that i have to create createRow and insertRow action in blinding layer?No. The createInsert operation does just that
Neon wrote:
Or call these function in the VO overridden create() method?No. You can't do that.
In conclusion, I don't understand why the accessor returns null. Maybe someone else can shed some light... ?:|
One last suggestion from me is to try getting the VO1 directly from the AM instead.
This should work - it is not a recommended practice through.
Use the following code:
VO1RowImpl vo1 = (VO1RowImpl)this.getVO1();
// ensure that the VO1 VL accessor is properly initialized
if (vo1 == null) {
vo1 = (VO1RowImpl)((YourApplicationModuleImpl)this.getApplicationModule()).getVO1().getCurrentRow();
} -
How to create Insert & Update on master-detail form JPA/EJB 3.0
Is there any demonstration or tips how to Insert record on master-details form for JPA/EJB 3.0 with ADF binding?
I have master-detail forms (dept-emp). I drag the dept->operations->create method to JSF page. But when I click create button, only dept form is clear and ready for insert. But emp form is not clear. How can I add create method for this?
Can you give some example how to pass the right object to the persist or merge method so that it can save both the two objects (master-detail tables)
Thanks
Edited by: user560557 on Oct 9, 2009 8:58 AM -
Hello all,
I'm having a problem with an insert in a master detail. Situation is as follows:
I have a VO based on an entity, VOMaster. This has a ViewLink to another VO based on an entity (1..*), VODetail. In my application, I do a CreateInsert on VOMaster. All works well, I can edit the fields there and I could do a commit if I want to.
But I don't want to commit just yet. I now want to CreateInsert a row of VODetail. When I do that, I either get nullpointer exceptions because the row isn't actually created (when I uncheck the composition chexbox in the Association between the 2 entities), or I get an InvalidOwnerException (when that checkbox is checked).
I also tried to not do a CreateInsert but a Create, but then the fields are not editable.
Can anybody help me?
Many thanks!On a side note: I tried http://radio.weblogs.com/0118231/stories/2003/01/17/whyDoIGetTheInvalidownerexception.html but I get the same errors (InvalidOwner on .createRow())...
-
Hi all,
I need to understand which is the fastest way for inserting rows in master-detail tables
Using a procedure. I often insert lots of details rows and sometimes master-details rows
Here there is my solution. Is there something faster?
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
CREATE TABLE MAIN_TRACING (
MAINVAL VARCHAR2(10) NOT NULL,
PAR1 VARCHAR2(10) NOT NULL);
CREATE TABLE TRACING_DET (
MAINVAL VARCHAR2(10) NOT NULL,
SUBPAR1 VARCHAR2(10) NOT NULL);
CREATE UNIQUE INDEX MYPK ON MAIN_TRACING(MAINVAL);
ALTER TABLE MAIN_TRACING ADD ( CONSTRAINT MYPK PRIMARY KEY (MAINVAL) USING INDEX MYPK);
ALTER TABLE TRACING_DET ADD ( CONSTRAINT MYFK FOREIGN KEY (MAINVAL) REFERENCES MAIN_TRACING (MAINVAL));
CREATE OR REPLACE PROCEDURE ADD_TRACE(V_MAINVAL VARCHAR2, V_PAR1 VARCHAR2, V_SUBPAR1 VARCHAR2)
AS
PARENT_NOT_FOUND EXCEPTION;
PRAGMA EXCEPTION_INIT(PARENT_NOT_FOUND, -2291);
BEGIN
INSERT INTO TRACING_DET(MAINVAL, SUBPAR1)
VALUES (V_MAINVAL, V_SUBPAR1);
COMMIT;
EXCEPTION
WHEN PARENT_NOT_FOUND
THEN
INSERT INTO MAIN_TRACING(MAINVAL, PAR1)
VALUES (V_MAINVAL, V_PAR1);
INSERT INTO TRACING_DET(MAINVAL, SUBPAR1)
VALUES (V_MAINVAL, V_SUBPAR1);
COMMIT;
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE(' Error code : ' || TO_CHAR(SQLCODE));
END ADD_TRACE;
EXEC ADD_TRACE('m1', 'a', 'suba1');
EXEC ADD_TRACE('m1', 'a', 'suba2');
EXEC ADD_TRACE('m1', 'a', 'suba3');
--exec ADD_TRACE('m1', 'b', 'suba3'); --IMPOSSIBLE!
EXEC ADD_TRACE('m2', 'b', 'subb1');
EXEC ADD_TRACE('m2', 'b', 'subb2');
SELECT * FROM MAIN_TRACING;
MAINVAL PAR1
m1 a
m2 b
SELECT * FROM TRACING_DET;
MAINVAL SUBPAR1
m1 suba1
m1 suba2
m1 suba3
m2 subb1
m2 subb2The answer (as Tom Kyte is fond of stating) is "It depends" ;-)
Is this something that is called scattered over the application? Most of the time it will be called with an existing MAINVAL and just sometimes now and again a new MAINVAL will be inserted? Subsequent calls to ADD_TRACE will typically have a different MAINVAL than the previous call?
If that is the case, then your method is not a bad one. Many programmers would have first tested for existence of master and decided whether to insert it or not, which would then be wasted effort in 95% of the cases.
Your method of assuming the master exists and then handle the exception if it does not - that is quite neat. But the key is - it has to be the exception to the rule that the exception handler is invoked.
But if on the other hand you are calling ADD_TRACE pretty consecutively (sort of like your example) with first several calls with one MAINVAL, then several calls with a new MAINVAL, then several with a new MAINVAL, etc. - say a typical ETL process or loading data from perhaps a flatfile or something like that - then you would do better to do one insert of the parent and then bulk up the children in a bulk insert.
So it depends on your use case. There is not one generally best way to insert into master-detail - there will be several depending on whether you are bulk loading data to your master-detail or you have scattered calls.
But just one other thing concerning your code:
Usually it is not a good idea to issue those COMMIT statements inside your procedure. How do you know if the caller has finished with the transaction or not?
Either let the client/caller decide when the complete transaction is done.
Or you may decide that this is tracing/logging and should be logged no matter whether the calling transaction commits or rollbacks, and then you can make ADD_TRACE use an autonomous transaction.
(All of the above is just my personal opinion and you will likely find other people with different opinions ;-) )
Maybe you are looking for
-
Error in communicating with Group Administration Server
Hello everyone, i am requesting your help for an issue with LMS 4.2.5 When i browse to Admin-> Group Management -> Fault. I get the following: OGS Server Error Error Error in communicating with Group Administration Server. It may be down or not yet u
-
Hi, would you please shade some light on the FI-CA integration with MM? Is it necessary to use FM if such integration is required? Is it necessary at all to have such an integration if payments can be executed from FI-AP? Thank you in advance!
-
Metainit error - overlaps with device in metadevice state database
I have successfully mirrored 3 of 4 partitions on a new install but am having trouble with the last one. It is the swap partition. There are the usual steps I follow: SWAP (slice 1): 1. metainit -f d11 1 1 c0t0d0s1 2. metainit d12 1 1 c0t8d0s1 3. met
-
Char NUMC(5) - need to store value at database level without leading Zeros.
Hi All We have 0Mat_Item like infoobjects in SAP BI, which have data type Char NUMC(5). Here if u load value '1', it would show us '1' at front end (BI or reporting level) but at database level stores as u201800001u2019. My requirement is to store th
-
[Blackberry 8100] What are the best pic sizes for the blackberry?
Hi, I am the proud owner of a new blackberry 8100 and I have a few questions. When I upload an image of 600x450 pixels to the media card, They display well, but when using the Zoom feature, the image starts to get blurry. Now with a 600x450pixel