Copy value from first detail record to next detail record only one field is

Hi all
i have a detail form with this table
CREATE TABLE customer_detail (
  cust_id NUMBER,
  aDDRESS_type VARCHAR2(20),
  contact_name VARCHAR2(100),
  mobile_no VARCHAR2(20),
  delivery_address VARCHAR2(300),
  off_contact_no VARCHAR2(20),
  email_id VARCHAR2(50),
  city VARCHAR2(50),
  pin_code VARCHAR2(50),
  country VARCHAR2(30),
  contact_name_1 varchar2(100),
  contact_name_2 varchar2(100),
  MOBILE_NO_1 VARCHAR2(20),
  MOBILE_NO_2 VARCHAR2(20),
  OFF_CONTACT_NO_1  VARCHAR2(20),
  OFF_CONTACT_NO_2  VARCHAR2(20),
  EMAIL_ID_1 VARCHAR2(50),
  EMAIL_ID_2 VARCHAR2(50)
   );i enter a record in this table through form and the addess_type = 'INVOIVE ADDRESS'
i want when i save this one record and i want to save same to same record in this table the addres_type will change
address_type='DELIVERY_TYPE' as a next record
PLease Guide
Thanks And Regards
Vikas Singhal
Edited by: vikas singhal on Sep 17, 2009 12:09 PM

Hi!
May there is already a delivery address for that customer in the table, so it is a good choice
to just insert a new record 'DELIVERY ADDRESS' if there is no one.
May try a pre-insert trigger:
begin
if
  :address_type = 'INVOICE ADDRESS'
then
  insert into customer_detail
  select :cust_id, 'DELIVERY ADDRESS', :contact_name, :mobile_no, :delivery_address,
         :off_contact_no, :email_id, :city, :pin_code, :country, :contact_name_1,
         :contact_name_2, :MOBILE_NO_1, :MOBILE_NO_2, :OFF_CONTACT_NO_1, :OFF_CONTACT_NO_2,
         :EMAIL_ID_1, :EMAIL_ID_2
  from dual
  where not exists ( select 1 from customer_detail
                     where cust_id = :cust_id
                     and   address_type = 'DELIVERY ADDRESS' );
end if;
end;You could do the same, if you insert a new 'DELIVERY ADDRESS' and there is no 'INVOICE ADDRESS'.
Regards

