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"?

1 Answer 1


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.


Pradeep [1]: https://i.sstatic.net/TzzqY.png

  • Thanks Pradeep! Will give it a go and mark "answered" if it works! Dec 19, 2022 at 13:57
  • 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? Dec 19, 2022 at 16:53
  • probably mis-speaking but you have :label in the above - shouldn't that be :value?
    – petednz - fuzion
    Dec 19, 2022 at 17:54
  • @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! Dec 19, 2022 at 18:57
  • @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! Dec 19, 2022 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.