Populate a Text Area from a Dataset

Code Link

When the plant is chosen at the end, the info from the dataset should populate to the particular labeled section.

image

How to take specific info from a dataset to be placed in the appropriate place as seen on the app screen?

Just went over this quickly and I am usually wrong, but you are not storing that (or any) information any where in your code. You will need to append to a list when you criteria is met, then call that information later.

if (this[index] == that)
append(filteredList, this[index])

1 Like

Thank you for that. So in code.org, is that the only way to pull info from a dtaset to populate a specific area in the app. Can you not do it wothout it being stored? It seems to defeat the purpose of the dataset. What about using the id’s in the dataset, is that possible?

Hi Rona, I think what you are looking to do is use the getColumn command. This code works with a data set that has been imported and stored the contents of a column as a list in the code.

You can the loop through the list and access values, like in this function:

I hope this helps!

1 Like

Ok, thank you!! I am going to play around with this. My question though is, when getting the data from the dataset, does it have to be put in a list in order to display certain selected parts of the data? So in the app provided above, when a plant is chosen, the ‘light preferences’ , ‘watering’, ‘soil type’…ect will populate from the dataset an fill each one in.

I’m pretty sure that that functionality needs to be written as code in the app. You would need to do a loop through the dataset and check if the appropriate list has values that match the chosen things, and then display the plant type to the screen. Unit 6 of CS principles has many examples of working with data sets and displaying info from them.
Best,
Lindsay

1 Like