Problem while removing an item from my list

Hello, I’m new to thunkable X and I tried to make it as in the old version but it doesn’t want to work, any advices ?
Thanks in advance.

To remove an item from the list, you must specify its index. In your case, you first need to find the element index for the specified color, and then delete the element at that index.

Your task can also be solved with text blocks (but this is more difficult): convert the list into text, remove the desired fragment from the text and then convert the text back to the list.

1 Like

If I may ask, how do I find the index, that was the question I was asking but I didn’t know how to ask, could you guide me please ?

To search for an index, loop through the list and compare the current value of the list with the specified one. If the values ​​match, then save the found index and exit the loop.

I’m gonna try this coming back to you if I fail

Something like that ?

Yes

It works fine thanks

Hello @AcrobatEpee and @actech

I´ve been having trouble removing items from my list also. I read this discussion and tried several ways to solve my issue in a similar or even the same way you did it. However, I still cannot remove items from list when button correct is clicked. Below you can see screenshots with all my blocks and a second screenshot with different options, but still none of them worked.

Any help and suggestions are all welcome.

Sorry if I had unnecesary or too complex blocking, I am new in this stuff and still learning.

In case it helps, here´s my JSON/List

{
“gine”: [
{
“Question”: “Question A”,
“Answer”: “Answer A”
},
{
“Question”: “Question B”,
“Answer”: “Answer B”
},
{
“Question”: “Question C”,
“Answer”: “Answer C”
}
]
}

David,

Any chance you could share your project (see here for how)? That would make it easier to read your code in context. Also, could you tell us exactly what steps to take with your app to replicate the problem you’re having.

-Mark

“gine” is a list of objects -> the variable “list” is the same list of objects -> the variable “randomlist” is a random item of this list, for example ={“Question”: “Question A”, “Answer”: “Answer A”}

Then you try to remove the number “{“Question”: “Question A”, “Answer”: “Answer A”}” of the list ?!
Usually you might want to delete the number 1 or 2 in a list.

Maybe you want to delete the list item “{“Question”: “Question A”, “Answer”: “Answer A”}” in the list. Then you should use the block: “index of … in list …” . That might be for example =2 . Then you have a number and can use the " in list … remove # …"-block

Thanks for the suggestions. I think you have a good point regarding the use of “#”, however the block your suggesting I can´t find it, is it not only on the Thunkable Classic Platform?

The process is

  1. Clic the flashcard (big blue box), then you´ll see the answer (the box turns red).
  2. Clic the green happy face :slight_smile: (this means you knew it so you don´t need that card anymore in the deck)
  3. Clic Next to draw a new card

If you continue to do these steps for every new card, they shouldn´t repeat, so eventually the list will be empty.

do you need help with sharing your project?

sorry, I have tried it but I cannot help.

combining objects and lists and multiple various variables and storages is at the moment a case for specialists. good luck

1 Like

It’s ok.
Thanks anyway!

David,

You discovered a bug! It looks like currently, the block


isn’t working. We’re looking at the issue. In the meantime you might want to see if there is some other way to do what you are trying to do. I’ll think about it, as well.

Just FYI, you might think about using stored variables instead of Local Storage and cloud variables instead of Realtime DB. That would greatly simplify your app, though it wouldn’t solve the particular issue that you are having.

Sorry for the trouble your having.

-Mark

Ooohh! That might explain a lot haha, thanks for helping me though.
In the meantime, I´ll be exploring the variables you are suggesting.
Is there any way of knowing when will the bug is fixed? Thanks again.

David,

I have no ETA on that bug right now, but it is a relatively high priority for us.

-Mark

Apparently it is now working fine. Thanks!