crud operator for text[]

Hi guys, I can't filter my field I have a field name superfood which is a text array in supabase db how can I filter an item in a list of text with a provided string can you help to fix my code? `filters: { permanent: [ { field: "superfoods", operator: "contains", value: superfoodsFilter, }, ], },
2 Replies
kapa.ai
kapa.ai5mo ago
Hi @Tan Dep Trai So 1. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The information provided in the extracts does not cover filtering an array of text in Supabase DB using the "contains" operator. However, in general, the "contains" operator is used to filter a column by a string value. For example, in the context of Refine, you can add a basic text input to the table header that will filter the table by the column value. You can change the filter operator for columns to "contains" by changing the meta property of the column definition. Here is an example:
{
id: "title",
accessorKey: "title",
header: "Title",
meta: {
filterOperator: "contains",
},
},
{
id: "content",
accessorKey: "content",
header: "Content",
meta: {
filterOperator: "contains",
},
},
{
id: "title",
accessorKey: "title",
header: "Title",
meta: {
filterOperator: "contains",
},
},
{
id: "content",
accessorKey: "content",
header: "Content",
meta: {
filterOperator: "contains",
},
},
(Source: Refine Docs (https://refine.dev/docs/tutorial/adding-crud-pages/headless/adding-sort-and-filters#adding-filters)) For more specific information about filtering in Supabase, I recommend checking the Supabase documentation or community forums. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@369510721135837184> kapa.ai is still learning and improving, please let us know how it did by reacting below