Show items according to time spend in app

Hi! I have a recipe app with 100 recipes to start. I would like my users to get 3 new recipes every month (I want to hold the same order of new recipes for any new user as well. Thus, I want everyone to start with the same 100 recipes and get the same new ones). I’ve already built in a ‘count days’ column so it is clear how many days people have spent in the app. But how would I build the logic that in a collection list, the new recipes are added according to the amount of days (so new recipes when count days is > 30, then again new recipes when count days is > 60, and so on). Curious to know how you would solve this! Many thanks in advance. Kind regards, Roos

1 Like

Do you have an automated way of incrementing the number each time the user open the app?

Thanks for your quick reply! No, the start of the count days in the app is when they start their membership. And that stays fixed.

Are you using Glide tables ?

Do you mean the table style you can select on the right? Or something completely different? :sweat_smile: I am not using the table style now, I am using ‘list’.

No I mean, are you using Glide Table, Big Tables, Google Sheet, Excel, etc. as your data source ?

Oh sorry. Google Sheet

For each recipe, there is one row ? And you have a column showing at what day number the item should be shown ?

Exactly. And I have a computed column that counts the days that people are in the app.

You can calculate the months passed by dividing the total days by 30 and using only the integer part:

MonthsPassed = INT(TotalDays / 30)

This gives the number of full 30-day periods that have passed.

Use this value to control recipe visibility. If MonthsPassed is greater than or equal to the RequiredLevel for a recipe, display it!

Thanks. Only, the visibility is managed on a component-level, right? So how would this manage the list items within the collection (in the component)?

Note: Visibility conditions are not a security feature.

If you want to restrict data access based on user roles, ensuring that only users with the appropriate level can view specific data, you should use row owners. To implement this, use a “Role” column in your user table to define each user’s level. Then, in your recipe table, create separate columns for each role level and set each of these as row owners. Since you are using Google Sheets, you can also leverage additional columns to store multiple values for each role level, adding flexibility to your setup.

Maybe I am a bit too unexperienced in Glide when it comes to this, but let me try to understand.

Question 1: I already use row owners for every user. Only I don’t understand how I would link the automatically counting days column to the seperate columns I will create in te recipe table.

Question 2: the separate columns in my recipe table would be role levels based on the days?

Thanks so much for your help. I think for sure I am trying to get something done which is a little out of my league haha.

1 Like

I would suggest taking a level, but I forgot to mention that computed columns can’t be used as row owners. This means you’ll need to update the user’s role daily.

1 Like

But since you’re using Google Sheets, you can make the column role in the users table dynamic with automatic level calculation. This way, it will function like a regular column but will be automatically updated.

1 Like

OK, I think a complex Role and row owner setup is way overkill for just showing recipes. Just set a filter on your collection to display only those recipes that fit within the user’s day count from the user profile.

1 Like

Yes, a filter is smth I started with in the first place, but where I got stuck is that on the filter level I can’t filter on ‘greater than’ or an equivalent. With the ‘visibility’ option this is different, but that only works on a component level.

I wanted to do smth like: when the ‘count days of user in app’ is ‘greater than’ the number given to specific recipes (in a column in the recipe table), they will pop up.

Should be possible. Is the problem how you are computing the number of days? Are you using something like the date difference column or are you using a math column? The result needs to be a number so you can perform numeric comparisons in the filter.

Show how you are calculating the user’s day number and show the number you want to compare against in the recipe table.

The problem is not the counting of days. This is set up correctly per user via a math column. The number I want to compare against is just a fixed number in a column in the recipe table.

Your math column looks good for the most part, but D2 could directly refer to the built in ‘Now’ value instead of a separate date column. Is this math column in your user table?

Is the column in the recipe table a numeric or text data type?

1 Like