# Populate a Text Area from a Dataset

**URL:** <https://forum.code.org/t/populate-a-text-area-from-a-dataset/39047>\
**Category:** Coding and Debugging Help\
**Created:** [February 21, 2024, 5:50pm UTC](https://forum.code.org/t/populate-a-text-area-from-a-dataset/39047 "2024-02-21T17:50:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rona\_williams](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rona\_williams](https://forum.code.org/u/rona_williams)\
**Post date:** [February 21, 2024, 5:50pm UTC](https://forum.code.org/t/populate-a-text-area-from-a-dataset/39047/1 "2024-02-21T17:50:01Z")

</div>

[Code Link](https://urldefense.com/v3/ __https://studio.code.org/projects/applab/Tc9R7mHaUjKQmoCbgH9U3Cd0L2fdOXR7LJVq6VIAJJc__ ;!!PrnngaAx4byl!xEFtlYaCIxW2gHRm-FlAZFGA2x1O-jsYcX7wc8I3Q7ezic5ETLmYGT8f0qIlQzilCsIRVawfuaVwQFqIr7uE6ulZlpTO-w$)

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

![image](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/d/d06ce249d020608daff6535649eb66cf94cc518f.png)

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

---

<div class="post-metadata">

**Author:** ![Mr.Rhodes](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mr.rhodes/32/8260_2.png) [@Mr.Rhodes](https://forum.code.org/u/Mr.Rhodes)\
**Post date:** [February 21, 2024, 6:29pm UTC](https://forum.code.org/t/populate-a-text-area-from-a-dataset/39047/2 "2024-02-21T18:29:20Z")

</div>

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])

---

<div class="post-metadata">

**Author:** ![rona\_williams](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rona\_williams](https://forum.code.org/u/rona_williams)\
**Post date:** [February 26, 2024, 5:50pm UTC](https://forum.code.org/t/populate-a-text-area-from-a-dataset/39047/3 "2024-02-26T17:50:18Z")

</div>

Thank you for that. So in [code.org](http://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?

---

<div class="post-metadata">

**Author:** ![lindsay.davis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lindsay.davis/32/7632_2.png) [@lindsay.davis](https://forum.code.org/u/lindsay.davis)\
**Post date:** [February 26, 2024, 6:46pm UTC](https://forum.code.org/t/populate-a-text-area-from-a-dataset/39047/4 "2024-02-26T18:46:10Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/7/7680b47fede194059c5313f64f345449ace49118.png)

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

 ![image](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/8/82a713b46d92399ef354264f2332fdc052c91213.png)

I hope this helps!

---

<div class="post-metadata">

**Author:** ![rona\_williams](https://avatars.discourse-cdn.com/v4/letter/r/c6cbf5/32.png) [@rona\_williams](https://forum.code.org/u/rona_williams)\
**Post date:** [February 26, 2024, 6:57pm UTC](https://forum.code.org/t/populate-a-text-area-from-a-dataset/39047/5 "2024-02-26T18:57:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lindsay.davis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/lindsay.davis/32/7632_2.png) [@lindsay.davis](https://forum.code.org/u/lindsay.davis)\
**Post date:** [February 26, 2024, 7:15pm UTC](https://forum.code.org/t/populate-a-text-area-from-a-dataset/39047/6 "2024-02-26T19:15:45Z")

</div>

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
