Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 

Type Mismatch Error

Type Mismatch Error
Function iterateOverSeriesList(series As Object) As Object
        shows = CreateObject("roArray", 50, true)
sublang=GetLocale()
print "sublang : " sublang

'print series.movies.count()


for each movie in series.movies

'print  movie.languages
'print "movies.languages[sublang] : ";movie.languages[sublang]

if movie.languages<>invalid
if movie.languages[sublang]<> invalid 
if movie.languages[sublang].title=Invalid 
movie.languages[sublang].title = "Title Not Available"
end if
if  movie.languages[sublang].cover_art = Invalid
movie.languages[sublang].cover_art = ""
end if
end if
r = CreateObject("roRegex", "https", "")
mov =movie.languages[sublang]
if(mov.cover_art="")
print "Image Not Available"
strHDposterUrl =  r.ReplaceAll(mov.cover_art, "http")
strSDPosterUrl =  r.ReplaceAll(mov.cover_art, "http")

else 
'print "Image is Available"
strHDposterUrl =  r.ReplaceAll(mov.cover_art, "http")
strSDPosterUrl =  r.ReplaceAll(mov.cover_art, "http")
'print "@@@@@@@@@@@@@@@@"
'print mov.title
'print mov.cover_art
'print "@@@@@@@@@@@@@@@@"
end if
movieTitle=mov.title
else 
r = CreateObject("roRegex", "https", "")
strHDposterUrl =  r.ReplaceAll(movie.cover_art, "http")
strSDPosterUrl =  r.ReplaceAll(movie.cover_art, "http")
movieTitle = movie.title
end if

'for each lang in movie.languages
' print "-----------"
' print lang[sublang]
' print "-----------"
'end for

'r = CreateObject("roRegex", "https", "")
'strHDposterUrl =  r.ReplaceAll(movie.languages.es.cover_art, "http")
'strSDPosterUrl =  r.ReplaceAll(movie.languages.es.cover_art, "http")
strLength = 0
if movie.duration <> ""
strToken  =  box(movie.duration).tokenize(":")
if strToken.Count() = 3
strLength = strToken[0].toint()*60*60+strToken[1].toint()*60+strToken[2].toint()
else if  strToken.Count() = 2
strLength = strToken[0].toint()*60+strToken[1].toint()
else
strLength = strToken[0].toint()
end if
end if
arrayShow = {
Title : movieTitle
rating:series.name,
Description : movie.description
hdBranded : movie.supports_hd
HDPosterUrl : strHDposterUrl
SDPosterUrl : strSDPosterUrl
length: strLength,
}
shows.push(arrayShow)
        end for
    return shows
End Function



291:        for each movie in series.movies
292:
293:            'print  movie.languages
294:
295:            'print "movies.languages[sublang] : ";movie.languages[sublang]
296:            if movie.languages<>invalid
297:*               if movie.languages[sublang]<> invalid
298:                    if movie.languages[sublang].title=Invalid
299:                        movie.languages[sublang].title = "Title Not Availabl
e"
300:                    end if
301:                    if  movie.languages[sublang].cover_art = Invalid
Type Mismatch. (runtime error &h18) in pkg:/source/appGridScreen.brs(297)
297:                if movie.languages[sublang]<> invalid
Backtrace:
#3  Function iterateoverserieslist(series As Object) As Object
   file/line: pkg:/source/appGridScreen.brs(297)


please help
0 Kudos
3 Replies
belltown
Level 7

Re: Type Mismatch Error

I'm guessing that sublang is not an Integer, so it can't be used as an array index.
https://github.com/belltown/
0 Kudos

Re: Type Mismatch Error

thanks sir
0 Kudos
Komag
Level 9

Re: Type Mismatch Error

Seems like sublang would likely be a string there, and work as an Associative Array key
0 Kudos