URL variables

Passing data between screens

Oftentimes you will need to pass information between screens. This takes two main forms:

  1. Links (Link Element, Table Links)
  2. 'Navigate To' Action

A common example is opening a detailed view for a row entry, as seen in the creation of autogenerated screens

Navigate To with table row buttons

Some templates such as the Client Contact List app use row buttons instead of links.

In this case, navigation is controlled by the navigation action:

Here we are passing the row id of the client into the URL path.

In the /clients/:id details screen we will be able to make use of this row id.
A word prefixed with a colon within a route denotes a path variable.

The id is accessed using the {{ URL.id }} BindingBinding - A method for passing dynamic values into queries, form fields, elements, and more!

For example, because we only want to show the chosen client, we can add the following Filter to the clients' Data Provider

This can then be used in conjunction with a Repeater to access the fields of the filtered client:

Link navigation

If you do not need the power of actions, then links are the most convenient way to do navigation.

For a table, simply check Link table rows and select the /clients/:id details screen from the Link screen dropdown:

👍

Link magic

In this case we do not replace the :id variable with the binding.
Because it's a table row link, Budibase understands that it should automatically pass in the table row id.

Multiple variables

Whilst passing a row id is the most common use case, you can pass many variables into the URL, with each being separated by a slash, e.g. /clients/:id/:companyId/:timestamp/:customName/:etc

A detailed example can be found in this discussion.


Did this page help you?