Unread messages

In my simple app, a chat can be made between two users (coach and client). When the client makes a chat message, a field of the datatype “chat” gets set to “unread by coach”.
The coach can see a list of his clients, and I want an icon to appear there where a client has created new messages.

About my database:
datatype = chat, with fields "chat status (options: unread by coach, …, read), userid (so all chats concerning a client have the client’s userid)

The repeating group in which the coach can see his clients is one of the type User. I would like to place this icon, but it should get its info from the datatype Chats.
Actually I am looking for this:
Show icon if:
part 1: [search in all chats where userid = parent’s group userid]
part 2: [when one or more messages have the status “unread by coach”]
However, I don’t know how to do it. I am stuck here:


This would be the first part 1. Should I use “each items’s…”?

2 hours later… I think I have found the solution! :slight_smile:
I have created a group wihtin the repating group with datatype Chat, made the constrains so it looks for the last chat message and sees if it has the “unread by coach” status. In the icon I made the condition that when the group is not empty, it should show the icon.