Alpha Video Training
Results 1 to 4 of 4

Thread: duplicate linked grids with in the linked grid

  1. #1
    Member
    Real Name
    George Iosifelis
    Join Date
    Jan 2010
    Posts
    34

    Default duplicate linked grids with in the linked grid

    Is there any way to duplicate a linked grid and with it all the records linked to it?

    ie in the following linked grid structure:

    grid1
    linked grid2

    I can create another record in the linked grid and have the following:

    grid1
    linked grid2
    linked grid3

    in the following linked grids

    grid1
    linked grid2
    linked grid2.1
    linked grid2.2

    Is there any way to duplicate "linked grid2" and also "linked grid2.1" & "linked grid 2.2"

    grid1
    linked grid2
    linked grid2.1
    linked grid2.2
    linked grid3
    linked grid2.1
    linked grid2.2


    To give a practical example it is like duplicating an order that is linked to a client (with it's linked order-items) and assigning a new client to the new duplicated order, therefore you don't have to re-enter the order-items again, but still have the ability to change the order for each client.

    Does that make sense?

    What is the most efficient way to go about it?

  2. #2
    "Certified" Alphaholic
    Real Name
    Scott
    Join Date
    Mar 2010
    Location
    Toronto,ON
    Posts
    1,031

    Default Re: duplicate linked grids with in the linked grid

    -Client Grid
    Order Grid
    ButtonField(Duplicate Order Button - Pops up dupord.a5w)


    Code dupord.a5w to accept an order id:
    dupord.a5w?ord=123910231203

    dupord.a5w would have a dropdown so you can select a client
    and a "Duplicate Order" button. Clicking "Duplicate Order" would create records under whatever client id they chose in the dropdown.

    what you're trying to do is pretty complicated.
    based on prior work - i think this is your best bet.

    Your other option is a duplicate order page with:

    Order ID (Textbox - Lookup Grid Component)
    New Customer (Dropdown or Lookup)
    Scott Moniz - Computer Programmer/Analyst
    REA Inc.
    http://reainc.net
    (416)-533-3777
    scott@reainc.net

    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
    contact us to discuss options.

  3. #3
    Member
    Real Name
    George Iosifelis
    Join Date
    Jan 2010
    Posts
    34

    Default Re: duplicate linked grids with in the linked grid

    Thank you for your response.

    If I do that, it only duplicates the order page. It doesn't duplicate all the order_items that are linked to the order page.

    If you think of a desktop application, I need to duplicate a set, not just a record in the grid.

    any ideas?

  4. #4
    "Certified" Alphaholic
    Real Name
    Scott
    Join Date
    Mar 2010
    Location
    Toronto,ON
    Posts
    1,031

    Default Re: duplicate linked grids with in the linked grid

    In my scenario - you would have to write transactional sql code to insert the order record, then insert the other.

    'start transaction
    INSERT INTO order (fields) SELECT * FROM order WHERE order_id=:order_to_duplicate

    'execute

    new_order_id=lastinsertedidentity

    INSERT INTO order_items (fields) SELECT new_order_id, order_items.other_fields FROM order_items WHERE ord_id=:order_to_duplicate

    'on error, rollback transaction
    'else commit transaction
    'on commit error, rollback transaction

    It would be something along those lines - that is all pseudo code, not a copy paste solution - you will have to take a look.

    The reason for the transaction is that - if it cant insert an order - you dont want to insert order items. If it inserts an order but cant insert order items - you want to rollback the transaction (to get rid of the inserted order)
    Scott Moniz - Computer Programmer/Analyst
    REA Inc.
    http://reainc.net
    (416)-533-3777
    scott@reainc.net

    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
    contact us to discuss options.

Similar Threads

  1. Linked Grids and Reports
    By pvin2011 in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 03-08-2011, 03:44 AM
  2. Linked Grid -delay in refreshing data in child grids
    By jsuresh in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 01-21-2011, 03:50 PM
  3. Security for Linked Grids
    By lgrupido in forum Archived Wishlist
    Replies: 0
    Last Post: 11-01-2010, 01:21 PM
  4. Refreshing linked grids
    By lgrupido in forum Application Server Version 10 - Web/Browser Applications
    Replies: 7
    Last Post: 07-06-2010, 07:24 PM
  5. Linked Grids that are conditionally displayed based on a filtered grid.
    By Editor in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 01-31-2010, 07:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •