Hi all,
I am trying to pull 3-5 entries (ideally can be set as variable) from a Notion database. The database is a knowledge base of random pieces of knowledge that I have collected and want to be reminded about. As the database grows continuously the random function needs to be a function based on the total number of entries.
So far I have managed to pull out 3 entries and add them together with text aggregator, but (a) I think there must be a much more elegant way to do this, (b) they are added together without 2 line breaks or similar to detach them from another and (c) the number 3 is set and I can not determine the number of entries I want to be mirrored back.
In the ideal world, I would be able to
- via webhook insert the number of entries to be randomly pulled from the database (done)
- retrieve the number of entries randomly from the database consisting of the content and author/book from where I have it
- add the responses together nicely in one JSON object that nicely delineates the book/author with the knowledge/quote for all the randomly selected entries, something like:
"Author: XXX
Entry: YYYAuthor: ZZZ
Entry: UUUetc."
- This I could then return via webhook to the original place from where I started the request
Currently, to get a random entry, I first pull the full database, then run an array on it to distill the number of bundles without it running it for each entry, I use this number of bundles to define the random function “{{round(random * 8.array.__IMTLENGTH__
)}}”, I do this three times, then I use an iterator to split the entries up again and filter based on the bundle number equaling any of the three random numbers I generated.
→ seems awefully overengineered to me and very static
Any help on simplifying is appreciated