Discussions

 View Only
  • 1.  Button to export CSV from parent record

    Posted 09-15-2017 15:54
    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.


  • 2.  RE: Button to export CSV from parent record

    Posted 09-15-2017 15:56
    Low tech is to use the "More .." button on the blue bar at the top of the embedded child table.


  • 3.  RE: Button to export CSV from parent record

    Posted 09-15-2017 15:59
    True, but I'm trying to make it idiot-proof for my users. A big button that screams CLICK ME TO DOWNLOAD goes far.


  • 4.  RE: Button to export CSV from parent record

    Posted 09-15-2017 16:07
    I am sorry, but I can totally relate to this pain.


  • 5.  RE: Button to export CSV from parent record

    Posted 09-15-2017 16:18
    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.


  • 6.  RE: Button to export CSV from parent record

    Posted 09-15-2017 18:07
    Perfect! Thanks!