Answers.Body: <p>If you are on CiviCRM &gt;= 5.47.x, you can use smarty conditions in the rewrite section of the field on display searches.</p>
  <p>[![enter image description here][1]][1]</p>
  <p>the expression would be something like below</p>
  <pre><code>{if &quot;[Contact.Details_ccc.Practice_Status]” neq “Retired”}[CONCAT_WS_COMBINED_TEXT_REG_LIC_NUMBER]{else}{/if}
  </code></pre>
  <p><strong>Note</strong>: Replace the field name in the square brackets([]) with actual names.</p>
  <p>HTH</p>
  <p>Pradeep
  [1]: <a href="https://i.sstatic.net/TzzqY.png" rel="nofollow noreferrer">https://i.sstatic.net/TzzqY.png</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-19T13:57:31.717Z
Answers.Text: Thanks Pradeep! Will give it a go and mark "answered" if it works!
Answers.UserDisplayName: Simon Thornton-Wood
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-19T16:53:04.953Z
Answers.Text: The rewrite field seems not to interpret that code correctly, and I get just the text of the code appearing on the form (though it does pick up the specified field). This is what I have in the rewrite field:  {if "[Membership_Contact_contact_id_01.Details_ccc.Registration_status:label]” neq “Retired”}[CONCAT_WS_Membership_Contact_contact_id_01_Details_ccc_Practise_Licensing_Authority_Membership_Contact_contact_id_01_Details_ccc_Practise_license_number]{else}{/if}.  What am I doing wrong?
Answers.UserDisplayName: Simon Thornton-Wood
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-19T17:54:39.377Z
Answers.Text: probably mis-speaking but you have :label in the above - shouldn't that be :value?
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-19T18:57:50.203Z
Answers.Text: @petednz I have tried replacing :label with :value and the changed behaviour is odd. With :label, the text of the expression is returned (albeit with the contents for the field I am manipulating inserted into the expression). With :value; the entire result of the query is blank. Logically (I think), if SK did not recognise the expression as code, it should be agnostic about :label and :value!
Answers.UserDisplayName: Simon Thornton-Wood
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-19T19:13:08.177Z
Answers.Text: @petednz: I have found the problem I think. Pradeep did say that Civi 5.47 was needed to use this Smarty expression, and I suspect that Smarty is not implemented for this usage in 5.46 (which is the version we are on). I should read more carefully! Not sure if there is an alternative construction of the expression I could use now, or if we need to upgrade!
Answers.UserDisplayName: Simon Thornton-Wood
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-20T13:11:11.280Z
Answers.Text: Yes, Civi should be on 5.47 to use smarty conditioning. It is a best practice to use ':name' for checks since this won't change
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-19T13:54:25.343Z
Answers.LastActivityDate: 2022-12-19T13:54:25.343Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I am building a Membership Directory using SearchKit and FormBuilder.
  The Directory includes details of statutory license to practice (regulator + licence number, combined in SearchKit as a string) (values stored in two custom fields of the Individual Contact record).
  I want to hide these details if the Individual is also marked Practice Status &quot;Retired&quot; (also stored in the Individual Contact Record).
  How can one construct a SearchKit query (or perhaps alternatively conditionally change the combined field value, which is passed to the public Form) to hide the combined value if the Practice Status = &quot;Retired&quot;?</p>
  
Tags: <searchkit><directory>
Title: SearchKit: return a value from one field based on the value in another?
ThreadText: # SearchKit: return a value from one field based on the value in another?
  
  (Asked by: username_0 on 2022-12-19)
  
  I am building a Membership Directory using SearchKit and FormBuilder.
  The Directory includes details of statutory license to practice (regulator + licence number, combined in SearchKit as a string) (values stored in two custom fields of the Individual Contact record).
  I want to hide these details if the Individual is also marked Practice Status "Retired" (also stored in the Individual Contact Record).
  How can one construct a SearchKit query (or perhaps alternatively conditionally change the combined field value, which is passed to the public Form) to hide the combined value if the Practice Status = "Retired"?
  
  **Tags:** searchkit, directory
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-12-19. Score: 1 | Accepted answer
  
  If you are on CiviCRM >= 5.47.x, you can use smarty conditions in the rewrite section of the field on display searches.
  
  [![enter image description here][1]][1]
  
  the expression would be something like below
  
  ```
  {if "[Contact.Details_ccc.Practice_Status]” neq “Retired”}[CONCAT_WS_COMBINED_TEXT_REG_LIC_NUMBER]{else}{/if}
  
  ```
  
  **Note**: Replace the field name in the square brackets([]) with actual names.
  
  HTH
  
  username_1
  [1]: <https://i.sstatic.net/TzzqY.png>
  
  > **Comments:**
  > **username_0**: Thanks username_1! Will give it a go and mark "answered" if it works!  
  > **username_0**: The rewrite field seems not to interpret that code correctly, and I get just the text of the code appearing on the form (though it does pick up the specified field). This is what I have in the rewrite field:  {if "[Membership_Contact_contact_id_01.Details_ccc.Registration_status:label]” neq “Retired”}[CONCAT_WS_Membership_Contact_contact_id_01_Details_ccc_Practise_Licensing_Authority_Membership_Contact_contact_id_01_Details_ccc_Practise_license_number]{else}{/if}.  What am I doing wrong?  
  > **username_2**: probably mis-speaking but you have :label in the above - shouldn't that be :value?  
  > **username_0**: @username_2 I have tried replacing :label with :value and the changed behaviour is odd. With :label, the text of the expression is returned (albeit with the contents for the field I am manipulating inserted into the expression). With :value; the entire result of the query is blank. Logically (I think), if SK did not recognise the expression as code, it should be agnostic about :label and :value!  
  > **username_0**: @username_2: I have found the problem I think. username_1 did say that Civi 5.47 was needed to use this Smarty expression, and I suspect that Smarty is not implemented for this usage in 5.46 (which is the version we are on). I should read more carefully! Not sure if there is an alternative construction of the expression I could use now, or if we need to upgrade!  
  > **username_1**: Yes, Civi should be on 5.47 to use smarty conditioning. It is a best practice to use ':name' for checks since this won't change  
  
  ---
  
  