Loading...
 
Skip to main content

History: Items List and Item Link Tracker Fields

Source of version: 63 (current)

Copy to clipboard
            ! 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 ((PluginTrackerList|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 ~~#006666:6)~~
** id ~~#006666:14:~~ Company name - text field
** id ~~#006666:16:~~ Product list  - __items list __= ~~#FF0000:5~~,~~#FF0000:15~~,~~#006666:leave localFieldId blank since remote field is a itemlink back to this tracker~~,~~#FF0000:12~~
** id ~~#006666: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 ~~#FF0000:5~~)
** id ~~#FF0000:12~~: Product name - text field
** id ~~#FF0000:15~~: Company name - __item link__ ~~#006666:6~~,~~#006666:14~~

The view of the tracker Company will look like
{BOX()}{img src="img/wiki_up/itemlink1.jpg" }{BOX}
The view of the tracker Products will look like
{BOX()}{img src="img/wiki_up/itemlink2.jpg" }{BOX}
The insert of a Product item will look like
{BOX()}{img src="img/wiki_up/itemlink3.jpg" }{BOX}
Company name will be drop down with Macromedia, Apple, Microsoft


!! Item link parameters
The parameters are separated with ,
|| trackerId | the tracker you want to display fields
fieldId|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
displayedfieldslist|FieldIds separated with vertical bar to display this list of fields instead of the the second parameters
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(1), name(2), name(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.||

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|~~#FF0000:Apple~~
~~#006600:item1~~ in product|fieldId 15|~~#FF0000:Apple~~
~~#006600:item1~~|fieldId 50|~~#BB00BB:sg~~
~~#0000CC:item2~~ in person|fieldId 51|~~#BB00BB:sg~~
~~#0000CC: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:

{img src="display656" thumb="y" width="400" rel="box[g]"}

!! Displaying Multiple Fields

In the case below, both 29 and 30 are "text" fields.
 
^[FIELD46]
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
isMandatory = 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).

{img src="display655" thumb="y" width="600" rel="box[g]"}

!! 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 ((pr:Work_Custom_Pricing))

{img type="src" src="display1344" thumb="zoom"}

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.  

{img type="src" src="display1345" thumb="zoom"}

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:

{BOX()}
{img type="src" src="display1341"  width="500"}
{img type="src" src="display1342"  width="500"} 
{img type="src" src="display1343"  width="500"}
{BOX}

As indicated above, see more details in your own tiki instance after applying profile ((pr:Work_Custom_Pricing))

!!! Wildcard items
Since ((Tiki17)) (backported to ((Tiki16|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. 

{img type="src" src="display1340"  width="500"}

!! 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)).

-=alias=-
(alias(Items list)) | (alias(item link)) | (alias(item list)) | (alias(items link)) | (alias(tracker field items list)) | (alias(tracker field item link)) | (alias(tracker field item list)) | (alias(tracker field items link)) | (alias(itemslist)) | (alias(itemlink)) | (alias(itemlist)) | (alias(itemslink)) | (alias(foreign key)) | (alias(Wildcard items))  | (alias(Wildcard))  | (alias(Wildcard_items))  | (alias(WildcardItems))