How do you show a random image selected from a data master?
This seems like such a simple thing, but I can't figure it out. I have a data master where one of the three columns is an image. I would like to simply show a different image from the data master each time the page is loaded (at random).
Can you point me in the right direction? If the random part is a problem, I'd love to see how this could be done by way of an equivalent to a SQL "where" clause, or something like that.
Thank you!
Hi Michael,
This is actually quite complicated to do. Here's how to get started with making it random. Filtering the data masters is up to you.
Create an On Page Load event with the outcome Set Value to a hidden label.
Set the value as the Random constant x 100
Create other On Page Load events with conditions that detect the value of the label in random number intervals. I have attached a screenshot with the values of another prototype that links to a random page for clarity on how the conditions should look.
Set the outcomes for those On Page Load events to Set Value to the Data Master to filter it. These filtering events will be specific to the image and the number range. For example, if the random number is less than 10, the data master will filter to only image A. If the the random number is between 11 and 50, the data master will filter to only image B, and so on.
The result should be that JIM will detect the random number, and based on that number, show one of the images.
Hope this helps.
Best,
Danielle
Hi Michael,
This is actually quite complicated to do. Here's how to get started with making it random. Filtering the data masters is up to you.
Create an On Page Load event with the outcome Set Value to a hidden label.
Set the value as the Random constant x 100
Create other On Page Load events with conditions that detect the value of the label in random number intervals. I have attached a screenshot with the values of another prototype that links to a random page for clarity on how the conditions should look.
Set the outcomes for those On Page Load events to Set Value to the Data Master to filter it. These filtering events will be specific to the image and the number range. For example, if the random number is less than 10, the data master will filter to only image A. If the the random number is between 11 and 50, the data master will filter to only image B, and so on.
The result should be that JIM will detect the random number, and based on that number, show one of the images.
Hope this helps.
Best,
Danielle
OK, I see why this is complicated. The randomness is a distraction here; sorry about that. My question, as a total beginner, is much simpler. Let me try it another way.
I've seen the tutorials about how to show a data list or a data grid, but I just want to show a single image, not a list or a grid. And instead of random, just to keep it simple, suppose it would just cycle through the images in the data master each time the page loads.
So, actually, "filtering the data masters" seems to be what I need help with here. Can you explain that?
Many thanks.
OK, I see why this is complicated. The randomness is a distraction here; sorry about that. My question, as a total beginner, is much simpler. Let me try it another way.
I've seen the tutorials about how to show a data list or a data grid, but I just want to show a single image, not a list or a grid. And instead of random, just to keep it simple, suppose it would just cycle through the images in the data master each time the page loads.
So, actually, "filtering the data masters" seems to be what I need help with here. Can you explain that?
Many thanks.
Replies have been locked on this page!