Although the Firebase DB shows updated value after clicking the button, the number in the UI won’t increase right away. Example) when CountYes = 0, it becomes CountYes = 1 in the Firebase DB after clicking the button, but it remians “0” in the UI. When I go to another page and come back, then it shows the updated value of “1”. What can I add that will show real-time updated value when a button is clicked?
For now, the button only updates once. Example) current value = 0. If I hit button, it updates the DB value to 1 (counter number current.CountYes is still displaying 0 in the UI). When I hit the button again, it won’t increase it to 2. However, if I go to another page and come back, the UI shows 1 and it allows me to click and update the value to 2, but again, it won’t update to 3 if I click again. Do you have any suggestion why this could be happening?
1 with a delay that fetches data every x seconds. But this will count as a read and some DB providers may charge you when you reach XXX numbers of reads per day or month.
2 with a page variable. Your 123 number in the screenshot should be bound to a pageVar (instead of a data var I presume). Assign the formula NUMBER (repeated.current.CountYes)+1 to that pageVar.
Thanks to the two-way binding possibility enabled by Appgyver, you will see the number 123 increment as you hit the thumb-up button.
Then here, you will have to bind the CountYes field value to the pageVar instead of the formula.
Thanks @Fred_Kuzyk. I followed your method 2. I created a page variable called “CountYes” and assigned it to Number Counter (123 box). Then for the click button, I added “Set Page Variable” and added “NUMBER(repeated.current.CountYes)+1.”
Would you review the video below? Now all the counters are showing the same number. Where could I have configured something wrong?
Screenshot for the “Update Record” logic for the button.
LOL, yes indeed, I realize you have a list with a repeat…
I don’t master this part now, but I would try with a pageVar that is a list of objects with the same schema as that of your 123 number.
I’m not going to be able to help further here as I do not know appgyver by heart enough and I need the screen to explore and find it out.
This would find the current object in the list of objects that you repeat with, that means that it would pass on to Firebase update flow all the properties that are already set and would modify the one property that is the “desiredProperty”.
“Set repeated item” flow function worked for updating the number in real time!
My desired property is “CountYes.” Would you review if my formula is correct?
=> SET_KEY(FIND_BY_KEY(data.MindfulnessCollection, “id”, repeated.current.id), data.MindfulnessSingleData.CountYes, data.MindfulnessSingleData.CountYes + 1)
When I click the button, now it the counter goes up in real time! (which is awesome!). However, the item name disappears, and the clicking the button is not updating the counter anymore. I get the Patch 400 error in the Console.
However, when I go to another page and come back, then clicking the button increases the counter again. Is there any area where you suspect of an issue?
You will find the correct syntax for item under the Currently repeated data items in the left menu.
Also what is the type of your CountYes var? You’re using NUMBER(repeated.current.CountYes) so maybe try NUMBER again in this formula if the item fix does not sort the unknown type issue.
I’ll be busy with Mihaly in the afternoon actually but I can find a slot. Message me your email so I can bip you and send you a google meet.
It will be quick. Either I understand the problem and can fix this or I don’t and I can’t fix.
Hello @Fred_Kuzyk, thanks for checking up on me. I missed @Shankar_Gomare’s message. I’m looking at it now and trying to understand what “thumbsup” means by looking through some AppGyver documents. I will share my latest update here shortly!