Find specific item in list Firebase

Hi.

I have built an app which I now have finished, so now I thought I would “re-build” it, just for learning practice, and this time I want to use Firebase instead of Airtable which I had for the previous version.

And with Airtable I learned that if I wanted to get a specific value from a specific row in Airtable, I could use “_id”.

But how can I do with Firebase?

I am trying to add a delete function from my dataViewerList by swipe to Left.

I followed a tutorial that said I could simply add “null” as the value in my Saving-block for the RealTimeDataBase. But when I do so it will remove ALL my items. Does anyone have any tips to me how I can do this?

This is How this tutorial shows:

This is how I do:

So in the tutorial only one (the desired) item gets deleted.
In my app the whole list gets deleted.
But I can’t figure out what’s the different…And I can’t see how my Realtime data base would know what item this row ID in me DVL is…

How would you have done? Any tips?

(“SyncWithDB” is a function I made that ensures that everything in my Firebase list is synced and viewed in my DataViewerList as well).

Thanks

2 Likes

DVL requires a table (google sheet, Airtable, Local Storage) and cannot connect to FB. Can you explain how you did the connection so I can suggest something.

Hi

Yes I know that but I managed to “transfer” the data from FB to a local list that I am using for DVL.
I used this:

And when Saving an item I used the FB Save block followed by this function to get it views in my DVL as well. That seam to work for me.

But now I want to delete and edit these items as well…(hm…) Cant figure out how.

Hope you can give me some ideas.

Thanks!

2 Likes

when you use the Get object properties of then it means that these properties (keys) have sub-keys.

When you want to delete/edit you need to go down to the sub-key otherwise you will overwrite the key and all keys under it.

Ok I understand, but I have a bit trouble understanding the very last key to specify this actual specific item.

I guess these are my sub-keys?

AppVariabvleUser_ID
Items

But the very last part in that “join-block” is where I get confused. It feels like I need some kind of id here? Like the “_id” for Airtable…?

This is how my Realtime Database looks like in FB:

Any ideas?

The tutorial I followed said I could use this same “Save-block” for my deleting but change the value to “NULL”. That works for him but when I do this everything under my Items-key gets deleted.I have also seen other guides that recommend this or using an empty string… none of these works for me though.

2 Likes

Looks OK according to the data presented.

so this would be my “deleting-block” then…

…and this deletes ALL my items. And I am not surprised over that. It really feels like I need to point/connect this row id item to what item it is in the FB list??

2 Likes

If Text_Input1 is empty then all the sub-keys under Items for the specifies user will be deleted. If, in the other hand, Text_Input1 has a value then only that sub-key (mentioned in Text_Input1 will be effected.

1 Like

hm… yes that make sense.

so one solution could be to, every time I swipe an item the text_input field will get the itemText and the proceed with the deleting process??

2 Likes

I have another idea, but first, theoretically, when you ad an item to your DVL there will be a “row id” output in that block:
Screenshot 2021-04-28 at 09.44.25

Will that be the same as the one provided when swipe a row in DVL?
Screenshot 2021-04-28 at 09.45.18

I mean, Are these connected to each other?

-when create an item, that Item will get row id: xxxx
-when delete THAT item showed in a row in DVL, it will then have this row id (xxxx)??

Is that how it works?

My idea was to, every time I create an item I store that row id in a variable and then call that variable as the value in the delete-swipe function somehow…??

could this be an idea?

2 Likes

Just wanted to share, this worked for me.
I simply add the text for that item in DVL to a variable and then put that value in the textfield. Then clear that textfield after saving is done.

3 Likes

@andreas.sjdtomypv I’m currently trying to do the same thing as you, e.g. rebuild my app replacing Airtable with Firebase… Would you be open to sharing your sync function as I have the same problem.

Cheers!

1 Like

Sure, no worries. Did you manage to write to FB yet?
What are you using to show the content? ListViewer or DataListViewer?

I noticed that with the list viewer it was really easy, I just made a function that called my “Get data” from FB,
Screenshot 2021-04-29 at 07.35.05
then I used this block:
Screenshot 2021-04-29 at 07.33.08 followed by the values block with my ListViewer. Like this:


Later on I put that block series in a variable and added that variable for my ListViewer instead. Both works.

I learned that the “get object properties of”-block always returns a list, so you just need to show it.

Hope that works for you!

/A

2 Likes

Cheers thanks!
Yep hooking into FB was ok, initially wanted to Firestore as it seemed more efficient but got stuck with using the API solution. So gave up and just went with the standard Realtime DB.

By the way I’m using custom DLV…
Thanks for sharing!

Ok so hos has it gone for you now then? Did you got it working as you wished after all?

I am using DVL as well.

Btw, please share if you find any solution in getting the either stored to FB or viewed from FB in DVL in “insert as last”-order (instead of alphabetic as is from FB). That’s where I am stuck at the moment :slight_smile:

2 Likes

nah haven’t implemented it as yet, still messing around with structures and views etc. But I’ll keep you posted…

A possible logical solution (Although I’m finding logic and actual is sometimes very different in this platform) For the insert as last order, would be to create either a numeric field from 1 to X and filter using a list numerically or using a timestamp??

Hopefully that helps but no doubt my theory is probably completely flawed :slight_smile:

3 Likes

Insert at last is a property of Lists and to port this to FB simply store your data in a list and save the list in the FB key. You will then retrieve it as saved with your preferred order.

Hi.
I have tried different kinds of list-solutions but I don’t get how this can be done…
Ive tried this for example where I hoped I could set the order in a list and then pas those items in that order to FB, but that didn’t solve anything for me,


And then I tried to simply just made a list and pass that over to FB, like this:

and that kind of works but it gives me this in FB (obviously):

I don’t get how I can use this in FB. If I want to do anything with one of the items in FB later on, like delete or edit, I would need to separate these first and then manage these separately somehow.

Was this how you ment?

The order is fine though, so I guess I would just need to separate them on the “Open Screen”-block first, but was this how you ment?

1 Like

The end of the key have a text label such as “orderedList”.

The value should have the variable for the list “myItemsList”.

Thanks, ok so i should create a new label then, called ex ”orderedList, and attach my myItemsList to that? And then also have my myItmsList variable as the value?

Is that how you mean?

I will try this out today! Thanks!

1 Like