A pointer takes values from one table and has them “point” to data from another table in the database. In other words, pointers enable each row from one table to take specific information from a field in a separate table, and have that information displayed in the current table.
The relationship between these tables is 1:1, so every item in the first table can only correspond to exactly one item in the second table.
To illustrate how to use pointers, we will bring the example of a real estate database that we have used in the past.
We will create a new table called “RealEstateStatus,” set its permissions, and create a field called “Name”.
Under the “Name” field, we will add four rows, with each row being a different property status: Sold, Rented, Foreclosed, and New.
As you can see, an ID is automatically assigned to each row in the table, so that the Sold, Rented, Foreclosed, and New rows have their own individual IDs.
Now, we’ll go back into our RealEstate table and add the field “Status”. We’ll define the field as “pointer,” and where it says “Connect to table,” we’ll select the table we just created, “RealEstateStatus”.
(Note: The field name will appear as “Status(RealEstateStatus)” in our database, in order to signify that it’s a pointer towards the RealEstateStatus table.)
For each row in the RealEstate table, we’ve added the ID corresponding to the property’s status
At this point, you’ve set up your pointer and can use your tables as you would regularly.
For example, to display specific data from your table on your website, you can go into “Pro” mode drag and drop the “Data Table” Widget.
We chose to display the fields “Style,” “Price,” “NumberBedrooms,” “Image,” and “Status.Name.” (Note that “Status” in the field name refers to the other table that the pointer is drawing information from, and “Name” is the name of the statuses in that table.)
The result shows both the data contained in the RealEstate table’s regular fields, in addition to that which was retrieved from RealEstateStatus table using the pointer.