Answers.Body: <p>pmoz has a good solution, but it's Drupal-only, and your View is going to be read-only, though perhaps you can get something approximating what you want with Views Bulk Operations.</p>
  
  <p>Making a writable version of what you're decribing is going to be very difficult to implement, and will require custom coding.  The reason for this is based in database theory and <a href="https://en.wikipedia.org/wiki/Database_normalization" rel="nofollow">normalization</a>.  "Flattening" your data - multiple records on one line - goes against database design principles, and without getting into the math, the performance would be orders of magnitude slower than just grabbing the most recent activity.</p>
  
  <p>If you can live with not being able to edit the activities, and you're not afraid of custom coding, here's a performant and relatively simple way of doing what you want:</p>
  
  <ul>
  <li>Create custom fields on the contact - "Most Recent Activity" and "Second Most Recent Activity".</li>
  <li>When an activity is created, use <code>civicrm_hook_post</code> to write the relevant values from the activity into your custom field.</li>
  <li>If the "Most Recent Activity" field isn't empty, first copy its value into "Second Most Recent Activity".</li>
  <li>Now you can use "Batch Update via Profile", using the custom fields rather than the activities themselves.</li>
  </ul>
  
  <p>Finally - depending on what data you're trying to change, you may want to consider <a href="http://book.civicrm.org/user/current/survey/what-is-civisurvey/" rel="nofollow">CiviSurvey</a> instead of Batch Update via Profile.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-24T23:45:28.797Z
Answers.Text: Jon,
  
  Thanks for the advice. I suspected as such. It's hard for us to move away from a flat spreadsheet (unwieldy as it may have been) to a database that uses tabs, types, and categories for individual contacts. Looks like I've got some custom coding to learn!
Answers.UserDisplayName: Tim
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-24T16:37:44.193Z
Answers.LastActivityDate: 2015-06-24T16:37:44.193Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.Body: <p>We accomplish basically the same thing using Views and a profile.</p>
  
  <p>Create a profile with the fields you want people to be able to edit.</p>
  
  <p>Create a View of CiviCRM Activities, add a relationship of Activity Contact ID, select the contact you want to list (source, target, assignee).</p>
  
  <p>Add Display Name, Phone, email, Activity Date and a custom text field (name it edit and link to your profile) fields.</p>
  
  <p>Sort first by sort name, then by activity date.</p>
  
  <p>Filter by activity type.</p>
  
  <p>Add an exposed filter for Display Name contains.</p>
  
  <p>That should almost get you there.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-24T01:32:08.917Z
Answers.LastActivityDate: 2015-06-24T01:32:08.917Z
Answers.UserDisplayName: pmoz
Body: <p>We're trying to create one table for phonebanking purposes that show the last two or three activities of one type associated with each row of contacts, putting that into a directory or search profile, and allowing users to edit the table through a Batch update or other means.</p>
  
  <p>Columns:</p>
  
  <ul>
  <li>First Name</li>
  <li>Last Name</li>
  <li>Phone</li>
  <li>Email</li>
  <li>Notes</li>
  <li>Most recent activity (or Activity type 1)</li>
  <li>Second most recent activity (of Activity type 1)</li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-25T01:27:51.133Z
Comments.Text: which bits of your table should be editable?
Comments.UserDisplayName: petednz - fuzion
Tags: <profile>
Title: Including Activity Dates and Subjects in a Profile for a Directory or Search
ThreadText: # Including Activity Dates and Subjects in a Profile for a Directory or Search
  
  (Asked by: username_0 on 2015-06-23)
  
  We're trying to create one table for phonebanking purposes that show the last two or three activities of one type associated with each row of contacts, putting that into a directory or search profile, and allowing users to edit the table through a Batch update or other means.
  
  Columns:
  
  * First Name
  * Last Name
  * Phone
  * Email
  * Notes
  * Most recent activity (or Activity type 1)
  * Second most recent activity (of Activity type 1)
  
  **Tags:** profile
  
  > **Comments:**
  > **username_1**: which bits of your table should be editable?  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-06-24. Score: 1 | Accepted answer
  
  username_3 has a good solution, but it's Drupal-only, and your View is going to be read-only, though perhaps you can get something approximating what you want with Views Bulk Operations.
  
  Making a writable version of what you're decribing is going to be very difficult to implement, and will require custom coding. The reason for this is based in database theory and [normalization](https://en.wikipedia.org/wiki/Database_normalization). "Flattening" your data - multiple records on one line - goes against database design principles, and without getting into the math, the performance would be orders of magnitude slower than just grabbing the most recent activity.
  
  If you can live with not being able to edit the activities, and you're not afraid of custom coding, here's a performant and relatively simple way of doing what you want:
  
  * Create custom fields on the contact - "Most Recent Activity" and "Second Most Recent Activity".
  * When an activity is created, use `civicrm_hook_post` to write the relevant values from the activity into your custom field.
  * If the "Most Recent Activity" field isn't empty, first copy its value into "Second Most Recent Activity".
  * Now you can use "Batch Update via Profile", using the custom fields rather than the activities themselves.
  
  Finally - depending on what data you're trying to change, you may want to consider [CiviSurvey](http://book.civicrm.org/user/current/survey/what-is-civisurvey/) instead of Batch Update via Profile.
  
  > **Comments:**
  > **username_0**: Jon,  Thanks for the advice. I suspected as such. It's hard for us to move away from a flat spreadsheet (unwieldy as it may have been) to a database that uses tabs, types, and categories for individual contacts. Looks like I've got some custom coding to learn!  
  
  ---
  
  ### Answer by username_3 on 2015-06-24. Score: 1
  
  We accomplish basically the same thing using Views and a profile.
  
  Create a profile with the fields you want people to be able to edit.
  
  Create a View of CiviCRM Activities, add a relationship of Activity Contact ID, select the contact you want to list (source, target, assignee).
  
  Add Display Name, Phone, email, Activity Date and a custom text field (name it edit and link to your profile) fields.
  
  Sort first by sort name, then by activity date.
  
  Filter by activity type.
  
  Add an exposed filter for Display Name contains.
  
  That should almost get you there.
  
  
  ---
  
  