Skip to main content

Linking to Forms

Quick reports allows us to create a 'custom expression' as one of the options under 'aggregation' for each field selected for output. We can use this in conjunction with a transactions id to create a hyperlink back to the transaction being displayed so users of the report can quickly get to the full details as displayed on the entry form.

To do this we first need to get the customer account and module id of the app we are reporting on. This can be done by selecting that app from the menu on the left and then viewing the URL in the browser address bar. An example of this is:

https://demo.unifiplatform.com/module/db6bc4c576b94c84bc130ce5d8dcae54?from=sidebar

The format of the URL breaks down to:

https://*<customer_account\>*.unifiplatform.com/module/*<module_id\>*?from=sidebar

So in this example, the customer account is 'demo' and the module ID is 'db6bc4c576b94c84bc130ce5d8dcae54'. You can copy and paste these into a text editor.

Now, from within your quick report add the 'id' field as an output item on your report (this is a system field present in all apps). Then from the 'Change to aggregate column' menu select 'Custom Expression'. This will insert an expression representing the field in the format <customeraccount\>.<app_id_name\>.id. So if I have a purchase invoice in the 'demo' account, expression would be:

demo.purchase_invoice.id

We can now use the SQL 'CONCAT' function to concatenate that with some HTML to create a hyperlink. The CONCAT function allows us to put fixed text and dynamic fields together by surrounding fixed text with single quote marks and using a comma to separate the values. Using the above example the formula would look something like:

CONCAT('<a href="https://demo.unifiplatform.com/item-editor/db6bc4c576b94c84bc130ce5d8dcae54/', demo.purchase_invoice.id, '/edit?from=datatable" target=_"blank">Details</a>')

You can copy and paste this into a text editor and do the following replacements:

  • Replace each instance of 'demo' with your customer account
  • Replace the long module id with the module id of the app you are reporting on
  • Replace demo.purchase_invoice.id with the custom expression you created.

You can now take the amended custom expression and paste it back into the quick reports column, replacing the existing expression. When the report is now run it should produce a clickable link to the transaction.

tip

The target="_blank" part of the above formula is HTML which instructs the web browser to open the link in a new tab rather than in the existing one. This tends to work better for quick reports as it retains the original report so users can just close the tab with the details and be taken back to the report page they were looking at to view other transactions if required.