How Do I Not Get The Same Items In A List Picker?

I'm kind of dumb, so please be patient lol. Also a visual representation is more preferred.
The issue I'm having right now is it keeps picking duplicates. For example, when I choose the "PG" List picker, it sometimes shows duplicates. It sometimes shows 2 options for Stephen Curry, or sometimes 3 options for Allen Iverson, etc. (Ignore the numbers, and the silver and gold stuff, just focus on the first items such as Steve Nash, OVR 75 Silver)

Welcome Vik.

Possibly because you select randomly from a List without ensuring that already picked items are removed from the List to avoid duplicates.

randomPick

You could try How to pick a random item from a list without picking duplicates?


Oh, thanks so much! I have one more question though. My list is kind of weird so how would I incorporate the random integer block with my list? Once again, thanks for helping.

You don't use it directly with your List. You create a temporary List of PG (a List that is a copy of PG) and work with that.

You might make a small Project with Taifun's example code to see how he uses remove list item.

You may need to clean your global PG list of duplicates before you add the PG data to your ListPicker

Hey. I looked over Taifun's example code and tested it out myself. After that, I tried it out in my code and (I think) it's working how his example is. Now the problem is that I need it to show 3 options instead of 1. I also changed up the PG variable list.

Use a new list to add the random item inside the procedure
Remove the PG.Elements block
Call your procedure 3 times and assign the new list to PG.Elements outside of the procedure

Taifun

Thank you guys for teaching me this! Now I can get this project submitted :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.