Answers.Body: <p>Agreed that the correct solution is to work within <code>getBasicContactFields()</code>, but since your question is a good one with a more general application:</p>
  
  <p>When you add organization name and prefix, you're doing so by adding them to the class's <code>_columns</code> property.  As you note, this doesn't look up "pseudoconstants", such as converting prefix_id to a prefix.</p>
  
  <p>That happens in the <code>alterDisplay</code> method toward the bottom of the same file.  Here's a good example in the Lybunt report of using a pseudoconstant lookup to convert the gender ID to a gender:</p>
  
  <p><a href="https://github.com/civicrm/civicrm-core/blob/master/CRM/Report/Form/Contribute/Lybunt.php#L719" rel="nofollow">https://github.com/civicrm/civicrm-core/blob/master/CRM/Report/Form/Contribute/Lybunt.php#L719</a></p>
  
  <p>Hopefully this example is what you need; otherwise feel free to comment/update the question!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-25T18:32:41.913Z
Answers.Text: Thanks Jon!  That worked perfectly and is going to help so much moving forward in trying to build out custom reports.
Answers.UserDisplayName: jansmath3
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-25T18:14:41.677Z
Answers.LastActivityDate: 2016-10-25T18:14:41.677Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I'm confused why Organization Name and Prefix are in the Lybunt report but not in the Sybunt report.  They both have </p>
  
  <pre><code>'fields' =&gt; $this-&gt;getBasicContactFields(),
  </code></pre>
  
  <p>which I thought included these fields.  Maybe I'm missing something.</p>
  
  <p>I can quickly add Organization with this:</p>
  
  <pre><code>'organization_name' =&gt; array(
              'title' =&gt; ts('Organization'),
            ),
  </code></pre>
  
  <p>but I'm unclear how to add the prefix_id and convert it to the correct output (Mr., Mrs., etc)</p>
  
  <pre><code>   'prefix_id' =&gt; array(
              'title' =&gt; ts('Prefix'),
  </code></pre>
  
  <p>Thanks in advance for your help.</p>
  
  <p>Drupal 7.51, Civicrm 4.7.11</p>
  
Tags: <civireport><custom-reports>
Title: Sybunt and Lybunt Report fields
ThreadText: # Sybunt and Lybunt Report fields
  
  (Asked by: username_0 on 2016-10-25)
  
  I'm confused why Organization Name and Prefix are in the Lybunt report but not in the Sybunt report. They both have
  
  ```
  'fields' => $this->getBasicContactFields(),
  
  ```
  
  which I thought included these fields. Maybe I'm missing something.
  
  I can quickly add Organization with this:
  
  ```
  'organization_name' => array(
              'title' => ts('Organization'),
            ),
  
  ```
  
  but I'm unclear how to add the prefix\_id and convert it to the correct output (Mr., Mrs., etc)
  
  ```
     'prefix_id' => array(
              'title' => ts('Prefix'),
  
  ```
  
  Thanks in advance for your help.
  
  Drupal 7.51, Civicrm 4.7.11
  
  **Tags:** civireport, custom-reports
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-10-25. Score: 2 | Accepted answer
  
  Agreed that the correct solution is to work within `getBasicContactFields()`, but since your question is a good one with a more general application:
  
  When you add organization name and prefix, you're doing so by adding them to the class's `_columns` property. As you note, this doesn't look up "pseudoconstants", such as converting prefix\_id to a prefix.
  
  That happens in the `alterDisplay` method toward the bottom of the same file. Here's a good example in the Lybunt report of using a pseudoconstant lookup to convert the gender ID to a gender:
  
  <https://github.com/civicrm/civicrm-core/blob/master/CRM/Report/Form/Contribute/Lybunt.php#L719>
  
  Hopefully this example is what you need; otherwise feel free to comment/update the question!
  
  > **Comments:**
  > **username_0**: Thanks Jon!  That worked perfectly and is going to help so much moving forward in trying to build out custom reports.  
  
  ---
  
  