Forum Discussion

AndreaAndrea's avatar
AndreaAndrea
Qrew Trainee
9 years ago

How do I link to a specific form on the child record from the embedded report on the parent record?

I have two tables: Products (parent) and Inventory Adjustments (child). Inventory adjustments has multiple forms used for different purposes instead of having one main default form. How do I get the embedded report to link to a particular form when viewing or editing?

Here's an example of the above:

I've created two inventory adjustments. "Order" and "Sale." Both appear on the embedded report on the products table. When I click on "order" I want it to take me to the "order" form. When I click on "sale" I want it to take me to the "sale" form.

Is this possible?

4 Replies

  • yes, its possible.

    Make your own URL button to display the correct form and suppress the native view button.

    The formula for the URL button would be like

    var text FormID = IF( = "Sale", "2","10");

    urlroot() & "db/" & dbid() &"?a=dr&rid=" & ToText(Record ID#]) & "&dfid=" & $FormID

    In the example above, the formula variable is identifying the type of transaction and you will get the form ID# by looking at the form tab in settings for the table to see the form ID#.



    I suggest labeling the button "View" and not showing it as a button.

    If you also need an edit button, then make a duplicate of that field but change the a=dr (action = display record) instead to a=er (action = edit record)

    To suppress the existing View and Edit buttons and use your own buttons instead, you will need to go into your Parent form, and look for the blue link to the report you have used for the embedded report- click though that to get to the report and edit it to add in your two new buttons as the first two columns and at the bottom uncheck the allow users to View and allow users to Edit, as you will instead be adding those two fields you just made as the first two columns of the report.
    • JimHarrison's avatar
      JimHarrison
      Qrew Champion
      One correction and one enhancement.
      Code is missing a bracket at ToText([Record ID#])
      Also to return to the originating record after clicking Save & Close instead of the default form include the last part below. 
      URLRoot() & "db/" & Dbid() &"?a=er&rid=" & ToText([Record ID#]) & "&dfid=x"& "&z=" & Rurl()

      Oh and thanks this is awesome!
    • JimHarrison's avatar
      JimHarrison
      Qrew Champion
      Also suggest opening the View button in new window. View doesn't know how to go back to the originating form - there's no Save & Close. A User is more apt to close a window if its a pop-up but not foolproof.

      Additionally if the User edits the record from the View button pop-up, Close & Save takes User back to Default form, which is weird. What we really want is the form to maintain its dfid throughout the process. 
       
      A workaround: make the View button display a form that is not editable.