Roku Developer Program

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

Get the unique values in array

Hi Everyone,

I am using xml to get the videos from rss feed and in need to show it in Grid screen.

And I am getting the categories list in array with duplicate values while reading the all category tags in xml.

For example,
<title>Good Morning</title>
<title>Good Morning People</title>
<title>Entertainment unchecked</title>

Like this. So, How can I get the unique category names only in the list.

Or is that any method to get unique values from the array.

Anyone please help.

Thank you.
I am using Roku 4 - 4400X Model.
0 Kudos
2 Replies
Level 7

Re: Get the unique values in array

My first thought would be load them into an associative array as the keys, which enforces unique values. You could check for existence first and not add duplicates, or just go ahead and add them (using addreplace), which just becomes a replace. Either way you then walk the keys (for each) and have the distinct values.
FlixRaider channel
0 Kudos

Re: Get the unique values in array

Yes, You are right..

Using roAssociativeArray removed the duplicates.

Thank you very much.
I am using Roku 4 - 4400X Model.
0 Kudos