Uistring Error in setText

Can’t figure out why getting uistring error on line 37 and 38 code is
//Chosen Screen
setText(“artistOutput”, chosenArtist);
setText(“chosenSongListOutput”, chosenSong);


//variables
var position = getColumn(“Top 50 USA”, “Position”);
var artist = getColumn(“Top 50 USA”, “Artist”);
var popularity = getColumn(“Top 50 USA”, “Popularity”);
var url = getColumn(“Top 50 USA”, “URL”);
var song = getColumn(“Top 50 USA”, “Track Name”);

//filtered list
var chosenPosition= ;
var chosenArtist = ;
var chosenPopularity = ;
var chosenUrl = ;
var chosenSong = ;
//Home Screen
onEvent(“homeNextButton”, “click”, function(){
setScreen(“chooseScreen”);
});

//chooseScreen
setProperty(“ArtistDropdown”,“options”, artist);
onEvent(“nextChooseButton”,“click”, function(){
appendItem(chosenPosition, “positionInput”);
appendItem(chosenArtist, “ArtistDropdown”);
appendItem(chosenPopularity, “PopulartityLevelDropdown”);
setScreen(“chosenScreen”);
getChosenSong();
});

//Chosen Screen
setText(“artistOutput”, chosenArtist);
setText(“chosenSongListOutput”, chosenSong);

onEvent(“playSongButton”,“click”, function(){
playSound(chosenSong);
});

onEvent(“nextChosenScreen”, “click”, function(){
setScreen(“songListScreen”);
});
//Song List Screen

onEvent(“returnHomeButton”, “click”, function(){
setScreen(“homeScreen”);
});

//Functions
function getChosenSong(){
for(var i = 0; i < song.length; i++) {
if (song[i] == 1){
appendItem(chosenPosition, position[i]);
appendItem(chosenArtist, artist[i]);
appendItem(chosenPopularity, popularity[i]);
appendItem(chosenUrl, url[i]);
}
}
}

1 Like

The error you are getting means you are trying to set a text box to something that isn’t text. In this case, I think you are trying to set the text box to an array. They don’t like that.

Also, song[i] == 1 is probably not going to ever evaluate to true. That appears to be the song name and it won’t match a number.

I have seen that error before. I don’t know where it comes from but I suspect it is in the materials somewhere. Perhaps you could tell me where you saw it.

1 Like