Hi everyone,
I understand that deleting values in Firebase is nothing else than updating them to “null” and that sounds simple enough. However, I would like to delete/update 30 values at the same time when a button gets clicked and instead of updating every single one of them, I would love to instead just say "delete all values that you can find under xyz.
I would like to “null” all 30 key/value pairs that are sitting underneath the user ID in the screenshot.
Is there a better/easier/faster way to achieve this rather than going like:
'1. In Realtime DB call Save Workout_Weight/userID/nick_abductionmachine value to null
'2. In Realtime DB call Save Workout_Weight/userID/nick_backextension value to null
[…]
'29.
'30. In Realtime DB call Save Workout_Weight/userID/… value to null
You can set any level of the JSON tree to a null, erasing everything below it.
Also notice I used the CLOUD variable block instead of the RealtimeDB SAVE block. Just use the RealtimeDB KEY as the Variable name in the SET CLOULD block. Boom! No asynchronous issues! You can do the same for the GET block.
Nice, thank you very much!
And thanks for the hint with regards to CLOUD variables. I saw it in the documentation but was hesitant and solved some asynchronous issues through functions. Sounds like it’s worth looking into though.
Hi there, I just started saving values using the Cloud variable now instead of the Realtime DB Save block and it works flawlessly.
I don’t find the documentation very helpful and am now a bit lost how to change my GET blocks accordingly, as you suggested using the Cloud variable can help with asynchronous issues that I have formerly seen with the Realtime DB GET block.
Can you maybe point me the right way?
Thank you,
Antje
Keep the “key” parameter the same when you use the cloud variable block. Use the key value as the cloud variable name, just like you did when changing from the SAVE block.
There is no error block using cloud variables. Anything you have in the THEN DO section can be moved to after the Set block.
If you can share a specific example of just one GET block you are trying to convert, I can try to give more specific suggestions.
Like the screenshot above should make this result below (I manually made this result for illustrative purposes, it doesn’t actually work this way currently)