0

I'm working on a scenegraph GridView app. All of the row items are all lowercase.

I would like to convert them to Upper case.

I am using Roku Scenegraph Developer Extensions. (SGDex)

I have tried using UCase on the RowAA. This does change the title to Upper Case, but it breaks the script.

ie...

title: UCase(fieldInJsonAA)

    if fieldInJsonAA = "movies" or fieldInJsonAA = "series"

        mediaItemsArray = jsonAA[fieldInJsonAA]
        itemsNodeArray = []
        for each mediaItem in mediaItemsArray
            itemNode = ParseMediaItemToNode(mediaItem, fieldInJsonAA)
            itemsNodeArray.Push(itemNode)
        end for
        rowAA = {
           'title: fieldInJsonAA
           title: UCase(fieldInJsonAA)
           children: itemsNodeArray
        }

The method I tried the in Example does Change the row title to Upper Case. However, it breaks the script.

MarlonC
  • 67
  • 6
  • Can you show the error you're getting? – juliomalves Sep 22 '19 at 15:30
  • It doesn't display an error. It shows the row title as upper case, but the poster images disappear and nothing happens when you click on a row selection. It seems that the script only responds to lower case row titles. – MarlonC Sep 22 '19 at 21:31

2 Answers2

1

I figured it out. By default, the DetailsView expects the row title to be lower case, so it was omitting the 'play' or the 'episode' button when I changed it.

By changing the Details view as follows, this allows the script to run with upper or lower case.

Details View...

`''' Default Code''' 

if currentItem.url <> invalid and currentItem.url <> "" 
    buttonsToCreate.Push({ title: "Play", id: "play" }) 
else if details.content.TITLE = "series" 
    buttonsToCreate.Push({ title: "Episodes", id: "episodes" }) 
end if 

''''''''

''' Updated Code that works with lower or upper case''' 

if currentItem.url <> invalid and currentItem.url <> "" 
    buttonsToCreate.Push({ title: "Play", id: "play" }) 
else if details.content.TITLE = "series" 
    buttonsToCreate.Push({ title: "Episodes", id: "episodes" }) 
else if details.content.TITLE = "SERIES" 
    buttonsToCreate.Push({ title: "Episodes", id: "episodes" }) 
end if 

''''''''`
MarlonC
  • 67
  • 6
0

Can You try with something like this:

rowAA = {}
rowAA.title = UCase(fieldInJsonAA)
rowAA.children = itemsNodeArray

Or

rowAA = {}
rowAA["title"] = UCase(fieldInJsonAA)
rowAA["children"] = itemsNodeArray

EDIT: I initially understood that script doesn't compile.

What I notice is that in Your ParseMediaItemNode method You are passing fieldInJsonAA without upperCase and then after it in rowAA You are passing the same fieldInJsonAA but but with upper case. Try to pass it in upper case in ParseMediaItemNode as well and check what happens. That's a wild guess since I don't know much about script You are using.

U.Mitic
  • 744
  • 1
  • 6
  • 14
  • I get the exact same results either way. Actually what is happening is that when you click on the row item, you lose the play (movies) button, or the episode (series) button on the details view. – MarlonC Sep 22 '19 at 23:08
  • Oh, sorry to hear that...I initially understood that script doesn't compile/breaks. What I notice is that in Your ParseMediaItemNode method You are passing fieldInJsonAA without upperCase and then after it in rowAA You are passing the same fieldInJsonAA but but with upper case. Try to pass it in upper case in ParseMediaItemNode as well and check what happens. That's a wild guess since I don't know much about script You are using. – U.Mitic Sep 22 '19 at 23:15
  • Thanks for the suggestion, I'll try that. The script I'm using is a standard GridView from Roku SGDEX (scenegraph developer extenssions. - – MarlonC Sep 23 '19 at 03:38
  • I figured it out. I needed to edit the DetailsView as well. I will add my solution in the answer. Thanks. – MarlonC Sep 23 '19 at 04:43