• Resolved ch0nkybitplay

    (@ch0nkybitplay)


    I understand simple filtering “Customized WHERE” in Pods field settings. For example, I can make the dropdown for a related pod display only posts whose names start with “TEST” by setting customized WHERE as t.post_title LIKE ‘TEST%’.

    But what about a situation like this one:

    I have two pod types: and they’re connected with each other through a relationship field, both multiple select.

    When I go to the selection dropdown list of a post of type “pod 1”, say “TEST-902823540”, I want the customized WHERE to filter for pods of type “pod 2” that start with “TEST”. Similarly, when I go to the post titled “MISC-2354000” (of type “pod 1”) I want the dropdown to only show pods of type “pod 2” that start with “MISC”.
    So what I’m looking for is a customized WHERE in the pods field settings that will be dynamically responsive. Is this feature available in pods?
    I came across something called “magic tags” but am not sure if that’s available in the field settings…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ch0nkybitplay

    (@ch0nkybitplay)

    An alternative, if the above isn’t possible.
    Lets say we store a string in a field called CODE:

    Can we set a customized WHERE in field settings so that the dropdown list limits the displayed pods of type “pod type 2” to those that have a value of CODE equal to the value of CODE in “pod type 1”?

    Plugin Support pdclark

    (@pdclark)

    In the WHERE options of the shortcode or block, one can put related_pod_type_1.ID to cause it to filter to items with IDs of the related field.

    If writing a formal WHERE query for PHP pods()->find(), the format would be t.ID IN( $ids_from_relationship_field_comma_separated )

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How does “Customized WHERE” work?’ is closed to new replies.