Onboarding random show

Hi there!
If I had 20 rows that I want to show in an Onboarding view, how can I show them in a random way with a filter that show only 1 view per day?

The easiest way is to use RANDBETWEEN(1,20) to identify the row you want to show. However, this will not change just once a day – it will change every time something on the app is edited. If you need to have it be consistent for a full 24 hour period, I can think of two ways:

  1. If you don’t really need randomness, you could just have it change once a day:
    mod(hour(today()-date(“4/11/2020”))/24,20)+1
    This goes from 1 to 20, moving up by one each day, and the returns to 1 after 20. As I recall, counting days is hard so, instead, it counts hours and then divides them by 24.

  2. If you need it to be more random, please see the following post of mine:
    Randomize sort order every 3 hours

1 Like

Thanks @Kirk_Masden I will try this and see how it looks.

1 Like

I got a creative idea from this post. I have two questions.

  1. where do I use the expression: mod(hour(today()-date(“4/11/2020”))/24,20)+1
    I tried putting it as a show if expression on the onboarding form but it resulted in a wrong data type. Same with putting it on a slice row filter expression. Thanks for clarifying for me.

  2. Is it possible to show this view only the first time a user opens the app each day? That’s not necessary but could be nice.

thanks.
Lucinda

You’d have to have some way of determining “first time” of “each day” for the user. There is no inherent way to do that, so you’d have to devise something.

1 Like

Right. You could record the first opening each day with an action. I have an action that records the date. It only gets invoked once because if the date is the same there’s no need to write over it. If the user already has the current date written into that cell, it’s not their first time today.

1 Like

Kirk, I’d be interested in how your action works but I’m more interested in where to put the mod expression shown above.
Thanks.

Hi @Lucinda_Mason!

I see now that I missed a question you raised earlier. In regard to where to put the expression I introduced, I used it to make a slice in which the keys for the table are in numerical order, from 2 to 124 in my case. This slice is just one record and it stays constant for an hour and then changes in my app.

Here’s the expression I use in my app:

mod((year(now())*month(now())*day(now()))/(hour(timenow()-“00:00:00”)+1),123)+2

It’s not really random – just sort of random.

Hi!
I just create a SLICE, add your mod formula, with a KEY column type number, but this is gettin an error: “The expression is valid but its result type ‘Number’ is not one of the expected types: Yes/No”.
What I am missing?

If your KEY column is a number then [KEY]=5 (for example) should work as a slice condition, right? So, if you have a more complicated expression, such as the one I suggested, that is preceded by "[Key]= " I think it should work.

Ok!
Many Thanks! I understand now

1 Like

Hey Kirk!
I try many ways with your expression, it works, but is not showing any row in the UX.
To things are happen, sometimes is showing the info of a Random row and sometimes is not showing any info of any row.

Hi! Sorry it’s not working for you. Could you give me the exact expression as you are using it and tell me the range of numbers you need? Perhaps the expression is generating the wrong numbers.

By the way, you can test the expression to see what numbers it is generating. That might help.

3 Likes

Hi!
This is it: [UID]=mod((year(now())*month(now())*day(now()))/(hour(timenow()-“00:00:00”)+1),7)+2

[UID] is a column number key 1 to 7

Coming back to this since I learned “From engineering The “Starting view” option is meant to when the app is opened at the very first time. That’s why it works if you reinstall the app. We try to open the last opened view when the app is reopened.”

So how are people getting the Onboarding view to show more often? I WAS calling it from the starting view if the user wasn’t a new user.

I’d love to have it open whenever the user comes back into the app, or once a day. Since the app is trying to open the last view, can we over-ride that and show what we want?

1 Like

Nope.