This post illustrates how to use the Participants Database String Combine field type.
Use Case
In our participants database, we have a Last Name field and a First Name field.
In our website's membership list, we want to display member names as lastname, firstname instead of using one column for last name and another for first name. One field, one column. To conserve screen real estate. More, because we want to let our members search for fellow members more easily. Because that is the main reason they use the member directory, to look for a member whose name they are unsure of or whose picture they want to check out ("Is that the guy I met?").
Solution
1. Add the following PDB field:
PDB Field Title (display name): Name
PDB Field Name (for use in shotcodes): last_first
PDB Form Element (field type): String Combine
PDB Template (this is where the magic happens): [last_name], [first_name]
2. Use the field in a pdb_list shortcode:
[pdb_list fields="last_first,village,photo" orderby="last_first" search=true display_count=true search_fields="last_first,village" default_search_field="last_first" list_limit=20]
Note that the default search field is last_name.
Here is the page using the above shortcode:
Now, as the instructions on the page suggest, it is easier to search for a person. Just enter any part of the person's first or last name:How a String Combine Field Works
As the name string combine suggests, this field type combines one or more database fields (along with plain text). In our case, we combine the last_name field with the first_name field, and add a comma and a space between them.
You cannot enter data into a string combine field. It's content is created from data in other fields when a record is saved (new or edit).
When you add a new string combine field to your database, it is populated in all member records from the data in them. This runs on the server in the background and does not happen instantly. It can take several minutes depending on the size of the database. Similarly, if you make a change to the template, or make any database change that changes the data in any of the fields used in the template, all the records in the database are repopulated.
Another Example
Suppose you have a House Number field (house_number) and a separate field for the Street named address. Create a string combine field named Full Street Address (full_street_address) defined as [house_number] [address]. This can a come in handy and save screen space when displayed in one column instead of two.

