Randomly assign to user

Hello,
I have another paid account with appsheet and I really love the platform. I have created a card game for fun, to play with the fam. I have two databases, Characters and cards. I have a virtual column in the characters database that counts how many related cards are in your hand (Related cards to the character database). I have a slice & UX of the cards that randomly generates 1 card for you to select. Right now the player clicks on draw card, which navigates you to the slice & UX then you click on the randomly generated card to add to your hand for every card. I would like the player to always have 7 cards, My question is, is there a way to create a action that would assign 7 random cards to the character (User)?

Thanks!

You seem to have a good grasp of the system so I’m not perfectly clear on what part of assigning 7 random cards.

You say you are already generating 1 card randomly. So I’ll assume you already have something built to do that.

So, maybe you are asking how can you use your random assignment function and do it 7 times with a single Action click?

There is no concept of looping on an action. Do you know about Grouped Actions? What you could do is create 7 different Actions - Assign Card 1, Assign Card 2, etc. Then you can create a Grouped Action and add all 7 of the Assign Actions to it.

The Action that is displayed in the view, is the Grouped Action. When tapping it, the 7 Assign actions will execute to perform the random assignment.

Does this help? If its not quite what you are looking for please re-post.

Thank you for the quick reply!

I think a grouped action would work. I tried it but it would only navigate me to the ux with the randomly selected card and not select that card (usually the user will click on draw card at that point and that action will assign data to some columns to move it along) Is there a way to randomly select a card straight from the database and not use a ux?

Thank you!

I have to be honest that I am only grasping the main concept of what you are trying to accomplish. Its hard to deduce details from text sometimes. Images of the issue you are facing when possible help a lot.

Having said that, I am wondering if you are using the RANDBETWEEN() function to select randomly? If not, you might see if that can be of some help. It does require a low limit and high limit values of type Number. This means you would want to have some way of numerically identifying the cards if you don’t already.

Hey Sorry for the late reply, Life got in the way and I hadn’t worked on this pet project for a minute :slight_smile: but I think I have it figured out of what I was trying to achieve. Before the user had to go to a slice/view that randomly showed a “Players Card”. The user would click a button on that card that would add it to their hand. I wanted to eliminate the view that showed the random card and just use an expression and a button that you could simply click and it would just add the card to your hand.
Here is the expression that I did
LIST(ANY(SELECT(Table_Name[Key], [Key]=RANDBETWEEN(2,660))))

I am wondering, on my paid account the new card view works amazing! I can assign an action when someone clicks the card. On my prototype account it does not work. The only action that works successfully is “Go to detail”. Do you know why that is?

Thank you!!

No, not precisely. The card view is fairly new and I think its still considered in beta. The functionality in deployed apps may not be the same as prototype apps. They may roll out new features in the test environment to have developers utilize them before making them available for deployed apps. I am not 100% positive on their process but it’s something like that.

Maybe they have introduced something that has caused regression defects? If you are noticing a particular difference, you should post it to the community so AppSheet can look into it.