Answers.Body: <p>Perhaps it will help you to read the documentation on CiviCRM Reports: <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/CiviReport+Reference" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/CiviReport+Reference</a>. It is not complete but it should help you on your way?</p>
  
  <p>I would not recommend just changing the template, I would recommend creating an extension with your customized report. And then you would need to update the php files as well, check <a href="https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension#CreateaModuleExtension-Addareport" rel="nofollow">https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension#CreateaModuleExtension-Addareport</a></p>
  
  <p>Or am I stating something which you already know by heart :-)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-03T14:22:46.740Z
Answers.Text: Thanks for the answer, im still a novice, but giving it a go. now ive run into a Inner (T STRING) error on line 362.....me thinks im just going to pay someone to do the coding of the report. A small failure in Civi that it cant customise reports from a wysiwyg editor.
Answers.UserDisplayName: Gary Martin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-05T08:25:04.083Z
Answers.Text: There are lots of other open source tools that can do that. IMO it is therefore correct that it should not be part of CiviCRM, we should not create what is there for the sake of having it in CiviCRM :-) Check a toolset like Pentaho or Jaspersoft for reporting on several data sources?
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-03T13:28:30.560Z
Answers.LastActivityDate: 2016-06-03T13:28:30.560Z
Answers.UserDisplayName: ErikH - CiviCooP
Answers.Body: <p>As ErikH stated it is always good practice to create a new extension or create a custom folder to override core files </p>
  
  <p>So In order to add a supplement address in the report you need to add a new column to the report first </p>
  
  <pre><code> 'civicrm_address' =&gt; array(
      'dao' =&gt; 'CRM_Core_DAO_Address',
        'fields' =&gt; array(
        'supplemental_address_1' =&gt; array(
          'title' =&gt; ts('supplemental address 1'),
          'default' =&gt; TRUE,
  
        ),
      ),
  </code></pre>
  
  <p>The above code will add a column to the report and next you need to add address table to the from function </p>
  
  <pre><code>if ($this-&gt;_params['fields']['supplemental_address_1']){
      $this-&gt;_from .= "
          INNER  JOIN civicrm_address {$this-&gt;_aliases['civicrm_address']}
                       ON (( {$this-&gt;_aliases['civicrm_address']}.contact_id =
                             {$this-&gt;_aliases['civicrm_contact']}.id  OR
                             {$this-&gt;_aliases['civicrm_address']}.contact_id =
                             {$this-&gt;_aliases['civicrm_contact_b']}.id ) AND
                             {$this-&gt;_aliases['civicrm_address']}.is_primary = 1 ) ";
  
  } else if (!empty($this-&gt;_params['country_id_value']) ||
    !empty($this-&gt;_params['state_province_id_value'] )
  ) {
    $this-&gt;_from .= "
          INNER  JOIN civicrm_address {$this-&gt;_aliases['civicrm_address']}
                       ON (( {$this-&gt;_aliases['civicrm_address']}.contact_id =
                             {$this-&gt;_aliases['civicrm_contact']}.id  OR
                             {$this-&gt;_aliases['civicrm_address']}.contact_id =
                             {$this-&gt;_aliases['civicrm_contact_b']}.id ) AND
                             {$this-&gt;_aliases['civicrm_address']}.is_primary = 1 ) ";
  }
  </code></pre>
  
  <p>By doing the above you can achieve what you wanted</p>
  
  <p>But still you need to add condition to your address table based on the location type or select only primary flag </p>
  
  <p>I guess this helps !!! </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-03T14:47:29.223Z
Answers.Text: Thanks for the answer. I did what you advised but then got syntax errors. Im a novice and tried to add the code you supplied, however I am probably putting it in the wrong area of the php code. Im sorta giving up on the idea as its just too confusing for novices. Thanks for your contribution though.
Answers.UserDisplayName: Gary Martin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-03T15:04:08.753Z
Answers.Text: hi Gray - please send me your file which you have altered to ramesh@millertech.co.uk let me see what you have done and if i can let me fix the syntax error too
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-04T07:30:15.523Z
Answers.Text: Ramesh did a great job on the coding. After much hair pulling and screaming, I finally(or so I thought) registered the template, created the custom directories. So now when i go to reports my custom report shows a link to access it....thats where it stops by telling me that Template not Found. Its clear that i should stick to Law and let others program. This is the toughest thing to comprehend or even understand the user manual. And people say lawyers speak in jibberish.
Answers.UserDisplayName: Gary Martin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-03T13:43:59.873Z
Answers.LastActivityDate: 2016-06-03T15:53:44.353Z
Answers.LastEditDate: 2016-06-03T15:53:44.353Z
Answers.UserDisplayName: Ramesh - ARTECH Consultancy
Body: <p>Using the standard relationships report under Contact Reports, I would like to be able to add another column under Contact B. That column would pull the supplemental 1 address field.</p>
  
  <p>Using the current template what do i need to add in order for that to work? Do i need to modify any other php files as well?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-06-03T14:07:23.133Z
Comments.Text: I get this error when adding the code?  Parse error: syntax error, unexpected 'INNER' (T_STRING) in /home/gazzafm/public_html/crm/sites/all/modules/civicrm/CRM/Report/Form/Contact/Relationship.php on line 362
Comments.UserDisplayName: Gary Martin
Tags: <custom-templates><custom-reports>
Title: adding a column to the standard relationships report in Contact Reports
ThreadText: # adding a column to the standard relationships report in Contact Reports
  
  (Asked by: username_0 on 2016-06-03)
  
  Using the standard relationships report under Contact Reports, I would like to be able to add another column under Contact B. That column would pull the supplemental 1 address field.
  
  Using the current template what do i need to add in order for that to work? Do i need to modify any other php files as well?
  
  **Tags:** custom-templates, custom-reports
  
  > **Comments:**
  > **username_0**: I get this error when adding the code?  Parse error: syntax error, unexpected 'INNER' (T_STRING) in /home/gazzafm/public_html/crm/sites/all/modules/civicrm/CRM/Report/Form/Contact/Relationship.php on line 362  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2016-06-03. Score: 3 | Accepted answer
  
  As ErikH stated it is always good practice to create a new extension or create a custom folder to override core files 
  So In order to add a supplement address in the report you need to add a new column to the report first 
   'civicrm_address' => array(
      'dao' => 'CRM_Core_DAO_Address',
        'fields' => array(
        'supplemental_address_1' => array(
          'title' => ts('supplemental address 1'),
          'default' => TRUE,
  
        ),
      ),
  
  The above code will add a column to the report and next you need to add address table to the from function 
  if ($this->_params['fields']['supplemental_address_1']){
      $this->_from .= "
          INNER  JOIN civicrm_address {$this->_aliases['civicrm_address']}
                       ON (( {$this->_aliases['civicrm_address']}.contact_id =
                             {$this->_aliases['civicrm_contact']}.id  OR
                             {$this->_aliases['civicrm_address']}.contact_id =
                             {$this->_aliases['civicrm_contact_b']}.id ) AND
                             {$this->_aliases['civicrm_address']}.is_primary = 1 ) ";
  
  } else if (!empty($this->_params['country_id_value']) ||
    !empty($this->_params['state_province_id_value'] )
  ) {
    $this->_from .= "
          INNER  JOIN civicrm_address {$this->_aliases['civicrm_address']}
                       ON (( {$this->_aliases['civicrm_address']}.contact_id =
                             {$this->_aliases['civicrm_contact']}.id  OR
                             {$this->_aliases['civicrm_address']}.contact_id =
                             {$this->_aliases['civicrm_contact_b']}.id ) AND
                             {$this->_aliases['civicrm_address']}.is_primary = 1 ) ";
  }
  
  By doing the above you can achieve what you wanted
  But still you need to add condition to your address table based on the location type or select only primary flag 
  I guess this helps !!!
  
  > **Comments:**
  > **username_0**: Thanks for the answer. I did what you advised but then got syntax errors. Im a novice and tried to add the code you supplied, however I am probably putting it in the wrong area of the php code. Im sorta giving up on the idea as its just too confusing for novices. Thanks for your contribution though.  
  > **username_2**: hi Gray - please send me your file which you have altered to ramesh@millertech.co.uk let me see what you have done and if i can let me fix the syntax error too  
  > **username_0**: Ramesh did a great job on the coding. After much hair pulling and screaming, I finally(or so I thought) registered the template, created the custom directories. So now when i go to reports my custom report shows a link to access it....thats where it stops by telling me that Template not Found. Its clear that i should stick to Law and let others program. This is the toughest thing to comprehend or even understand the user manual. And people say lawyers speak in jibberish.  
  
  ---
  
  ### Answer by username_1 on 2016-06-03. Score: 1
  
  Perhaps it will help you to read the documentation on CiviCRM Reports: <https://wiki.civicrm.org/confluence/display/CRMDOC/CiviReport+Reference>. It is not complete but it should help you on your way?
  
  I would not recommend just changing the template, I would recommend creating an extension with your customized report. And then you would need to update the php files as well, check <https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension#CreateaModuleExtension-Addareport>
  
  Or am I stating something which you already know by heart :-)
  
  > **Comments:**
  > **username_0**: Thanks for the answer, im still a novice, but giving it a go. now ive run into a Inner (T STRING) error on line 362.....me thinks im just going to pay someone to do the coding of the report. A small failure in Civi that it cant customise reports from a wysiwyg editor.  
  > **username_1**: There are lots of other open source tools that can do that. IMO it is therefore correct that it should not be part of CiviCRM, we should not create what is there for the sake of having it in CiviCRM :-) Check a toolset like Pentaho or Jaspersoft for reporting on several data sources?  
  
  ---
  
  