When you build a database, data can be displayed in different ways. For example, sometimes the data appears in a select box, a table or grid view, and if it is a record related to another one, sometimes it appears on the right hand side when viewing a main record.
Let's say we have a table called Transactions that has many Payments associated with it. When creating a Payment, a select box will appear prompting the user to select a Transaction to associate with the new payment. If, after creating the payment, the transaction selected in the drop down box is viewed, the right hand rail will show a list of Payments associated with the Transaction record.
In this case, Qrimp will try to be smart about how it shows those records in the right hand rail so you can understand exactly which payments those are. Because screen space in the browser is limited, Qrimp chooses just a single piece of information to display. It does this in a particular order:
- If a field exists in the table called "Name" that data is shown.
- If no Name field exists, Qrimp finds the first text field with 100 or fewer characters to represent the record.
- If no no text fields with less than 100 characters is found, Qrimp shows the ID for the record.
Sometimes this strategy is suboptimal, meaning, you want to "help" Qrimp understand how to present the data to your application's users. To help Qrimp, each table in your database has Table Settings
which you can use to describe how Qrimp should display the data in it.
There are two fields on the Table Settings page that you can use to tell Qrimp how to display the data, the first is the default field
which appears near the top of Table Settings Edit screen. If you want Qrimp to display data from only one field in your table in the right hand rail or in select boxes, choose a column in the Default Field drop down.
The Second field is the Default Template, which can be seen near the bottom of the page. If you want to create a template for records in the table that contains information for several columns, use the Default Template.
Continuing from the example above, let's have a Payments table with just the ID, Amount, PaymentDate, and PaymentMethod. The PaymentMethod is a pickfrom the PaymentMethods table. In this table, there is no text field to represent the payments, so we want to create a Default Template using the Payment Amount and the Payment Method. Since the Payment Method is a pick from, we need to use Square Brackets to represent this.
To accomplish our goals, we will create a Default Template as follows:
$[Amount] - [PaymentMethods:[PaymentMethod]]
This use of Square Brackets tells Qrimp, that when displaying a Payment, format the data using a dollar sign, then the Amount of the payment, followed by the name of the payment method used, which is retrieved from the PaymentMethods table using the value in the PaymentMethod field of the particular Payment record.