UI String error

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 …

Hi @shalequa.landry ,
I looked at the code and I’m only seeing one error on line 37.
image
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?

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.

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

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

https://studio.code.org/projects/applab/T66PHUUwuUPUUwGmjRV7A984DWVKMa7V…

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

@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.