Button to export CSV from parent record

  • 1
  • 1
  • Question
  • Updated 1 year ago
  • Answered
I'm trying to have the user click on a button in a parent record form, which will then download the detail records from a child table related to that parent, in CSV format. I know I can easily create a button that downloads a specific report to CSV using the URL of the report, but when I try this it downloads the whole report, not just the records related to the parent.

How can I accomplish this? Thanks in advance.
Photo of Michael Frishman

Michael Frishman

  • 284 Points 250 badge 2x thumb

Posted 1 year ago

  • 1
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,046 Points 50k badge 2x thumb
Low tech is to use the "More .." button on the blue bar at the top of the embedded child table.
Photo of Michael Frishman

Michael Frishman

  • 284 Points 250 badge 2x thumb
True, but I'm trying to make it idiot-proof for my users. A big button that screams CLICK ME TO DOWNLOAD goes far.
Photo of Kingsly SD Samuel

Kingsly SD Samuel

  • 776 Points 500 badge 2x thumb
I am sorry, but I can totally relate to this pain.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,046 Points 50k badge 2x thumb
Ya, its doable.
I will outline the steps and and let me  known if you need more detail.

Make an <ask the user> report on the child with your export columns.  The <ask the user> is for [Related Parent]. Set the report at the very bottom to be in CSV format.
Run the report manually and observe that it works and observe the URL - we need to mimic that URL in a button.

URL formual

urlroot() & "db/" & [_DBID_of my child table] & "?a=q&qid=xx&nv=1&v0=" & [Record ID#]

that says:
Run the report on the Child  table with the report ID =xx (which you will fill in) 
and it will have 1 question (nv = number of variables = 1) and the zeroth variable is [Record ID#]

It starts counting at zero.
(Edited)
Photo of Michael Frishman

Michael Frishman

  • 284 Points 250 badge 2x thumb
Perfect! Thanks!