Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
agmark
Visitor

Displaying parsed data in Breadcrumb

I'm parsing a feed and I'd like to do a simple count of all items that meet a certain criteria and then pass this number along with the other parsed data to the subsequent PosterScreens and have this number displayed in the left Breadcrumb field. I'm adding the count to the content array using...
myCount = myCount + 1		'count how many items meet criteria
content.myItemCount = myCount

Then in the PosterScreen and SpringBoard screens, I assume I need to display the count using something like...
screen.SetBreadcrumbText(myitemcount, rightBread)


I"m confused on what initializations and conversions need to be done. I've been trying various Str() and Stri() conversions, but I'm still not able to get anything to display in the Breadcrumb field. It's possibly syntax issues since that seems to be what trips me up to most. To keep it simple, how would you count each item in an XML feed and pass this on to be used in a Breadcrumb?
TIA
0 Kudos
6 REPLIES 6
belltown
Roku Guru

Re: Displaying parsed data in Breadcrumb

First, make sure you have enabled display of the breadcrumb text:

screen.SetBreadcrumbEnabled (true)


Then try this:

screen.SetBreadcrumbText (content.myItemCount.ToStr (), rightBread)


To count the items in an XML feed:

xmlFeed.Item.Count ()


or if you want it as a string:

xmlFeed.Item.Count ().ToStr ()
0 Kudos
agmark
Visitor

Re: Displaying parsed data in Breadcrumb

Didn't do it. The snippet below gives the error.
The data item is being added ok to the array because I do a PrintAA(episode) and it includes the item myitemcount: 1

Interface not a member of BrightScript Component (runtime error &hf3) in ...pkg:
/source/EpisodeScreen.brs(18)

018: screen.SetBreadcrumbText(content.myItemCount.ToStr (), rightBread)

Local Variables:
show &h4010 bsc:roAssociativeArray, refcnt=3
leftbread &hc010 bsc:roString (2.1 was String), refcnt=2
rightbread &h0100 String (VT_STR_CONST) val:
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=4
screen &h0010 bsc:roPosterScreen, refcnt=2
mrss &h0010 bsc:roAssociativeArray, refcnt=1
content &h0010 bsc:roArray, refcnt=2
selectedepisode &h0002 Integer val:0
msg &h0000 <uninitialized> val:Uninitialized
BrightScript Debugger>


Then the EpisodeScreen is setup with the following.

sub ShowEpisodeScreen(show, leftBread, rightBread)
screen = CreateObject("roPosterScreen")
screen.SetMessagePort(CreateObject("roMessagePort"))
screen.SetListStyle ("arced-landscape")
screen.SetBreadcrumbEnabled (true) 'added
screen.Show()

mrss = NWM_MRSS(show.url)
content = mrss.GetEpisodes()
selectedEpisode = 0
screen.SetContentList(content)

screen.SetBreadcrumbText(content.myItemCount.ToStr (), rightBread)
screen.Show()
...
0 Kudos
agmark
Visitor

Re: Displaying parsed data in Breadcrumb

Sorry, I didn't scroll my screen down to your last 2 comments. Let me double check those with my code and see if that works.
0 Kudos
belltown
Roku Guru

Re: Displaying parsed data in Breadcrumb

The runtime error is because you haven't set content.myItemCount to anything.
0 Kudos
agmark
Visitor

Re: Displaying parsed data in Breadcrumb

It shows up when I PrintAA and print out the entire episode data. There's a line item of: myitemcount: 1
0 Kudos
RokuMarkn
Visitor

Re: Displaying parsed data in Breadcrumb

Don't you want episode.myItemCount rather than content.myItemCount? content is an array, not an AA.

--Mark
0 Kudos