Reference

The Reference is used to reference a row in your database.

Properties

Reference - This refers to the field that is used for the reference.

Visible when - This allows you to show/hide the Reference container based on certain conditions that you might want to set. However, the same result can also be achieved using Conditionals. And it is recommended to use Conditionals instead of this property, mainly because the condition is then not hidden in the properties panel, but immediately visible to someone looking at the Template Editor. This improves readability.

Illustration

Let's build upon the EMS use case from where we had left at in the page for 'Nested template'. We had built an interaction template with a Tabbar consisting of two tabs and nested templates.

Now, the project has a new requirement to add a 3rd tab called 'Employees' that would show the list of employees. And against each employee, it should show the projects that he/she is assigned to, along with the client name of the project.

For this, we would need to build a new Template Fragment called 'Employees', add a 3rd value called 'Employees' to the Concept item that corresponds to the Tabbar, and then add this Template Fragment under a new Conditional in the Template Editor.

Below is the new 'Employees' Template Fragment. The third column has a Repeater to show the project id, project name and client name of the project in a Table.

Refer the pages for Repeater and Table if you would like to familiarize yourself with the topics.

As you see, each column in the Table inside the Repeater has to be prefixed with the reference variable [Employees.Employees.EmployeeProjects.RefProj] ->. As requirements grow more complex, you will end up doing this for many more columns.

This can of course be simpified and we can get rid of using the above reference variable prefixed to each column. For that, we use the Reference widget.

  1. In the last column, add a Repeater for 'Employee Projects' datalist.

  2. Click on the 'Reference' icon and drag it to the canvas inside the Repeater. This would prompt you to select a reference field.

    Alternately, drag and drop the reference variable on to the canvas, wherever needed.

Reference container is added.

3. Add a Table inside the widget and add fields from the 'Projects' table. This time, you do not have to prefix each field with [Employees.Employees.EmployeeProjects.RefProj] -> , because it is already part of the umbrella Reference widget.

4. This produces the below screen at run-time.

Last updated