Let's say I have a list of dog breeds (about 200 dog breeds), and each breed has a list of diseases (there are about 350 diseases), and I want an app where I select a dog breed and a list of it's possible diseases appear - what would be the easiest way to implement this? Thank you!
You can do this with a two column list:
- breed
- disease common to that breed.
You can import this from a spreadsheet using a Comma Separated Values (CSV) file.
Filter your table (list of lists) using the filter procedures at https://docs.google.com/document/d/12t4HLNRepCnbmcfycdF8wSHWht_D1P8hKJpTknVDChY/edit?usp=sharing
Alternatively, if you represent the data as a JSON dictionary, e.g.:
{
"breed1": ["disease1", "disease2", ...],
"breed2": ["disease3", "disease4", ...]
}
then you can use the get keys block to get a list of the breeds for populating the Elements property of a ListView component. After the user selects an item in the list view, use the get value for key in dictionary block to get the corresponding list.
More considerations:
- How is your raw data arranged?
- do you anticipate reverse queries (which breeds have this disease?)?
I would build up a db:
breed list:
cocker spaniel,1,5,7,9,12
labrador,2,3,4,5,9,14
.....
Where the numbers represent the index of the disease in the disease list