Answers.Body: <p>I am using <a href="https://www.drupal.org/project/civicrm_entity" rel="nofollow noreferrer">civicrm_entity</a> which can pretty much expose everythign in civicrm to drupal views (and more) <img src="https://i.sstatic.net/ZrwF6.png" alt="filter of type greeting"></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-03T18:23:20.360Z
Answers.LastActivityDate: 2015-07-03T18:23:20.360Z
Answers.UserDisplayName: Sonicthoughts
Answers.Body: <p>You could write a Drupal module to call <code>hook_views_post_execute()</code> or <code>hook_views_pre_render()</code>, looping through the result set and calling your token's function for each record. However, if your email greeting formula is simple, I would call <code>hook_views_query_alter()</code> to add it into your list of select fields, concatenating the name within your SQL.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-16T14:46:48.340Z
Answers.LastActivityDate: 2015-06-16T14:46:48.340Z
Answers.UserDisplayName: Nicholai
Body: <p>The CiviCRM Views integration (Drupal) provides a way to create a View using data from Civi fields.  Is there a way to include the output from a Civi token in the View?</p>
  
  <p>The use case is that I have a token for a custom greeting that I want to include in a View.</p>
  
  <p>[For this particular situation, using the email_greeting field would be enough but it does not show in the list of fields available to add to a View.]</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-08T21:36:40.020Z
Comments.Text: Could you please edit your question to explain your use-case? What is your end goal?
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-09T08:03:23.860Z
Comments.Text: @Coleman - edited, hopefully that's clearer
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-09T14:45:19.737Z
Comments.Text: It sounds like the real question might be "how do I add a currently unsupported field to Views"
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-09T19:49:47.950Z
Comments.Text: @Coleman - I have created a separate question for that (http://civicrm.stackexchange.com/q/3120/225), and when tokens are just an existing field, it becomes just a different way of achieving the same thing.  However, when tokens have more logic in them than just a simple field the question is still how to include them in a View.
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-09T20:03:03.063Z
Comments.Text: CiviCRM tokens generally do not contain any logic, fyi.
Comments.UserDisplayName: Coleman
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-09T20:08:19.493Z
Comments.Text: @Coleman - Generally, yes. But they can as this really useful post explains - https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit  :-)
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-10T01:23:53.820Z
Comments.Text: Ah, classic. But if you're writing your own custom tokens you might as well write your own views fields using the views_php module.
Comments.UserDisplayName: Coleman
Tags: <tokens><drupal-views>
Title: How to include a token in a view?
ThreadText: # How to include a token in a view?
  
  (Asked by: username_0 on 2015-06-08)
  
  The CiviCRM Views integration (Drupal) provides a way to create a View using data from Civi fields. Is there a way to include the output from a Civi token in the View?
  
  The use case is that I have a token for a custom greeting that I want to include in a View.
  
  [For this particular situation, using the email\_greeting field would be enough but it does not show in the list of fields available to add to a View.]
  
  **Tags:** tokens, drupal-views
  
  > **Comments:**
  > **username_1**: Could you please edit your question to explain your use-case? What is your end goal?  
  > **username_0**: @username_1 - edited, hopefully that's clearer  
  > **username_1**: It sounds like the real question might be "how do I add a currently unsupported field to Views"  
  > **username_0**: @username_1 - I have created a separate question for that (http://civicrm.stackexchange.com/q/3120/225), and when tokens are just an existing field, it becomes just a different way of achieving the same thing.  However, when tokens have more logic in them than just a simple field the question is still how to include them in a View.  
  > **username_1**: CiviCRM tokens generally do not contain any logic, fyi.  
  > **username_0**: @username_1 - Generally, yes. But they can as this really useful post explains - https://civicrm.org/blogs/colemanw/create-your-own-tokens-fun-and-profit  :-)  
  > **username_1**: Ah, classic. But if you're writing your own custom tokens you might as well write your own views fields using the views_php module.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-07-03. Score: 1
  
  I am using [civicrm\_entity](https://www.drupal.org/project/civicrm_entity) which can pretty much expose everythign in civicrm to drupal views (and more) ![filter of type greeting](https://i.sstatic.net/ZrwF6.png)
  
  
  ---
  
  ### Answer by username_3 on 2015-06-16. Score: 0
  
  You could write a Drupal module to call `hook_views_post_execute()` or `hook_views_pre_render()`, looping through the result set and calling your token's function for each record. However, if your email greeting formula is simple, I would call `hook_views_query_alter()` to add it into your list of select fields, concatenating the name within your SQL.
  
  
  ---
  
  