BACKGROUND:
I am writing a B4A/B4i application that will be processing data for a Parent/Child relationship. The data will eventually be stored in a SQLite database locally and also retrieved from a web server too. I'm thinking of storing the data in JSON format and may just store it in a Text field in the table. This will simplify things if I use a REST server to send the JSON text to the B4A/B4i app because it will be a lot less work for the REST server compared to storing the data in a normal CS tables and have the REST server generate the JSON data from the table records before sending it to the client.
But that is not too important at the moment. I am more concerned in how to access this Parent/Child data in the B4A/B4i application.
CURRENT DATA STRUCTURE USES LIST -> TYPE:
Currently I have two Lists, lstParent and lstChild that stores Type data for each item: TrcdParent and TrcdChild are the Types. The TrcdParent and TrcdChild Types consists of a few Strings and numbers with no more than 8 fields. The TrcdChild has a ParentId (UUID) that corresponds to the lstParent item. It currently has to do a manual search on lstParent to find the proper ParentId but that is ok because there won't be too many rows in lstParent, probably no more than a dozen at a time. The lstChild will hold around 10 items per parent. It could go as high as 100 but that will be rare.
ALTERNATIVE USE LIST -> MAP?
Here is my problem. I started playing around with the JSON tutorial and I'm impressed with what can be done with Lists items being able to reference a Map. I am wondering if I should stop using Types and replace it with a Map? The lstParent entry instead of referencing TrcdParent will reference mapParent with a Key=Value pair for each field along with a lstChild (that has the 10-100 items) with each item pointing to a mapChild with a Key=Value pair for each child value for this child record.
So instead of a single TrcdParent type, there will be a map of field value pairs. Instead of a TrcdChild there will be a mapChild with field value pairs.
QUESTION:
My question is, will using a Map for the Parent and Child be too slow or too memory extensive compared to using a Type? I will have to traverse the lstChild entries for a single parent and do some simple tallies and occasionally delete or add a few child rows.
Does anyone have any recommendations?
TIA
I am writing a B4A/B4i application that will be processing data for a Parent/Child relationship. The data will eventually be stored in a SQLite database locally and also retrieved from a web server too. I'm thinking of storing the data in JSON format and may just store it in a Text field in the table. This will simplify things if I use a REST server to send the JSON text to the B4A/B4i app because it will be a lot less work for the REST server compared to storing the data in a normal CS tables and have the REST server generate the JSON data from the table records before sending it to the client.
But that is not too important at the moment. I am more concerned in how to access this Parent/Child data in the B4A/B4i application.
CURRENT DATA STRUCTURE USES LIST -> TYPE:
Currently I have two Lists, lstParent and lstChild that stores Type data for each item: TrcdParent and TrcdChild are the Types. The TrcdParent and TrcdChild Types consists of a few Strings and numbers with no more than 8 fields. The TrcdChild has a ParentId (UUID) that corresponds to the lstParent item. It currently has to do a manual search on lstParent to find the proper ParentId but that is ok because there won't be too many rows in lstParent, probably no more than a dozen at a time. The lstChild will hold around 10 items per parent. It could go as high as 100 but that will be rare.
ALTERNATIVE USE LIST -> MAP?
Here is my problem. I started playing around with the JSON tutorial and I'm impressed with what can be done with Lists items being able to reference a Map. I am wondering if I should stop using Types and replace it with a Map? The lstParent entry instead of referencing TrcdParent will reference mapParent with a Key=Value pair for each field along with a lstChild (that has the 10-100 items) with each item pointing to a mapChild with a Key=Value pair for each child value for this child record.
So instead of a single TrcdParent type, there will be a map of field value pairs. Instead of a TrcdChild there will be a mapChild with field value pairs.
QUESTION:
My question is, will using a Map for the Parent and Child be too slow or too memory extensive compared to using a Type? I will have to traverse the lstChild entries for a single parent and do some simple tallies and occasionally delete or add a few child rows.
Does anyone have any recommendations?
TIA