Tasks Attached to Contacts
The following View shows Contacts that have Tasks attached to them.
Difficulty: Advanced
Purpose: Uses the Task system table to display Contacts with Tasks attached.
Page: Contacts
Field List
Leave this blank to use the default fields.
View Clause
The following clause limits the list of Contacts to those with Tasks attached. Contacts without any Tasks attached will drop out of the View:
EXISTS (SELECT 1 FROM dp_Tasks T
WHERE T.Completed = 0
AND T._Record_ID = Contacts.Contact_ID
AND T._Table_Name = 'Contacts' )
Other Pages
To use the same technique on Pages other than Contacts, replace the Table Name:
EXISTS (SELECT 1 FROM dp_Tasks T
WHERE T.Completed = 0
AND T._Record_ID = Contacts.Contact_ID
AND T._Table_Name = 'Households' )
My Assigned Tasks
To only show Tasks assigned to the logged in user, alter the View Clause by adding the Assigned User ID clause:
EXISTS (SELECT 1 FROM dp_Tasks T
WHERE T.Completed = 0
AND T._Record_ID = Contacts.Contact_ID
AND T._Table_Name = 'Contacts'
AND T.Assigned_User_ID = dp_UserID )
Techniques
- EXISTS SQL Function
- dp_UserID