Creating a conditional copyMasterDetail button.

  • 0
  • 1
  • Question
  • Updated 4 years ago
  • Answered

Here is the current working formula:

"javascript:void(copyMasterDetailButtonHandler('&relfids=XX&sourceRID=" & [Template] & "&destrid=" & [Record ID#] & "', 'XXXXXXXX'))"

It's copying the details correctly but I want to take it a step further. I want it only to create those details IF a checkbox field is true.

Any ideas? Thanks!

Photo of NP

NP

  • 10 Points

Posted 4 years ago

  • 0
  • 1
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
Ok, so I originally answered based on the assumption you were looking to have a checkbox drive if the button would function at all, rather than a checkbox determining which child records would be copied.

IF you need my first answer, here's that:

Making the change to the formula you mentioned should be a pretty straightforward change. I'd suggest something like this:

IF([checkbox],"javascript:void(copyMasterDetailButtonHandler('&relfids=XX&sourceRID=" & [Template] & "&destrid=" & [Record ID#] & "', 'XXXXXXXX'))","")



By using the IF statement:

IF(Criteria,Do This,Else Do This)

you can use "" in the ELSE section to denote a Null value. When the formula is evaluated by QuickBase and the result is Null, the button is not generated. Essentially, it keeps the button from being used, no matter what form or report the field is used on!

Now, if you're looking to have a checkbox drive which child records should be copied, unfortunately the Copy Master/Detail process can't accommodate this. Fortunately, however, there IS a solution! Using a combination of formulas, the API, and saved Imports from a Table, you can setup a process that is very similar to the Copy Master/Details process, but that will allow you to identify only certain records to be copied.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 66,378 Points 50k badge 2x thumb
I'm sure NP means that he only wants to copy across child record which have a checkbox checked.
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
Mark - Reading that again, you're probably right!