PICK (column)
(Since 1.2.0) -- Relationship columns
A relationship column is essentially a select list containing items from the related type. If you create a column in one pod that relates to another pod, "event", then in the edit form you'll see a select list with all "event" items.
Relationship Types
| Type | Details |
|---|---|
| Pod | an item in one pod can relate to items in another |
| WP Page | a pod item can relate to one or more WordPress Pages |
| WP Post | a pod item can relate to one or more WordPress Posts |
| WP User | a pod item can relate to one or more WordPress Users |
| WP (Parent) Category | if a category has children, then a pod item can relate to one or more of these children |
Creating a Relationship
- Click the "Add new column" button
- Enter a name and label
- For the Column Type, select "Relationship (PICK)"
- Select the pod you want this column to relate to (or one of the WP items)
- Save the column
Filtering / Ordering PICK Items in the Form
There are two options for Relationship fields, "Filter" and "Orderby". These interact with the MySQL statement to select the values.
Values should reference non-PICK column names, without a t. prefix.
Examples
Filter Examples
is_active=1or
event_date>NOW()
Orderby Examples
is_active DESCor
event_date ASC
Bi-directional Relationships
Bi-directional Relationships, as the name suggests, allows you to make "double sided" relationships. With Bi-directional Relationships it's possible assign a pick column to a pod and, for the pod picked, a "reverse pick" to that first pod.
For example, you've got 2 pods: "author" and "book". To create a bi-directional Relationship, you'd add a "related_books" PICK column in your "author" pod, and a "related_author" PICK column in your "book" pod.
Then, let's say that you add 10 new books. For each book, you select an author from the dropdown list. With a bi-directional relationship you won't have to go back into the author pod and manually select the related books from the dropdown. So every time each item is updated, the relationships on both sides will be updated.
Creating a Bi-Directional Relationship
- Click the "Add new column" button
- Enter a name and label
- For the Column Type, select "Relationship (PICK)"
- Select the pod you want this column to relate to (or one of the WP items)
- Save the column
- Go to the other pod, repeat steps 1-4, and now go to the second drop-down below the drop-down you select the related Pod / WP Object -- Select the first field's name from the list
- Save the column
- Go back to the first pod, and now go to the second drop-down below the drop-down you select the related Pod / WP Object -- Select the second field's name from the list (if it doesn't show up, switch the related Pod / WP Object away from the current selection and then back to refresh the list of fields)
