With Firebase : Equivalent of GetValue (on Firebase component) and Get (API REST with Web component)

Hi

I'm rewriting my App.
Before I was using Firebase component with GetValue and GotValue methods. In Firebase all my data where save as List like this ->

MyApp

  • Users
    • Sam : "["Nickname",false,true,true]"
    • Joe : "["Nickname",false,true,true]"
  • ....
    And GotValue was returning a "MIT APP" list

Now with REST methogs (PutText and Get) how can I do to read my databases values (I don't want to change how the data are saved), what is the best practice ?

If I "PutText" a list, in the database the record is something like that:
MyApp

  • Users
    • Sam :
      • 0: "Nickname"
      • 1: false
      • 2 : true
      • 3 : true

And if I "Get" a record, the JsonTextDecode method cannot convert "["Nickname",false,true,true]" in a MIT App List. The result is [Nickname,false,true,true] and I would like (Nickname",false,true,true)

Regards, thank you

Have a look here:

for some data saving methods

You possible want to use this one to store?:

which creates:

image

and returns a json list (AI2 list)

Thank you for the message but the behaviour isn't excactly the same:

PutText+JsonObjectEncode... generates the following set in Firebase:
Sam: "\"nickname\",\"false\",\"true\",\"true\""

FirebaseDB.StoreValue generates the following set in Firebase:
Sam: "[\"nickname\",false,true,true]"

Yes, the booleans get knocked back to text in the conversion somewhere....

It can be done like this (there are probably other ways....)

image

on Firebase

image

returns:

image

Using the web component means that you can work with firebase the way firebase works, as opposed to how the AI2 experimental firebase component works with firebase for its own ends.

Consider working the firebase way, and modify your blocks to interact with firebase, their way....

Thank you for your help.
Indeed, even if I succeeded to keep the same pattern of dataset in Firebase for using the web component and the FirebaseDB component, I'm a going to abandon this solution and follow your advice.
The "good practice" is to work in the native Firebase way and it's highly improbable that I need to use the FirebaseDB component in my App... so I don't have to take into account how I eventually could use again a GetValue/GotValue methods.

Regards

A convert :smiley:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.