Similar Messages

  • Copy value from first detail form to second detail form

    Hi all
    i have form and the fileds are like that these are multiple
    prod_id   prod_name    quantity    price
    101         drees             5             200
    102          top               3             150
    205          jean              2              520i want copy these data into second form when-new-form-instance
    Thanks And Regards
    Vikas

    Hi Manu
    i have two form ist form is based on these table s
    SQL> DESC SALE_ORDER
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    SALE_ORDER_NO                                      VARCHAR2(50)
    ORDER_DATE                                         DATE
    PARTY_NAME                                         VARCHAR2(100)
    DEL_DATE                                           DATE
    COMMENT1                                           VARCHAR2(200)
    CUST_ID                                            NUMBER
    DISCOUNT                                           NUMBER
    SEASON_YEAR                                        VARCHAR2(20)
    TYPE                                               VARCHAR2(50)
    SHOW                                               VARCHAR2(100)
    VAT_PERSENTAGE                                     NUMBER
    VAT_PRICE                                          NUMBER
    PERFORMA_TYPE                                      VARCHAR2(50)
    AGENT_NAME                                         VARCHAR2(50)
    CURR                                               VARCHAR2(15)
    SHIP                                               VARCHAR2(20)
    VIP                                                VARCHAR2(100)
    CONTACT_NO                                         VARCHAR2(15)
    VAT_NO                                             VARCHAR2(100)
    PAYMENT_TERM                                       VARCHAR2(500)
    CONTACT_PERSON                                     VARCHAR2(100)
    DELIVERY_ADDRESS                                   VARCHAR2(300)
    SHOWROOM_ADDRESS                                   VARCHAR2(300)
    INVOICE_ADDRESS                                    VARCHAR2(300)SQL> desc sale_order_detail;
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
      PROD_ID                                            VARCHAR2(20)
    STYLE                                              VARCHAR2(100)
    COLOR                                              VARCHAR2(20)
    XS                                                 NUMBER
    S                                                  NUMBER
    M                                                  NUMBER
    L                                                  NUMBER
    XL                                                 NUMBER
    PCS                                                NUMBER
    TOTAL_QTY                                          NUMBER
    and second FORM IS based on these table s
    SQL> DESC DELIVERY_MASTER;
    Name                                      Null?    Type
    ID                                                 NUMBER
    SALE_ORDER_NO                                      VARCHAR2(50)
    SEASON                                             VARCHAR2(30)
    CUSTOMER_NAME                                      VARCHAR2(300)
    DELIVERY_NOTE_DATE                                 DATE
    DISPATCH_DATE                                      DATE
    CUSTOMER_ADDRESS                                   VARCHAR2(300)
    DELIVERY_ADDRESS                                   VARCHAR2(300)
    ACCOUNTS_ADDRESS                                   VARCHAR2(300)
    CONTACT_INFORMATION                                VARCHAR2(300)
    PAYMENT_TERMS                                      VARCHAR2(300)
    SHIPPING_TERMS                                     VARCHAR2(300)
    DEL_PERIOD                                         VARCHAR2(100)
    SHIPPER                                            VARCHAR2(100)
    WEIGHT                                             VARCHAR2(100)
    DIMENTIONS                                         VARCHAR2(100)
    NUM_OF_CARTONS                                     VARCHAR2(100)
    COMMNETS                                           VARCHAR2(300)
    CURRENCY                                           VARCHAR2(15)
    SQL> desc delivery_detail;
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
      PROD_ID                                            VARCHAR2(100)
    PROD_NAME                                          VARCHAR2(300)
    PRODUCT_COLOR                                      VARCHAR2(100)
    XS                                                 NUMBER
    S                                                  NUMBER
    M                                                  NUMBER
    L                                                  NUMBER
    XL                                                 NUMBER
    PCS                                                NUMBER
    TOTAL                                              NUMBERBOTH THE FORM ARE master and detail block the data of master bl;ock ic copyied but the data of detail block did't copy.
    Thanks ANd Regards
    Vikas Singhal
    Edited by: vikas singhal on Jul 16, 2009 3:08 PM

  • Master-detatil - copy value from

    Hello.
    I have a problem with master-detail relationship. I have one block with hidden item (item is id - id is generated with the sequence). In the second block i have one item (not hidden) which is connected (relationship) to the id from the first block. After i commit the record in the first block i want to see (immediately after commit)the value of the id from the first block in the item from the second block. I have relationship and copy value from but it doesn't work. I checked my other forms where that works and i don't see any differences. Thanks

    Hi!
    First block is Master, Second is Detail. It's TRUE?
    If it is true:
    Create PRE-INSERT trigger (Master block level)
    select <sequence_name>.nextval, <sequence_name>.currval
    into <Master_block>.<ID>, <Detail_Block>.<ID>
    from dual;

  • Copy Value from Item in Property Palette

    I have created a button on my form so that the user can clear the form and requery another record. In this 'when_button_pressed' trigger, I have a go_block(block_1), then a clear_block(no_validate) and so on for each of the three blocks. I am finding that items that have the Copy value from item property set to copy information from the control block, those items don't clear, therefore, causing the requery to work improperly. I have tried to copy data down to the other blocks in other triggers and using the clear_form but for some reason the clear_form(no_commit) takes me out of the form completely.
    I have run this problem through metalink and they were able to get the problem to recreate and said it must have something to do with the Copy Value from Item property but cannot explain. Has anyone ran into this problem and have found they found an answer when using the copy value property?
    Any help would be appreciated.
    Thanks,
    Toni Kueffer

    Ali,
    If I understand your question properly, you want to denormalize an attribute from a master table into a detail table, correct? If so, I'd do that in the model layer, not in the UI.
    If you share what you are using at the model layer in terms of technology, perhaps someone can be able to show you how.
    John

  • Copy values from a filed to another in different blocks in same table

    Hi All,
    How to copy value from a filed to another field in different blocks in same form ?
    example if i change value in Field A of block 1 it should reflect in Field B block 2 and again if i change in Field B block 2 it should reflect in Field A of block 1.
    values will change twice or thrice then it will not change. It is happening like that.
    how to do this ?
    Regards

    Same table / different blocks
    I guess, both blocks will be marked for update, and when your user presses commit, the same table will be updated twice!
    Are you sure that this is what you want to do? Is the same record current in both blocks? If so, you better use 1 block (it can be spread over several canvases and windows) and synchronize the items with the "synchronize item" property.
    Anyway: If you can't apply the synchronize-property bcos the items are in different blocks, you can synchronize with 2 when-validate-item triggers.
    Wolfram

  • Copying value from one cursor to another

    Hi,
    I have a problem while copying values from one cursor to another cursor.
    The code looks like below.
    PROCEDURE XYZ
                TransactionResultSet OUT NOCOPY types.ref_cursor,
    IS
                temp_cursor types.ref_cursor;
                wip_rec types.ref_cursor;
    BEGIN
    DECLARE
                    CURSOR temp_cursor IS
                SELECT ...........
    END;
    BEGIN     
        FOR wip_rec IN temp_cursor
        LOOP
        update tinsagr set something
        where {the condition}
            IF SQL%ROWCOUNT = 0 THEN
      dbms_output.put_line('this is test ');
            Fetch wip_rec into TransactionResultSet;
         END IF;
       END LOOP;so basically i want to iterate the "temp_cursor" and depending on the values i get it from here i shall update a table. Actually i want to exclude few records from "temp_cursor" and add it/copy rest of the records to "TransactionResultSet"
    That means say initially " temp_cursor" has 100 records and i updated 5 records in a table and same number of records should be excluded and rest should be added to the output cursor TransactionResultSet.
    How do i achieve it?
    while saving i am getting
    (1): PLS-00456: item 'WIP_REC' is not a cursor.
    Do any one has any idea what to do in such scenario?

    There are options like....
    SQL> CREATE OR REPLACE TYPE emp_obj AS OBJECT (ename VARCHAR2(50), dept NUMBER);
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE emp_tbl IS TABLE OF emp_obj;
      2  /
    Type created.
    SQL> set serverou on
    SP2-0158: unknown SET option "serverou"
    SQL> set serverout on
    SQL> DECLARE
      2    rc      sys_refcursor;
      3    v_ename emp.ename%TYPE;
      4    v_dept  emp.deptno%TYPE;
      5    ---End Of Local Varriable Declaration
      6    --Procedire declaration !
      7    PROCEDURE TEST_CUR(pi_out_ref_cur IN OUT sys_refcursor) IS
      8      emp_rec emp_tbl;
      9    BEGIN
    10      /* This BULK COLLECT can be done with explicit cursor,Ref Cursor
    11      with some simple modification, Here I have used implicit cursor! */
    12      SELECT emp_obj(ename, deptno) --Casting as the object
    13      BULK COLLECT
    14        INTO emp_rec
    15        FROM emp
    16       WHERE deptno = 10;
    17   
    18      dbms_output.put_line('Records selected are:');
    19      FOR i in 1 .. emp_rec.COUNT LOOP
    20        dbms_output.put_line(emp_rec(i).ename || '--' || emp_rec(i).dept);
    21      END LOOP;
    22      --Now we are filtering the record and may be doing some operation with each record.
    23      FOR i in 1 .. emp_rec.COUNT LOOP
    24        IF emp_rec(i).ename = 'KING' THEN
    25          --You can change this IF according to your need.
    26          emp_rec.DELETE(i);
    27        END IF;
    28      END LOOP;
    29      OPEN pi_out_ref_cur FOR
    30        SELECT * FROM TABLE(emp_rec); --Using the TYPE AS table.
    31    END TEST_CUR;
    32    /* Main execution or procedure calling section*/
    33  BEGIN
    34    --Actual calling
    35    TEST_CUR(rc);
    36    dbms_output.new_line;
    37    dbms_output.put_line('Now in Ref Cursor');
    38    dbms_output.put_line('****************');
    39    LOOP
    40      FETCH rc
    41        INTO v_ename, v_dept;
    42      dbms_output.put_line(v_ename || '--' || v_dept);
    43      EXIT WHEN rc%NOTFOUND;
    44    END LOOP;
    45 
    46  END;
    47  /
    Records selected are:
    CLARK--10
    KING--10
    MILLER--10
    Now in Ref Cursor
    CLARK--10
    MILLER--10
    MILLER--10
    PL/SQL procedure successfully completed.
    SQL>

  • Copy values from model node to another model node with different structure

    Hi,
    I am getting detils from RFC1 and update some of the data into another RFC2.
    the first RFC1 having the strucutre
    context
    NodeName
    nodel
    arrtibutes
    the second RFC2 having the different strucutre
    context
    NodeName1
          | nodel2
               | arrtibutes2
               | arrtibutes3
          | nodel5
               | arrtibutes4
               | arrtibutes5
    I need to copy the values from first one to second one.
    Both are different structures.
    Can any one tel me how to do it.
    Thanks
    Ravi

    Hi,
    Create 1 custom controllers for each Model.
    1.Cust COntroller1:
            Node one.
            ->Attr1(type:String)
            ->Attr2(type:long)
    2.Cust COntroller2
            Node one.
            ->Attr1(type:String)
            ->Attr2(type:long)
    Through the component controller only u can send the data by mapping.
    In component controller:
      Node one.
            ->Attr1(type:String)
            ->Attr2(type:long)
    Step1:Map the elements from custControler1.
    Before mapping make sure that u have data in CustController Context=>value node.
    (Note:cust controler node s model node means copy the elements to value node using copyservice)
    step2:Go to cust controller2 goto value node and map it.
    if ur nt getting,Plz let me knw,
    Thanxs,
    Lavanya.G

  • Copy values from one Parent node to other Parent Node

    Hi all,
    I have a 2 Parent node each having 3 child nodes. I want to copy the values of all the attributes of all the child nodes of one Parent Node to corresponding other node.
    Both the Parent Nodes as well as their Child Nodes have different name but their attributes have same name.For ex:
    Parent Node -A
    Child Nodes - a, b,c
    Child Node "a" has attributes "x" and "y"
    Parent Node -B
    Child Nodes - d,e,f
    Child Node "d" has attributes "x" and "y" .
    Now I want to copy the values od attributes "x" and "y" from one Parent Node to other Parent node.
    Please help me out.
    Helpful answers will be rewarded.
    Thanxs in advance...

    Hi Jin,
    To use copy service API, u need to satisfy 2 condition for the attributes of source node and target node:
    1. The name of the attribute should be same (including the case of the name)- Abc is different from ABC
    2. Type of the attribute should also be the same.
    copy elements works for copying values from Model node to context and does not work vice-versa. To enable the copying of context node to model node, use copycorresponding API.
    Eg:
    int contextNodeSize = wdContext().node<contextNodeName>().size();
    for(int i = 0; i < contextNodeSize; i++)
         <modelNodeName> modelObject = new <modelNodeName>();
         <contextNodeName>Element contextObject = wdContext().node<contextNodeName>().get<contextNodeName>ElementAt(i);
         WDCopyService.copyCorresponding(contextObject, modelObject);
    This will copy the values from Context Node to Model Node.
    Hope this helps you.
    Regards,
    Poojith MV

  • Copy value from item - disabling

    Hello all,
    How can I programatically disable 'copy value from item' property of a text item.Pls help....
    With regards
    Jeneesh.

    very easy : Don't use it
    You have to create your own functionality in this case.
    e.g. for QUERY use a PRE-QUERY, where you fill the item in the same way like the "copy value from item"
    when INSERTING use the PRE-INSERT, and so on...
    why did you have to disable the "copy value ..." ?

  • When my husband and I first bought our iPhones, I was the only one with an Apple ID (since he never used iTunes). He used my apple id to get apps. Now he has his own ID, but my account keeps popping up on his phone. How can we change the ID on his phone?

    When my husband and I first bought our iPhones, I was the only one with an Apple ID (since he never used iTunes). He used my apple id to get apps. Now he has his own ID, but my apple ID email address keeps popping up on his phone when he tries to download an app. We do not want to have all of the same apps on our phones. How can we change the ID on his phone? I already tried going to Settings>iTunes &App Store> and changing the Apple ID to his account email and that did not solve the problem. To make things worse, I recently changed my Apple ID email address (without getting a new ID) and I do not remember my old password (and this is the address that is popping up on his phone). He does not have any music on his phone and all of the Apps that he has are free.  Any help you could offer would be great (-:

    All apps are forever tied to the Apple ID that bought them. To stop your id from popping up, you need to delete the apps on his phone, and then repurchase them under his account.

  • I am trying to send a friend a group email list from Contact.  When it arrives there is only one contact in it.  There should be 30!  Any ideas?

    I am trying to send a friend a group email list from Contact.  When it arrives there is only one contact in it.  There should be 30!  Any ideas?

    The procedure for exporting a group is to right-click (or Control-click) on the group in Contacts and select Export Group vCard, then email the resulting file to your friend. Is that what you're doing? If not, give that a try.  You can confirm the contents of the file by doing a Quick Look on the file.
    Hope this helps.

  • INSERT of two records into different tables (pk value from first to second)

    Hi there!
    Have probably stupid question
    Need to insert one record into table with primary key and then insert into other table record with value of primary key field from first record
    How can I do it?
    Thanks a lot!!!

    You have several possibilities. Most easiest one is listed first :)
    SQL> create table a (a number);
    Table created.
    SQL> alter table a add constraint a_pk primary key (a);
    Table altered.
    SQL> create table b (a number);
    Table created.
    SQL> alter table b add constraint  b_a_fk foreign key (a) references a(a);
    Table altered.
    SQL> insert into a values (0);
    1 row created.
    SQL> insert into b values (0);
    1 row created.Though that may not help always, so the next possibility maybe just using sequence with nextval and currval (currval can be used only in the same session and only after you have issued at least one nextval)
    SQL> create sequence a_seq;
    Sequence created.
    SQL>  insert into a values (a_seq.nextval);
    1 row created.
    SQL> insert into b values (a_seq.currval);
    1 row created.And you can use also famous returning clause. It is a bit easier to show that in the pl/sql block than pure SQL.
    SQL> declare
      2   v number;
      3  begin
      4   insert into a values (a_seq.nextval) returning a into v;
      5   insert into b values (v);
      6  end;
      7  /
    PL/SQL procedure successfully completed.And at last contents of the tables :)
    SQL> select * from b;
             A
             0
             1
             2
    SQL> select * from a;
             A
             0
             1
             2Gints Plivna
    http://www.gplivna.eu

  • Copy value from one field in subform, to another field in a different subform

    Hi all.  I have been back and forth with enterprise support, and they are telling me what I want to do is impossible.  I find that hard to agree with, so hoping I can get some help here.  I have a document that I am creating, based off an XML.  The page consists of a header subform, a flowing table of variable name, and then a footer.  My problem comes in, that when the table flows to mutliple pages, my header subform will not repeat, even though I have it set as the overflow header.  According to Enterprise Support, this is by design.  The header will repeat on the footer page, if that is on a separate page, just not when the table flows to another page.  So, I came up with a solution to create an additional Header in my table, merge all the cells into one column, and copy my subform into that new header.  I would set that header to appear only on subsequent pages.  So, when I preview my document, it shows the static text fine, as I would expect, however the text fields are blank.  I need a way of copying the values from the original header subform, into the newly created table header subform.  The values will be different based on teh XML input, meaning that the first 3 pages will have one set of values, and the next 3 another, etc..  See sample below...
    <NameValueList>
         <NameValue>
              <NameValueName>Name1<NameValueName>
              <NameValueDesc>Desc1<NameValueDesc>
               <TableValueList>
                   <TableValue>
                        Blah
                   </TableValue>
                   <TableValue>
                        Blah 2
                   </TableValue>
              </TableValueList>
         </NameValue>
         <NameValue>
              <NameValueName>Name2</NameValueName>
              <NameValueDesc>Desc2<NameValueDesc>
              <TableValueList>
                   <TableValue>
                        Blah 5
                   </TableValue>
                   <TableValue>
                        Blah 6
                   </TableValue>
              </TableValueList>
         </NameValue>
    </NameValueList>
    So, if I bind my original header to NameValueName, it will show on the first page which has my header, and the third page that has my footer.  But my 2nd page, that has the table flowed to it, has a blank value.  I tried to put code in the Initialize event of both text boxes, to copy from MainHeader.NameValueName to TableHeader.NameValueName, but that didn't work properly. 
    Any ideas on how to do this?

    Thank you very much for the reply.  I tried putting the copy statement in both the MainHeader and TableHeader initialize events.  There was different behavior, depending on the place I put the copy statement, however neither was correct.  If I put it in the initialize of the TableHeader, the NameValueName that appears on other page is Name1.  Even though the header shows Name2 when it hits the next nodes.  If I put it in the initialize of MainHeader, nothing is copied on the proper table header pages.
    I initially had Master pages, however that really didn't work.  The master pages traversed the NameValueName nodes on it's own loop.  So, Each page displayed the next value in it's own loop, when the main subform loop is still showing data from the previous value.  I know this might be hard to understand, but I'm doing my best to explain.  THanks again for your reply, and I hope that there is another idea out there to fix this...

  • How to copy value from one field to another in a Apex Form

    Hello guys,
    There are 2 addresses one is shipping and other is billing. I do not want the customer to re-enter all the details if it is the same address. So based upon an action, it should take the live values from one address field and populate the other address field. I know in JS you can do it, but how to implement that in Apex?
    I guess using Dynamic Actions to achieve this in Version 4 but do not know how. Read quite some info but no luck.
    Thanks in advance!

    Hi,
    I have assumed that you have your shipping address at the top of the page, and then further down the page you have your billing address that you want to enable the users to copy (if this is in reverese, you will need to switch the js variables in the code following).
    I would create a Select List item above the 'Billing Address' details, called PX_SAME_ADDRESSThis select list would be static, with the options Null.
    I also assume you would have pairs of address page items such as:
    PX_SHIPPING_ADDRESS_L1
    PX_BILLING_ADDRESS_L1
    PX_SHIPPING_ADDRESS_L2
    PX_BILLING_ADDRESS_L2
    PX_SHIPPING_POST_CODE
    PX_BILLING_POST_CODEThen copy the following code into the HTML Header of the page definition:
    <script language="JavaScript" type="text/javascript">
    function copyAddress()
       if( $x('PX_SAME_ADDRESS').value == 'YES')
         $x('PX_BILLING_ADDRESS_L1').value = $x('PX_SHIPPING_ADDRESS_L1').value;
         $x('PX_BILLING_ADDRESS_L2').value = $x('PX_SHIPPING_ADDRESS_L2').value;
         $x('PX_BILLING_POST_CODE').value = $x('PX_SHIPPING_POST_CODE').value;
       else //Clear Address Fields
         $x('PX_BILLING_ADDRESS_L1').value = " ";
         $x('PX_BILLING_ADDRESS_L2').value = " ";
         $x('PX_BILLING_POST_CODE').value = " ";
    </script>Then, in your PX_SAME_ADDRESS item, copy the code below into the Element > HTML Form Element Attributes field.
    onChange="copyAddress();"Hopefully this works for you too, and should give you some basis to play around with.
    Amanda.

  • Copy value from Preceding doc to follow up during creation

    HI All,
    Requirement is :
    Service order is created as follow up document to the interaction record. During follow up document creation two fields 'Summary' and 'Priority' need to be copied to the Service order from the Interaction record. Hence when the follow up document is created before SAVE is done these values are to be copied/visible there. Also these fields are to be editable as well.
    Problem:
    Though i could get the values of these fields i could not set them using 'set_property_as_string' method to the service order as the entity created was having null attribute reference. Kindly let me know how then i may copy these values?
    Looking forward for your support.
    Regards,
    Harish

    Hi,
    i am also required same functionality.
    Could you please provide the solution to sorted out this problem.
    Regards,
    Babu

Maybe you are looking for