Admin UI filtering not working as expected

default discord avatar
TheDunco
12 months ago
7

I'm seeing an issue when filtering in the Admin UI where it's not finding a relationship with the "is in" query for certain relationships. It should find it, but it even goes so far as to display it the query is "not in" when clearly it should be there (see picture). This same filtering does work for other relationships, so I'm not sure if this is a Payload issue or an implementation issue on my part, but any insight would be appreciated!

  • discord user avatar
    patrikkozak
    Payload Team
    11 months ago

    Hi @TheDunco - In your case, in order for the

    is in

    operator to return your expected result - you would need to input the

    entire

    Stripes string value in the value input box.



    E.g.

    | Stripes | is in | Cust: (Hex/Star, IN/MM) High Leverage, (Hex) Precise Tip Geometry, (Hex) High-Performance Finish...

    Does this make sense? Let me know!

  • default discord avatar
    TheDunco
    11 months ago

    That does make sense I suppose, thanks. This makes me think the "is in" operation is more like an "equals" operation, though, which is slightly confusing for polymorphic (many-to-many) relationships. Are there plans to implement more of a "contains" or "includes" query? Because members of my team would like the ability to query relationships in the manner I was initially expecting the "is in" to work.



    And/or is there a method for getting this functionality with some fancy logic or something that's currently implemented that I'm not aware of?

  • discord user avatar
    patrikkozak
    Payload Team
    11 months ago

    Yup! In the dropdown of the filter options, we have a

    contains

    operation which will do what you were initially expecting to happen

  • default discord avatar
    TheDunco
    11 months ago

    I'm not seeing that option for this many-to-many "Stripes" field.

    image.png
  • discord user avatar
    patrikkozak
    Payload Team
    11 months ago

    Ahh - so right now - for

    array

    fields, you won't have access to the

    contains

    operation. You would use the

    is in

    operation.



    Filtering on relationships can only be done by ID. If you want to filter on nested fields, you need to use the rest api. So a

    contains

    approach wouldn't work in the UI

  • default discord avatar
    TheDunco
    11 months ago

    Ah, ok, that makes sense. We can get by filtering by ID. Thanks!

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.