Hide messages in repeat

Hi Appgyver,

I have a number of messages from a database displayed in a repeat list. Is there a way where individual users can hide a message so it is not visible to them anymore. My database is only set up as a database where the app get its information from.
I have tried to add the toggle function but cannot link it up to individual messages. Is there a way to do this.

Thank you

Dan

Hi!

There is a couple of options for this. In the flow function market you can find functions “Hide component” and “Show component”. With those you can specify to hide or show your repeating component that contains the individual messages.

Additionally, in the advanced properties of your repeating component is a “Visible” property that allows you to toggle the visibility of a single list item. The property is also accessible with the help of a formula, and it would look something like this:

components["component-id"].visible

Hope these suggestions are helpful!

Hi Cecilia,

Thank you very much for your reply and your help. I think I am closer but not quite there yet. I can now get a component to disappear with the “Hide component” but not if is connected to the toggle button, then nothing happens. I might just be on the Appgyver App but when you go back into the app, the message has reappeared. :thinking:

Not sure about the formula and how that works, I have tried it but not with any luck.

Any help is much appreciated.

Hmm that’s true, using the “Hide component” doesn’t save the value between app sessions.

One way to save which messages have been hidden is to create a data resource hiddenMessages that has the schema messageId. Each time a message is toggled you can create a new record into this resource with the toggled message’s id. Now the repeating component’s Visible property (in the advanced section) can have the following formula:

!IS_IN_ARRAY_BY_KEY(data.hiddenMessages, "messageId", current.id)

This formula checks if the current item in the repeating component exists in the hiddenMessages list and therefore should be hidden.

Let me know if this helps!

Thank You Cecillia,

I got it to work, but I had to put If( ), true, false around it :thinking:, not sure if that is correct way of doing it, but it looks like it is working.