Forum Discussion

ChrisSwirtz2's avatar
ChrisSwirtz2
Qrew Cadet
6 years ago

Modifying Report Link behavior

Currently, when clicking on a report link that has more than 1 child record, the result is the default report for the child table showing the child records allowing for grid editing. However, if there is only 1 child record available, the link takes you to the form of the record itself instead of the report view. Is there a way for the link to always go to the report view whether there is 1 or 100 child records attached?

------------------------------
Chris Swirtz
------------------------------
  • Chris,

    Instead of a Report Link  build a custom URL that will take you to the report you want.

    Create a Formula Rich Text Field and use any image that you want to display instead of text.   Build the QID in the target table using <Ask the User> for the fields that you pass into it to make the report.

    Here is a quick example where two values from your parent table are used in the report for the target:

    // Images
    var text IMG  =     "<img src=https://images.quickbase.com/si/48/045-lock.png>"

    // QID
    var text QID =
    URLRoot() & "db/" & [_DBID] & "?a=q&qid=XX&nv=2&v0=" &[VariableZero] & "&v1="&[VariableOne];

    // HTML Execute URL

     "<a href=" & $QID & "' title=\"Pseudo Report Link\">"  & $IMG &  "</a>"

    Make sure you change qid=XX to the correct value of the report you made in the target table.
    This is more powerful than a Report Link as you can build as complex a QID as you need for the business case.

    ------------------------------
    Don Larson
    Paasporter
    Westlake OH
    ------------------------------
    • ChrisSwirtz2's avatar
      ChrisSwirtz2
      Qrew Cadet
      Hello Don,

      First, thank you for your help. Unfortunately I am oblivious when it comes to coding like this so if I could trouble you walk me through this a bit. I apologize ahead of time for what will likely seem like stupid questions.

      What exactly are you referring to when you say to "change the qid=XX to the correct value of the report you made in the target table"?

      Right now the link takes the user to an embedded table when there are more than 1 child record for a given parent record. I don't necessarily want that to change. So would I use the URL for that embedded report to that the user is always sent to that embedded report when the link is clicked?  Or are you suggesting I create a new report for this to work? If the user is expected to enter further info to get the link to take them to the right report then I am thinking the user's won't like that.

      ------------------------------
      Chris Swirtz
      ------------------------------
      • DonLarson's avatar
        DonLarson
        Qrew Elite
        Chris,

        That is a query ID.   Here is a screen shot of a report and the filter:



        The first arrow is point to the QID.  The value is 5.  Every report that you make in table is assigned a value by Quick Base.  

        Going back to the URL in your formula you substitute the ID of the report so that your button knows where to go

        // QID
        var text QID =
        URLRoot() & "db/" & [_DBID] & "?a=q&qid=XX&nv=2&v0=" &[VariableZero] & "&v1="&[VariableOne];

        Assuming you were trying to get to the report above you would also convert to

        // QID
        var text QID =
        URLRoot() & "db/" & [_Parent] & "?a=q&qid=5&nv=1&v0=" &[Name];

        You just told it to open
        • QID 5 in
        • table Parent and
        • use the value in the field Name for the <ask the user>  variable.

        Your original question was clicking a report link.

        Here is screen shot of a report with custom report link

        It does not matter if there is one or a thousand child records.  Clicking on the link will take you to the report that shows the records.

        If you are in a form for a record, you want to display the regular embedded report.  



        ------------------------------
        Don Larson
        Paasporter
        Westlake OH
        ------------------------------