Display a random item only once

Hello I have a problem that I can not solve, I would like that each time we press the button it displays a sentence from the database but only once (basically that the sentence can not be repeated several times) until the page is reloaded

thank you in advance if you have the solution

Hi there, @julien.lancelon… if I understand your post correctly, one way to go would be to create a custom state that holds a list of sentences, and add each sentence to the custom state when they are displayed in the group. Then, use the custom state as part of a filter/constraint on the group’s data source so that only sentences that are not already in the custom state are returned in the search, and display a random item from those remaining sentences.

Anyway, that’s one way to go, and I hope it helps.



thank you for your quick answer i will try this

1 Like

If it helps, here is an example where I have a custom state on the index page called used sentences, and here is the filter on the group’s data source.

Here is the workflow associated with clicking the button to get a new sentence.

Oh, you might also need to do something if the search runs out of sentences to display, so just keep that in mind if that could happen with your use case.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.