Answers.Body: <p>So I haven't tried this but if it were going to work I think it would look like</p>
  <pre><code>{if '{contact.contact_type}' == &quot;Organization&quot;)} 
     {contact.display_name} 
     {contact.address_primary.street_address}
     {contact.address_primary.postal_code} {contact.address_primary.city}
     {contact.address_primary.country_id:label}
  {/if}
  
  
  {if '{contact.contact_type}' == &quot;Individual&quot;)} 
     {contact.display_name} &gt; works
     {contact.employer_id.address_primary.street_address}
     {contact.employer_id.address_primary.postal_code} {contact.employer_id.address_primary.city}
     {contact.employer_id.address_primary.country_id:labe}
  {/if}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-30T07:01:35.247Z
Answers.Text: Hmm - looks like we only exposed the display_name for the employer id https://github.com/civicrm/civicrm-core/blob/eb5c74e91286062409462250b1f140297fdcc79a/CRM/Contact/Tokens.php#L669
Answers.UserDisplayName: eileen
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-01-30T06:59:43.630Z
Answers.LastActivityDate: 2024-01-30T06:59:43.630Z
Answers.UserDisplayName: eileen
Body: <p>can I somehow make an if-statement in the adress labels</p>
  <p>What I want to do is a diffent label depending on the contact type. Basically something like this (not working)</p>
  <pre><code>if (contacttype = &quot;organisation&quot;) {
     {contact.display_name} 
     {contact.street_address}
     {contact.postal_code} {contact.city}
     {contact.country}
  }
  
  if (contacttype = &quot;individual) {
     {contact.display_name} &gt; works
     {contact.street_address}
     {contact.postal_code} {contact.city}
     {contact.country}
  }
  </code></pre>
  <p>The organisation tokens work but with the individual adress I have a problem because I somehow have to get the street of the organisation. I tried {contact.employer_id.street_address} but no sucess</p>
  <p>thanks for any help
  werner</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2024-01-29T21:39:01.023Z
Comments.Text: Not suggesting it is the solution to your problem, but are you aware of the 'shared address' feature, ie you could potentially edit Jack to use a Shared Address of his workplace?
Comments.UserDisplayName: petednz - fuzion
Tags: <tokens>
Title: if in adress labels
ThreadText: # if in adress labels
  
  (Asked by: username_0 on 2024-01-29)
  
  can I somehow make an if-statement in the adress labels
  What I want to do is a diffent label depending on the contact type. Basically something like this (not working)
  if (contacttype = "organisation") {
     {contact.display_name} 
     {contact.street_address}
     {contact.postal_code} {contact.city}
     {contact.country}
  }
  
  if (contacttype = "individual) {
     {contact.display_name} > works
     {contact.street_address}
     {contact.postal_code} {contact.city}
     {contact.country}
  }
  
  The organisation tokens work but with the individual adress I have a problem because I somehow have to get the street of the organisation. I tried {contact.employer_id.street_address} but no sucess
  thanks for any help
  username_0
  
  **Tags:** tokens
  
  > **Comments:**
  > **username_1**: Not suggesting it is the solution to your problem, but are you aware of the 'shared address' feature, ie you could potentially edit Jack to use a Shared Address of his workplace?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2024-01-30. Score: 1
  
  So I haven't tried this but if it were going to work I think it would look like
  {if '{contact.contact_type}' == "Organization")} 
     {contact.display_name} 
     {contact.address_primary.street_address}
     {contact.address_primary.postal_code} {contact.address_primary.city}
     {contact.address_primary.country_id:label}
  {/if}
  
  
  {if '{contact.contact_type}' == "Individual")} 
     {contact.display_name} > works
     {contact.employer_id.address_primary.street_address}
     {contact.employer_id.address_primary.postal_code} {contact.employer_id.address_primary.city}
     {contact.employer_id.address_primary.country_id:labe}
  {/if}
  
  > **Comments:**
  > **username_2**: Hmm - looks like we only exposed the display_name for the employer id https://github.com/civicrm/civicrm-core/blob/eb5c74e91286062409462250b1f140297fdcc79a/CRM/Contact/Tokens.php#L669  
  
  ---
  
  