History: Items List and Item Link Tracker Fields
Preview of version: 65 (current)
Items List and Item Link Tracker Fields
This is one of the tracker field types in Trackers. See also Relations Tracker Field
The item link field provides a selection list with all the unique values in a particular field of another tracker. This allows the use of trackers for simple relational database applications. Using an items list field instead of a text field or text area guarantees that always the same text/phrase is used to describe something, which helps in searching etc.
Especially powerful is the combination with the filter field and filter value options of the TrackerList plugin, which allows the display of only those tracker fields on a particular topic. To use this, the same exact phrase in every record of the tracker is required, which the items list field makes possible.
Example
You want to display the list of products of a company
- tracker Company (id 6)
- id 14: Company name - text field
- id 16: Product list - items list = 5,15,leave localFieldId blank since remote field is a itemlink back to this tracker,12
- id 17: Address - text field
Note: prior to Tiki 9, you have to specify the localFieldId even of the remote field is an itemLink field. From Tiki 9, the localFieldId is used only when you are trying to match values and not simply looking for items that are linked back here.
- tracker Products (id 5)
- id 12: Product name - text field
- id 15: Company name - item link 6,14
The view of the tracker Company will look like
The view of the tracker Products will look like
The insert of a Product item will look like
Company name will be drop down with Macromedia, Apple, Microsoft
Item link parameters
trackerId | the tracker you want to display fields | |
Field ID | the fieldId of the tracker you want to display | |
linkToItem | 1 or 0 to create a link to the item in view mode and listing | |
Multiple Fields | A list of Fields which will be displayed instead of the Field ID parameter. It is also possible to select one single field here, for instance if you want one item per value without the (itemId:XXX) part | |
Format for Customising Multiple Fields | This only shows up if one of Multiple Fields is selected. It gives control on how the multiple fields are displayed | |
status | limit the choice of values to the items with a specific status (values:o,c,p,op,oc,pc or opc) | |
pageLink (Tiki 6+) | the item to the name of the wiki page to link to. If this is set, and when linkToItem is set to 0, the link will go to the wiki page where a PluginTrackerlist is present, instead of to tiki-view_tracker_item.php | |
One item per value (Tiki 9+) | The default value is to display absolutely the value/items for the same label with a notation value (itemID) - ie: name (itemId:1), name (itemId:2), name (itemId:3), etc. The other option is to display only one random item for each label/value - ie: name (single display for all the same item). Be aware that if this is good for a usage where you need a display of the value it will give unpredictable result where the value is to be manipulate as data. Selecting any field in Multiple Fields will ignore displaying the itemId value |
In the above example, Company name in Products tracker is a item link
If you add the option 1 to the item link parameter, you will create a link to the company when displaying a product
If you use the parameters 6,14,0,14|17, instead of seeing the company name, you will see the company name concatenated to the address.
PS: If the Company tracker is not know before you enter the products, you will have not to use the itemlink type for the field 15 but a simple text field.
PPS: Since Tiki8, the new interface to edit tracker fields and their options does not allow to modify the type of a field once it is created.
Items list parameters
trackerId | the other tracker you want to display fields | |
fieldIdThere | the fieldId in the other tracker you want to match with the fieldId of your tracker | This can be a list of fieldIds separated with colons (see below) |
fieldIdHere | the fiedId in your tracker you want to match | |
displayFieldIdThere | the fieldId in the other tracker that is displayed. | In tw>2.0 FieldIds separated with vertical bar to display this list of fields |
linkToItems | 1 or 0 to create a link to items in view mode and listing | |
status | filter the status of the items. Value: o, c, p, op, oc, pc or opc. | tw>=5.0 |
Do not forget the result can be a list
FieldIdThere can be a list of fieldId - so that you cross as many trackers you want. For instance imagine your product tracker has a field contact(fieldId=50) that is an item link to a person tracker , and imagine the person tracker has 2 fields : a name (fieldId=51) and a phone number (fieldId:52)
If you want to display the phone numbers of all your product contact in the company tracker, you will have a field 5,15:50:51,14,52
To visualize you can use this kind of table
item0 in company | fieldId 14 | Apple |
item1 in product | fieldId 15 | Apple |
item1 | fieldId 50 | sg |
item2 in person | fieldId 51 | sg |
item2 | fieldId 52 | 800 200 4000 |
Since Tiki8, there is a new interface to edit tracker fields and their options, and thus, this tracker field looks like:
Displaying Multiple Fields
In the case below, both 29 and 30 are "text" fields.
name = Responses (Person,Yacht)
position = 9
type = l
options = 7,27,19,29|30,0
isMain = y
isTblVisible = y
isSearchable = y
isPublic = y
isHidden = n
New options added in Tiki 9
In Tiki9 some new options were added to "item link", which include:
- allow selecting more than one item from Tracker B as linked with that item in Tracker A,
- you can use a "static text" tracker item field as a separator for the fields displayed from each item in tracker B (for instance, a " dash " ( - ) can be used )
- and many other improvements (see some in the image below).
New options added in Tiki 17
Table display with optional TrackerList parameters
New options have been added in Tiki17 to the tracker field "item link", which allow to display the linked items as a table with the UI and potential features of PluginTrackerList, which opens the door to have custom inline editable fields, sortable tables, etc.
In addition, you can get sums of values of the linked tracker items in a mathematical calculation field in the same source tracker. See an example in the profile Work_Custom_Pricing
When editing that field, you can select through checkboxes which items you want to be really linked (from all the ones matching the pre-selection method defined in the tracker field definition.
Those ones selected (two out of three in the previous screenshot) are the ones taken into account later on as linked and shown in the table display, and used in the mathematical calculation formula in the corresponding tracker fields of that profile.
As previously indicated, you can indicate which fields you want displayed, which format, the options you want to be used in the table display, the pre-selection match criteria, and a few other options:
As indicated above, see more details in your own tiki instance after applying profile Work_Custom_Pricing
Wildcard items
Since Tiki17 (backported to Tiki 16.2 ), you can use wildcard items in the remote tracker:
- the tracker field can display items from the remote tracker which match the value of the common field between the two tracker plus those with a wildcard (asterisk, *) in that field.
- An Update button is shown then below the table, which will proceed as follows:
- all selected wildcard items are cloned and become linked items
- all selected normal items stay the same
- all unselected normal items are deleted
This allows users to make some selections, update, then edit as necessary. Cloned items are safe to edit (they no longer edit the wildcard item but the cloned one), and then save the whole form.
The Update button makes sure this works for new items when we still don't have the itemId to clone to, etc.
- An Update button is shown then below the table, which will proceed as follows:
New options added in Tiki 18
ItemsList field can now use an already present DynamicItemList link to another tracker to list fields in addition to ones displayed in DynamicItemsList. For this purpose, Link Field ID must be left empty and Value Field ID must be set to the DynamicItemList field.
New options added in Tiki 21
ItemsList fields Editable: In edit and view mode, ItemsList fields now offer these options: add item, edit item, delete item.
(See: https://dev.tiki.org/item7206-Make-ItemsList-Tracker-Fields-Editable)
Related
See also Dynamic items list.
Items list | item link | item list | items link | tracker field items list | tracker field item link | tracker field item list | tracker field items link | itemslist | itemlink | itemlist | itemslink | foreign key | Wildcard items | Wildcard | Wildcard_items | WildcardItems