Hello there,
need a hint with showing static data inside the group in repeating group.
I’ve managed to have a static data for repeating group, thanks to this post:
My situation:
I have an RG of type “post”.
Each post have a “likes_count” which is increased +1 everytime user likes that post.
What I want to achieve
when my page with posts is loaded, value is set and do not change the “likes_count” value afterwards, only change it after the next page load (or when I like the post)
Ideal solution
Would be something like when element is loaded, set the state of that element to some value and use this value as a source
Try this:
Within your RG, add a number expression or custom state something like “newClicks”. Then when user clicks +1, increment newClicks. Then adjust your text showing likes_count to be likes_count minus newClicks.
Thanks for reply,
However I am not sure how it solves my problem.
Custom state is “local variable” so if another user clicks on like, RG will update it’s value.
Ah, shoot. I misunderstood what you were trying to achieve. Sorry about that, this makes more sense now.
I’m not sure if this will work, but have you tried using a hidden input element, with a default value equal to the likes_count, and then have the text element = the input. I don’t believe the input’s default value will update but I’m not certain on this.
edit: or you could make the input visible and disable it.
I’ve given this some thought since reading your question, and frankly I’m stumped. Not sure that there is any efficient way to achieve this. You could create a separate table that loads the RG data on page load, but not sure that juice will ever be worth the squeeze.