List of dynamic numbers, deleting, managing list

I am building a quiz app. User selects a level to play and a level is made up of a series of numbers. I use those numbers to know which quiz problems to load from the localdb.

I created a ‘list’ from two variables. The two variables define numbered rows in a localdb. Example: The two variables could be 6 & 10, therefore the list would look like 6,7,8,9,10, these numbers correspond to rows in my localdb.

Later I delete a value from the list based on which quiz problem they just completed. Example: user completed quiz problem 7, I remove 7 from the list, the variable with the list should look like 6,8,9,10. Then next time I choose a random value from the list it will not include that value I just removed.

My problem is the blocks don’t do that, instead # means to remove the position in the list. And I don’t know how to find the position of 7 from the list.

I’m not a programmer, so this is challenging for me. Are there better blocks I should be using? Is this approach even possible? I’m trying to make it flexible and dynamic.

Do any of the masters have a solution? @jane @drted @darren

You need to search for the list item containing “lesson” (the lesson #) and then remove that item from the list:

3 Likes

@tatiang Omg that fixed it woohoo! Thank you for making my weekend, you’re my hero!

Now off to troubleshoot the next issue

2 Likes

@exploriverse.com You’re welcome!

1 Like

@tatiang Next issue i’m having is with the list block.

On my first screen I set the string of numbers with this list block, it works.

Then I do it again from another screen but the outcome is just 1 number, why is it just showing 1 number and not the string of numbers? The block below setting stored lesson is not working either.

Is this issue again me not using list blocks correctly?

When selecting a random item from a list, you want to follow this algorithm:

  1. Choose a random number from 1 to the length of the list (in your case, you’re using Qstart and Qend for this which is fine).
  2. Assign the random number to a variable (let’s call it randomItemNum).
  3. Get the value of the list item at #randomItemNum.
  4. Delete the list item at #randomItemNum.

I think you are skipping step #2, at least on your Quiz 01 screen.

2 Likes

I changed up how i handle the start and end of my string and just write the full string (ex. 6,7,8,910)


Lastly it seems when pulling numbers from the localdb it needs to be formatted with this block so it maintains the commas. “delimiter”

Thanks to @tatiang @drted you’re contributions help this thunkable amateur more than you know <3

1 Like