I’ve done this with an admob banner within a social media post feed.
First, your collection of items needs a number parameter that acts as a record ID number. So we’ll name it “Post ID” in the posts collection. Each record should have a unique numerical value, preferably starting at 1, and incrementally increases by 1 for each record. So record 1’s post ID = 1. Record 2’s post ID = 2, etc.
I have a list of social media posts collection. Inside the list, add 2 input components. Name the first input “Post ID Input” and the second one “Post ID Input 2”
Add a custom formula to “Post ID Input” like “Current Post ID divided 4”. This will give you a decimal point value if the post is not divisible by 4. So if we’re on Post #5, you’d see 1.25 in that input.
Add a custom formula to “Post ID Input 2” like “Current Post ID divided by 4 minus INT(Post ID divided by 4)”. This will give you either 0 if the number is divisible by 4 and a decimal point value if it is not divisible by 4.
Okay, this is a great suggestion and I see where you’re going with it. Back in my coding days, I would use the INT() function a lot to do similar things.
However, my list will never have the same items each time. Doesn’t your suggestion assume that each time my list loads, it will always start with 1, then 2, then 3, etc? My list will be a subset of records each time, often random, and shared among the audience. So, in your example, if it were a social media feed, it would be like each person seeing the feed but items in a different order or filter.
That being said, I did come up with a way to do this randomly, but it’s far from ideal. I put a number field in the collection. When each record is created, I fill it with a random digit from 0-9 (for example). Then, when the list loads, I act upon each record that matches a random digit that I declare some other way (and change frequently). In the case of 0-9, then my special content (ad for example) does show up 10% of the time. But it’s not consistent from list-instance to list-instance. Some instances will have zero, while others have three, for example. I tested it, and when using 0-9, the content come up with 10% of the returned records. So I get the desired coverage, but only in the aggregate. And while I’m doing this nonsense, I can’t help wonder why such a great platform has such a glaring omission in functionality.
Not sure if this is relevant - though I had this thread opened in a browser tab so decided to share some thoughts
In my opinion, with current Adalo limitations there is no “general” solution for this which works in all cases. However, there are some particular cases when something similar could be achieved with a filtered list.
Let’s assume you need to display the ad after 4th item in the list, and the query could contain various filters (e.g. item should belong to logged-in user).
A prerequisite which is mandatory is that you have some numeric ID by which this list is sorted, and these IDs are unique.
So, what approach you could use: