Toast or alert when the number of items in the Image list item changes

We have a project from the university and want to display there in AppGyver images shot from a RaspberryPi. These images are sent to a server and AppGyver accesses them via the Image List item. The display of the images is already working fine.

Now we wanted to add the function that you get a notification (alert or toast) when a new image has been put on the server and thus the list increases by one item.
I have already set up something here, but it does not work.
Can someone help here?

Thanks already!!

What type of database do you use?

It´s a Rest API direct integration.

What is the purpose of pagevars.length === -1?

You could simply do


Then for the calculations you can use


So the flow would be:

Get record collection → set data variable → if (place the IS_EMPTY formula here)

  • true → toast “keine Nachrichten”)
  • false → IF (COUNT(data.list)==pageVars.number) if this true then toast (pageVars.number+" Nachrichten")
    If false the do a set page variable flow and set it the COUNT(data.list).

Hope it was clear enough. :sweat_smile:

1 Like

I used this template for that:

But unfortunately it does not work…

Thank you, I will try this!

We have a project for a mailbox. A sensor triggers the camera on the Raspberry, which then takes a picture of the letter, so you can see who you got a letter from.
This image is sent to a server and then queried by the app via the API.

I’ll send a more detailed description of what I wrote above once I get back home.

So it would look like this:

First set your page variable to a value of 0. To do that just use the set page variable flow and set the static value to 0. I mean that is the default setting anyways.

Then set your data variable to the output of the get record collection. And here should come the fun part.

Let’s check if the number of the records in the data variable list is the same as the page variable number. And of course we check if that has any items at all. The formula in the If flow is this:

IF(IS_EMPTY(data.list), true, COUNT(data.list)==pageVars.nachrichtenNummer)

If this is all true, then either there are no images, or there are no new images. This is why we have a toast that says: “Keine neue Nachrichten” connected to the true output.

To the false output we need to add two flows the toast that notifies us about how many new images are there with this formula:

COUNT(data.list)-pageVars.nachrichtenNummer+" neue Nachrichten"

And the set page variable of the image numbers:


And we go back to our delay and the loop starts again.
Now I just realised that sometimes it may happen that the page variable is changed faster then the toast would appear on the false part, so maybe using an “alert” would be better as that has an output, so you could put the alert between the If flow and the set page variable. Please play around with that.

Also lastly, the alert and the toast as well will be only showed if the app is open. They are not like push notifications.

Hope this helps.

First of all, thank you for your effort and quick response.

Here you can find the picture, which I have tried to rebuild.

Unfortunately it does not work…
The problem is that the images always appear for less than a second and disappear again.
If I leave out the function to do that with a toast, then I see the images that are on the server permanently in the image list item.

With the logic you see on the image, the images disappear directly!

Maybe you have an idea what this can be?

Thank you!

Change the delay maybe to something higher. It is now set on the default 500ms which is a short period of time.

Also what do you bind the list to? Can you show that?