This members-only tutorial provides the steps to define a custom function that takes in a post type, custom field name, and the corresponding custom field value as parameters and returns either true (1) or false ('') depending on whether at least one of the entries of the given post type has the given value for the given custom field.
Sample Use Case: Let's say you have an event CPT with an associated radio button type of custom field called event_free_ticket that can either have a value of yes or no. Now you want to display 3 events in a Repeater that is inside a Section and output the Section only if at least one of the three events have event_free_ticket set to yes.
Add the custom function given below as a Code Snippet and use the built-in Dynamic Data condition's PHP Function Return value on the Section while specifying the function name and the arguments.
Code Snippet title: [Function] At least one entry has specific custom field value