# UI String error

**URL:** <https://forum.code.org/t/ui-string-error/35787>\
**Category:** CS Principles\
**Tags:** applab\
**Created:** [January 26, 2022, 11:00pm UTC](https://forum.code.org/t/ui-string-error/35787 "2022-01-26T23:00:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shalequa.landry](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@shalequa.landry](https://forum.code.org/u/shalequa.landry)\
**Post date:** [January 26, 2022, 11:00pm UTC](https://forum.code.org/t/ui-string-error/35787/1 "2022-01-26T23:00:15Z")

</div>

I need help with this code. I have two groups that are getting the same error. Both groups have looked at the examples from the weather app and everything appears fine, but they are getting an error.

Please help!

[https://studio.code.org/projects/applab/tR8y4K …](https://paisd.schoology.com/link?a=&path=https%3A%2F%2Fstudio.code.org%2Fprojects%2Fapplab%2FtR8y4KM3bT6LDtTZ7Xr1FI8utU-4jMv-OMZuUN6OyLQ)

---

<div class="post-metadata">

**Author:** ![edavis](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/edavis/32/4927_2.png) [@edavis](https://forum.code.org/u/edavis)\
**Post date:** [January 26, 2022, 11:02pm UTC](https://forum.code.org/t/ui-string-error/35787/2 "2022-01-26T23:02:46Z")

</div>

Hi @shalequa.landry ,  
I looked at the code and I’m only seeing one error on line 37.  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/codeorgforum/original/2X/d/dffe6fb96a6e9724cadee4f8369f1c4c1d049101.png)  
This looks like it just wasn’t finished. Everything around it looks done though. Was this specific line of code meant for something or should it just be removed?

---

<div class="post-metadata">

**Author:** ![shalequa.landry](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@shalequa.landry](https://forum.code.org/u/shalequa.landry)\
**Post date:** [January 26, 2022, 11:20pm UTC](https://forum.code.org/t/ui-string-error/35787/3 "2022-01-26T23:20:49Z")

</div>

The students were adding to onEvent to line 37 but took it off and asked me about the error below. They will fix line 37 on Friday.  
If you click run then select the breed of the dog it gives the error below for lines 29,30,31,32

Line: 29: setText() text parameter value (12) is not a uistring.WARNING: Line: 30: setText() text parameter value (Working) is not a uistring.WARNING: Line: 31: setText() text parameter value (34) is not a uistring.WARNING: Line: 32: setText() text parameter value (120) is not a uistring.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [January 27, 2022, 5:46am UTC](https://forum.code.org/t/ui-string-error/35787/4 "2022-01-27T05:46:03Z")

</div>

The uiString errors are happening because setText is looking for a string to display, but the variables you are trying to display are arrays. To avoid the errors, you have to use a string instead of an array.

There are a few ways to do that. One would be to create variables to capture the array values as a string using the .toString method.

Here’s an example of how to do that …

var breedString = breedData.toString();  
…  
setText(“breedGroupOutput”, breedString);

Something like this should clear up the errors, but there are probably other ways to do it as well.

Hope this helps!

Mike

---

<div class="post-metadata">

**Author:** ![shalequa.landry](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@shalequa.landry](https://forum.code.org/u/shalequa.landry)\
**Post date:** [February 1, 2022, 5:05pm UTC](https://forum.code.org/t/ui-string-error/35787/6 "2022-02-01T17:05:37Z")

</div>

Thank you this did resolve. I too noticed they didn’t declare their varibles.

---

<div class="post-metadata">

**Author:** ![shalequa.landry](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@shalequa.landry](https://forum.code.org/u/shalequa.landry)\
**Post date:** [February 1, 2022, 5:06pm UTC](https://forum.code.org/t/ui-string-error/35787/7 "2022-02-01T17:06:37Z")

</div>

[https://studio.code.org/projects/applab/T66PHUUwuUPUUwGmjRV7A984DWVKMa7V…](https://studio.code.org/projects/applab/T66PHUUwuUPUUwGmjRV7A984DWVKMa7VR7fGG4FSym4)

We did the same with this one, but still gets the error. They followed the weather app to design theres. Can you assist?

---

<div class="post-metadata">

**Author:** ![terence.stone25](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/terence.stone25/32/5124_2.png) [@terence.stone25](https://forum.code.org/u/terence.stone25)\
**Post date:** [February 2, 2022, 3:48am UTC](https://forum.code.org/t/ui-string-error/35787/8 "2022-02-02T03:48:30Z")

</div>

@shalequa.landry This app has some of the same errors that @mwood mentioned. setText() needs to get a string that will be displayed on the screen. Using songTrackName[index] is beyond the limitations of the code block. Use the above example to guide you.

---

<div class="post-metadata">

**Author:** ![clemmon1](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@clemmon1](https://forum.code.org/u/clemmon1)\
**Post date:** [November 21, 2024, 6:32pm UTC](https://forum.code.org/t/ui-string-error/35787/9 "2024-11-21T18:32:11Z")

</div>

I found that adding +“” to the end fixes the error
