• Resolved 7thmin

    (@7thmin)


    I have 3 pods: Channel, Game and Tournament.

    Channel and Tournament are linked with a relationship field with multiple option (meaning a Tournament can be on several channels and a channel can have several tournaments).

    Game and Tournament are linked similarly.

    In a Pods template for Games (i.e. an individual game within a tournament) – I want to display which channels are showing games for that Tournament. i.e.

    Game A is Part of Tournament 1
    Tournament 1 is Shown on Channels 3 & 4
    Return Channel 3 & Channel 4.

    [pods name=”Channels” where=”Game.Tournament.meta_value IN ({@Channels.Tournaments})” template=”templatePod”]

    The issue seems to be with the fact I’m trying to search in an array. Can someone please clarify the right way to approach this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @7thmin

    You will have to make sure the where parameter has the correct syntax for SQL.
    You could use the output display filters to make sure the syntax is correct, more info: https://docs.pods.io/displaying-pods/magic-tags/display-filters-with-magic-tags/#Using_Functions_On_Field_Output
    You can use the plugin Query Monitor to validate the query.

    Personally I think you are better off working with actual PHP templates for such cases. These are edge case usages for the shortcodes / magic tags and not really what it’s meant for (even if you could get it working).

    Cheers, Jory

    Thread Starter 7thmin

    (@7thmin)

    Thanks @keraweb,

    I couldn’t understand the display filters link i’m afraid.

    The plugin has really helped me understand a little better where its going wrong and can articulate a little better. Basically what i’m trying to do is say:

    This is a game -> This game is in this tournament (relationship field) -> Get the Tournament
    
    Channels have tournaments (relationship field) -> Which Channels have this tournament -> Here are all channels that have this Tournament
    
    List all channels in a template.

    I think part of the problem here is that there is no direct relationship between the Game and the Channel, and that i’m trying to use Tournament, which has relationships with both, as a sort of bridge.

    I only know a little PHP so is there any way you can envision this working in the Shortcode?

    Thread Starter 7thmin

    (@7thmin)

    Occums Razor… resolved:

    [pods name=”Channels” where=”Tournament.ID IN (ID)” template=”templatePod”]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode Filter Where In’ is closed to new replies.