Calling databases with random function

Hello fellow hustlers! I am testing Adalo and I have a question.

I have 10 databases/collections. 1 contains cake recipes, 2 contains risotto recipes, etc. Each collection contains 10 different recipes for the same food. User chooses the food and then clicks RANDOM IDEA button to have 1 random recipe for this food.

Example: User chooses risotto recipes (collection #2), clicks GENERATE and on the next screen we show her random risotto recipe. What should be the custom formula on action?

Additional question. The app is multilingual. Should I make collections ENGLISH-1-cakes, ENGLISH-2-risottos…
FINNISH-1-cakes, FINNISH-2-risottos…
GERMAN-1-cakes, GERMAN-2-risottos…

…or is there a more logical way, that in the #1 CAKES database, the language of the recipe is given in the column (for example: Lang / Cake1 name / Cake1 recipe) and I can call up random recipes from this collection, for example, GERMAN-lang recipes, if the user language is german

Thanks in advance :pray:

Hi @Chhhh,

Welcome to the forum!

First you assign an CustomID for each Recipe (1…10). Then you can use RAND function to generate random number within some range (e.g. 1…10). Then you store this number in a Logged-in User → RecipeNum property (number).
On the next screen (where you show the recipe) you “wrap” all recipe contents into a group, then you create a list out of this group, and then you filter this list so that Recipe → CustomID is equal to Logged-in User → RecipeNum.

There are a lot of variations in this approach - you can search the forum with the keyword “Random” and you’ll find a lot of posts with various solutions.

Another option is to use Random Picker component from the Marketplace. This component will select a random item from the collection “inside itself”, and then you can add an action to link to the next screen. “Current Recipe” will be available on this screen.

In regards to the language: I’d store all languages in the single collection and then filter them based user’s language. I’d even avoid creating different collections for different recipe varieties - I’d rather use a separate “category” collection for that and assign each recipe a category. Random picker should work pretty well with this.
Separate collections for recipe categories may be required if data fields are significantly different for, say, risotto and cake recipes - but I don’t believe this is the case.


Thank you Victor. Helped a lot!

1 Like