# Unit 5 Hackathon States Data

**URL:** <https://forum.code.org/t/unit-5-hackathon-states-data/34388>\
**Category:** Unit and Lesson Discussion\
**Created:** [March 12, 2021, 1:18am UTC](https://forum.code.org/t/unit-5-hackathon-states-data/34388 "2021-03-12T01:18:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marla\_s\_rudnick](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@marla\_s\_rudnick](https://forum.code.org/u/marla_s_rudnick)\
**Post date:** [March 12, 2021, 1:18am UTC](https://forum.code.org/t/unit-5-hackathon-states-data/34388/1 "2021-03-12T01:18:59Z")

</div>

I am trying to help two student partners with their [code](https://studio.code.org/projects/applab/iITDlfUg2xvaZMvpKs0DkuOs5G_vA3U0VaiAZ03A0HM). Lines 36 and 37 were their ideas to get the filteredStateNames and filteredStateImages to appear. I tried to use line 38 and 39 to help them but am getting uistring errors. Any thoughts??  
They are using the US states data set.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![letti42](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@letti42](https://forum.code.org/u/letti42)\
**Post date:** [March 12, 2021, 2:46am UTC](https://forum.code.org/t/unit-5-hackathon-states-data/34388/2 "2021-03-12T02:46:50Z")

</div>

The reason this is happening is that you added an extra comma inside the setText and setImageURL, so the app doesn’t know what to do. From reading your students’ code, it looks like you would instead need to use `setText("stateNameText", filteredStateNames[randomNumber(0, filteredStateNames.length)]);`  
and the same for setImageURL.  
However, since setText and setImageURL are both creating random numbers, their results will almost always be different. To change this, create something like this: `var randomState = randomNumber(0, filteredStateNames.length;`, then replacing your setText and setImageURL with `"stateNameText", filteredStateNames[randomState]);`

PS: remind your students to always check for spelling errors. In both the setText and setImageURL the filteredStateNames.length was spelt wrong.

Sorry if this was a lot to take in, but I hope it helps your students!

---

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [March 12, 2021, 3:53pm UTC](https://forum.code.org/t/unit-5-hackathon-states-data/34388/3 "2021-03-12T15:53:26Z")

</div>

There are also two onEvent calls for `"filterDropDown"`. One for click and one for change. Having two doesn’t hurt but click doesn’t work that well with dropdown boxes.

---

<div class="post-metadata">

**Author:** ![marla\_s\_rudnick](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@marla\_s\_rudnick](https://forum.code.org/u/marla_s_rudnick)\
**Post date:** [March 18, 2021, 1:38am UTC](https://forum.code.org/t/unit-5-hackathon-states-data/34388/4 "2021-03-18T01:38:49Z")

</div>

Thanks so much. After a while my mind gets bogged down trouble shooting code.
