Forum Discussion

AndrewFry's avatar
AndrewFry
Qrew Assistant Captain
6 years ago

Button in Embedded Report

Is it possible to have a functioning button in an embedded report? One per row/record.

Due to circumstances, I have an embedded report that facilitates mass input of data.

But for things to work, I need a button for each row/record that will allow me to generate the record prior to inputting the data.

It is the only workaround that I have conceived that will still allow me to keep intact my process flow.


Thoughts?


------------------------------
Andrew
andrew.fry25@gmail.com
------------------------------
  • You can definitely have a formula URL button on an embedded report.  But it's Still unclear from your post as to what the button is supposed to do.

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    markshnier2@gmail.com
    ------------------------------
    • AndrewFry's avatar
      AndrewFry
      Qrew Assistant Captain
      Thanks for the response Mark.

      So I have the Assignments table, and included a Formula URL as a field.
      I gave the field some code, had it appear as a button, and had the button colored.
      The button shows up in the Report of that table, as well as in the form of that table.

      However, when I have the report embedded in the form of another table, the column for the button field is present, but no button is visible.
      When I click on the cell for the button, nothing happens, and when I double click it states:

      The field is a formula field and is not editable in the embedded report.

      That leads me to believe that I can't have the button be usable in an embedded report.

      ---------------------------------------------

      As I was typing the above, I had a thought of how I could possibly achieve what I need.
      I wanted to have a button in each row of the embedded report. So that when I click that button it generates a new record for the row and allows me to input the associated data. I need to have the record generated before I input data into the record because I have to bring down some data from grandparents and parents. I have a field that is conditional based upon that data from the Grandparent/Parent.

      However, after giving it some thought, I think that the better way to do it would be to have a single button, like the "Add Record" button, in the form.
      But it would need to be customized to do what I need/want.

      Normally, the add record button will take me to the child record form where I can input the data, then save/close. It then takes me back to the parent form.
      I believe that the customized button would need to generate a child record, save/close, and take me back to the parent record immediately. I shouldn't even see the child record form.

      I think that this would give me the same result.

      Thoughts?

      ------------------------------
      Andrew
      andrew.fry25@gmail.com
      ------------------------------
  • EricMohlman's avatar
    EricMohlman
    Quickbase Staff
    Andrew,

    Yes, it's possible to have a button within an embedded report and it would behave the way you want it to, but from your description it appears that you've turned on the "editable" setting for your report. With that in place, the button won't be accessible unfortunately.

    You found the other option I was going to suggest, and that's to place a button to create a child record on the parent form and this should behave the way you want it to. It seems like you're comfortable with setting this up already, but if you want a useful working example, I covered an API_EditRecord version (instead of API_AddRecord like you would need) during our Empower user conference in June. For a recording of the session, please go here.

    Eric

    ------------------------------
    Eric Mohlman
    ------------------------------
    • AndrewFry's avatar
      AndrewFry
      Qrew Assistant Captain
      Eric,

      Thanks for the response. I am still new to quickbase, so trying to learn as much as I can. Any response helps.
      So I think my solution is a few parts, and I want to be able to combine them all into one button, if possible.
      I believe I have some of it, but am still struggling with the other parts.

      Currently the user opens a new Work Order fills in any needed data, clicks the "Add Job" button, the Work Order record is saved and the user is taken to the Job form. On the job form, the user inputs information for the job, and then in the assignments editable embedded report, enters additional information. They click the Save & Close button, the Job and related assignments are saved, and the user is taken back to the parent work order in edit mode to continue if needed. That process flow is smooth and what I would like to maintain, if possible, or at least as close to that as is possible.

      Issue:
      I need to bring down a related client from the parent record (Work Orders) to the child record (Jobs). That related client also has to be brought down to the grandchild record (Assignments). All this is to allow a Contacts list in the grandchild record to be conditional based upon the related client, and show only the related contacts to that related client. The grandchild is an editable embedded report  in the child form. The Child and Grandchild being Parent and Child.

      In order to have the related client flow down from the child to the grandchild, the child record has to be generated/saved first. Then for the related client to populate in the grandchild record so that the conditional contacts list functions, the grandchild record also has to be generated/saved first too.

      It breaks the process flow to require a user to enter some data, save, go back and edit, enter some more data, save, go back and edit, and then save again.

      Solution:
      I think that I have a solution, but I am only part way there.

      My Jobs form didn't incorporate the default "Add Assignment" button because the embedded report is editable.
      However, I think that I will add it and edit the code in it.

      When clicked, I need it to do the following:

      • Generate/Save the Job form
        • This will allow the related client to be brought down to the Job, and in turn eventually to the assignment
      • Generate/save a new assignment related to the Job
        • This will allow the related client to be brought down to the assignment, and in turn allow the conditional contacts list to function properly.
      • Take me back to the Job form in edit mode so that I can continue making any changes as needed.

      One caveat is that in doing this, I need to ensure that I maintain the return path back to the Parent (Work Order) record, so that when I click on Save & Close in the Job form, it saves and then takes me back to the work order in edit mode.

      The code I have thus far is the following:

      URLRoot() & "db/" & [_DBID_ASSIGNMENTS] & "?act=API_AddRecord"
      & "&_fid_6=" & URLEncode ([Job ID#])
      & "&rdr=" & Dbid()& URLEncode("?a=er&rid="&[Job ID#])

      This is in the Job form, generates a new Assignment and keeps me in the Job form in edit mode.

      What it is lacking is saving the Job first (then doing the above), as well as maintaining the return path to the Parent record in edit mode.

      I am currently reading through the API guide to get a better understanding of the calls and syntax, as well as messing around with the "URL Formula Buttons for Dummies" app by Mark Shnier, and also wrapping my head around the "Magic Buttons - Having Fun with Formula URLs" app by Kirk Trachy.

      If you have any suggestions, thoughts, input, ideas, etc., it is very welcomed!!

      P.S. I will have to check out those Empower sessions you recommended.

      Too much to absorb, not enough time!! hahaha lol

      ------------------------------
      Andrew
      andrew.fry25@gmail.com
      ------------------------------
      • EvanWestbrook's avatar
        EvanWestbrook
        Qrew Cadet
        Andrew,

        It sounds like your tables look something like the following. Please let us know if that is not correct.


        There are a couple of ways to approach a solution from here:
        1. Code button as described
        2. Think up another way to do it

        Based on the situation you describe, you might want to check out option Number 2 with a QuickBase Automation
        Option 2: QuickBase Automation
        Automations can fire off of a "trigger" field. For your situation, you might do something like:
        1. Create a field on the "grandparent" table, "Work Order," called [Create Trigger]
        2. Make your "Edit Record" button change the "Work Order" record on which it was clicked to "true"
        3. Automation fires when record on "Work Order" changes and [Create Trigger] = "true"
        4. Automation makes child record on "Jobs" and grandchild record on "Assignment" passing down the Record ID# of the records created
        5. Automation changes [Create Trigger] = "false"

        Option 1: Code button
        Keeping in mind this seems a little complicated for the situation you describe and embedded JavaScript is not officially supported by QuickBase, you could do something like the following:

        // Define API Call for Adding Record
        var text url = URLRoot() & "db/" & [_DBID_WORK_ORDER] & "?act=API_AddRecord" & "&_fid_6=" & URLEncode ([Job ID#]));// Define a Callback to run when API call completes
        var text callback = "function(xml){destrid=$(xml).find('rid').text();newpage='" & URLRoot() & "db/" & [_DBID_JOB] & "?a=dr&rid='+destrid;window.location.href=newpage";
        
        // Define Script to execute when button is clicked
        var text script = "javascript:$.get('" & $url & "'," & $callback  & "});void(0)";
        
        $script;


        The code above executes an API call, parses the the data QuickBase returns on success, extracts a value, and redirects a user to the a different page. In theory, you could make a callback that creates the child and grandchild record. This method has been hit and miss with me.











        ------------------------------
        Evan Westbrook
        PRIME Developer
        Harder Mechanical Contractors Inc.
        Portland OR
        ------------------------------