How to filter objects based on the fields of the field object?

I have a Chat_Room table with a field of type Chat list. the Chat table has a text type named message. Now I need to filter Chat_Room based on whether message contains the value of input or not.

My current thinking is whether the chat field in Chat_Room contains a do a search for chat. do a search for chat always returns an array. As long as this array of search results has an element in the array of chat_Room field the result will be satisfied, but I don’t know how to achieve that.


1 Like

I hope you can understand this simplified explanation
Now I have a repeating group of type Big. within type Big, there is a list of types small. Each Small contains a Text type. I now want to filter the repeating groups of type Big based on whether the text type contains a certain value or not. For example, I need the repetitive group of Big that contains “7” in the Text of Small. (I don’t need every Small text of Big to contain “7”, as long as there is a small containing 7, the big is what I want. However, I don’t know how to implement it.

Now the problem is that I get a list of Small containing the number 7 by retrieval. the Big type may contain one Small in this list, but not all (because it may be a Small in other Big types)

and How to select the filter in the figure below so that it is true as long as the chats contain an element of the do a search result.

Hi @qianiaoo, you should note that inside of searches constraints can only go one level deep, so you cannot do for example Do a search for Big where Small List field of type text contains “7”.

  • In order to make this work with a search you could add a text field to your Big type and then in a search for Big check that this field contains “7”.

  • OR You could go more levels deep with the :filter operator. Then inside that you can choose Advanced filter: with This Big smalls texts contains "7".

  • OR Best way in your case would be to add a field to each small of type Big and then do a search for smalls with constraint smalls text field contains “7”. After the search add :each items Big :unique items.

Please note that searches are more performant on longer lists than filter operations.

So I am guessing you want to display all chat threads (Big datatype) where there is a chat message (small datatype) that contains a “7”. Then follow the third approach.

Hope this helps.

2 Likes

It works!!! Thank you very much!! You are so great!! I am so surprised bubble can do so many things!!

2 Likes