Forum Discussion

SarahWallis's avatar
SarahWallis
Qrew Trainee
9 years ago

How to Copy Record and Copy Children

My QB has a table of "Invoices". Each month the users "copy" the invoice for the new month. Most fields stay the same, including a list of children "Lines". When they copy an invoice, the child lines are not also copied. Why is this?

As per many-to-many rules, I created a "hidden" Invoice-to-Line table that is just the "Related Invoice" and "Related Line" (and the fields in the relationship). I guess I need to have QB create new entries in Invoice-to-Line when an Invoice is copied, with all of the Lines connected to the new Invoice.

Is this possible? (An Invoice can have up to 200 Lines, so this is a requirement for the users.) How do I implement this?

Thanks in advance!

    • SarahWallis's avatar
      SarahWallis
      Qrew Trainee

      Thanks for the quick response!

      It looks like it's easy to have 1 (or a handful) or "Master" rows/entities, which are "Templates" for new rows. Based off the link and video you sent, this doesn't quiet meet my needs.

      1) "Invoice" is not in my list of possible "Copy Master & Detail Records". My guess is b/c it is dependent on a "Header Invoice".

      2) There are going to be thousands of invoices that need to be copied each month. And each invoice has its own set of lines. I cannot create 3k "import lines from xyz invoice". Also, it needs to be dynamic.

           A) The users will add new Invoices.

           B) Today an Invoice might have 5 Lines, but 6 months from now they might add a new line and so the Invoice will now have 6 or 10 Lines. Thus, each Invoice needs to be able to pass its attached Lines to the new copy.

      Does this make sense?

    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      When you create the button using the Wizard, it asks you if you want to copy the parent too.
    • SarahWallis's avatar
      SarahWallis
      Qrew Trainee

      Could you provide a little more detail? I'm not sure what you mean.

  • When you go into the CopyMasterDetail "wizard" it will ask you how you want to set it up.  You can either set it up so that you "copy" the record you're on and all the children from its relationships or you can set it so that it will copy a "specific" parent's child records.

    In your case, I imagine that you will want to "copy" your Invoice from one month to the next with all the children in tow; and then just modify the Invoice details (like the Invoice # for example).

    When you finish setting this up, QuickBase will create a button for you in your table (you get to name it as part of the setup).  You then put this on your Invoices so you can copy them when you want to.  If you choose "this" setup; I recommend also creating a dedicate text-field in your Invoices table called [Copy].  So when the feature copies your invoice and line items; that the "Copy of" text can go directly into this field instead of a valid-data field which it would otherwise do.

    If you then need some kind of "dynamic" Invoice Numbering method; you will need this to work from some kind of formula which probably would reference/include the Date somehow and the Record ID# of the Invoice that gets created.

    This is actually the perfect native solution for your needs; if you need help working through it in your App, I'm sure that Matthew, Mark or myself can help - I see that you were having trouble finding your Invoices table in the drop down.
    • SarahWallis's avatar
      SarahWallis
      Qrew Trainee

      Thank you. That might all work if I can find Invoices in this list.

      It looks like your screen shot is different than mine. How did you navigate to that view? I navigated via: Home -> Settings -> App management. -> Copy master & detail records. Attached is what I see, which is different than what you've attached. Any ideas?

       


    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      It seems bizarre that your invoices table is not listed as a choice.  So you are saying that is not a choice on that drop down list.

      There is a way to make the same button using the API but I don't understand why invoices is not a choice for you
    • SarahWallis's avatar
      SarahWallis
      Qrew Trainee
      Correct - it is not in that list. Only 13 of my 16 tables are displayed as options. Could this be b/c Invoices are children of Invoice Header (which is listed).
  • Hi all - I wanted to update this post now that I've found the problem. (Actually it was a co-worker of mine who figured it out.) My "Invoices" table was not showing up in the list because it had a conditional relationship with Invoice-to-Line. I was attempting to limit the Lines you could connect to an Invoice based on a shared field, and thus created the condition. By removing the condition, Invoices appeared in the CopyMasterDetail and now my "copy invoice" button works great.

    Thanks for all your help!

    • SarahWallis's avatar
      SarahWallis
      Qrew Trainee
      I don't see how to mark an solution as the answer...
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      Thx for posting that response. It's a terrible limitation that I have run up against with CDDs preventing Copy Master Detail from working.

      Alas, this version of the Forum has no way to mark a Question Answered other than by the moderator.
  • I am trying to create a copy button on a table called Actions, but like Sarah above, it is not listed as as a table option in App Management. What can I do to get the table to show up, so that I can copy action items?

    Once that problem is solved, is there a way to put the button in grid edit? We need to create the same action item on multiple projects. We will just need to change the project name for each action.