Hello all,
Am a newbie trying to use KVS for the first time ever. I've done a lot with PostgreSQL and SQLite but never KVS.
Having a mental block with its use:
With SQL, the table name(s) and columns are set in advance of using it. Following some sample code for a sign in, that part all works correctly. But when I want to add more fields to KVS, the original login credentials are overwritten. So it is obvious that I do not have the mapping or the fields set correctly.
This is the save code that works
But later, in a different form (following a successful sign up and login) another form wants to add more fields in this save data sub:
When it does the callback to B4XPages.MainPage.load_fields this is the code that is used, but there really is not a need for that - I think?
What is the correct way to prepare and use KVS?
Is it possible/advisable to *add* fields on the fly? If not where and how are they set up?
Should only 1 map be used that contains all fields?
Any other hints would be really welcomed!
Thank you!
Tim
Am a newbie trying to use KVS for the first time ever. I've done a lot with PostgreSQL and SQLite but never KVS.
Having a mental block with its use:
With SQL, the table name(s) and columns are set in advance of using it. Following some sample code for a sign in, that part all works correctly. But when I want to add more fields to KVS, the original login credentials are overwritten. So it is obvious that I do not have the mapping or the fields set correctly.
This is the save code that works
B4X:
B4XPages.MainPage.dados = CreateMap( _
"first_name":et_first_name.Text.Trim , _
"last_name":et_last_name.Text.Trim , _
"email":et_email.Text.Trim , _
"password":et_password.Text.Trim )
File.WriteMap(xui.DefaultFolder,"dados.txt",B4XPages.MainPage.dados)
But later, in a different form (following a successful sign up and login) another form wants to add more fields in this save data sub:
B4X:
B4XPages.MainPage.dados = CreateMap( _
"siteno":et_siteno.Text.Trim , _
"gatecode":et_gatecode.Text.Trim)
File.WriteMap(xui.DefaultFolder,"dados.txt", B4XPages.MainPage.dados)
B4XPages.MainPage.load_fields
When it does the callback to B4XPages.MainPage.load_fields this is the code that is used, but there really is not a need for that - I think?
B4X:
public Sub load_fields
If ( dados.ContainsKey("email") And dados.ContainsKey("password") ) Then
et_email.Text = dados.Get("email")
et_password.Text = dados.Get("password")
End If
End Sub
What is the correct way to prepare and use KVS?
Is it possible/advisable to *add* fields on the fly? If not where and how are they set up?
Should only 1 map be used that contains all fields?
Any other hints would be really welcomed!
Thank you!
Tim