Remove item from firebase using cloud variables

Hi
I am trying to build (rebuild) my app using cloud variables for practice. It’s a really basic app, with functions like add items to a list, remove items from the list and edit items in the list. So far it works fine, but now I am at the step where to remove an item. The list I am using for view my items is an DVL.
The issue is how to remove an specific item in the list in Firebase.
I would need some index for that I guess and I have trying a few things to get that out but now I think I would need some help.

Here is my Firebase list:
Screenshot 2021-08-05 at 13.23.50

here is my code for “swipe-delete”:

The idea with this code was to,

  • get the value from the row I am at
  • count through my list until I can find any item there which match that value
  • remove that value from my list and view the result in a label just for testing.

(I thought I would try this with local list first before going to cloud).

Any help is really appreciated. Thanks!
/

1 Like

This should replace the loop you are using

I’m not sure what you want to do but if you have a list of values and you want to remove a specific value then you can use these 2 blocks to do the job.

ok thanks, yes I simply want to remove for example “Item 2” in my list. But I guess I can use a variable for that in that “text to search for” instead of type “Item 2” manually? I will try this! Thanks!

1 Like

Yes, absolutely.
I was just showing a quick example.

1 Like

Another improvement on your code, if “Items” column is already displayed in the DVL then you can use it this way
image

In my example I am taking the value from the “Title” label of the DVL hence avoiding the call to the local DB. This would be much faster than going back to the local DB.

oh yea, thanks! I’ll try. I didn’t get the first example work really (Nothing happens) so I am troubleshooting at the moment, but maybe this can help! Thanks!

1 Like

Maybe you have an idea what’s missing?
So, I am adding items to my list in the cloud. They are at firebase RTB, I can see them.
I have “found” the text for the row id that I want to delete by using your example above. I put that text in a variable (“tempInputText”) and display this in a label which indicates that this works.
Then I am running your example above for how to remove that text from my cloud-list.
But nothing is happening to my list. Am I missing anything? To I need to somehow “refresh” or sync it?
Thanks

1 Like

The image you shared in your fist post for FB content showing a text not a list. So I assume you are converting it to a list somewhere not in the blocks you shared. If you have not converted it to a list then this trick will not work.

I also noticed that you are using a list inside a list. See this

Ah ok I understand… Thanks

I just thought I would share the solution at last.
This made it work for me, Thanks Muneer for your help. I indeed had to convert it to a list and then back to text again to make it work for my cloud variable as the cloud variables only access clean text.

1 Like