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: 
Tyler_Smith
Binge Watcher

Modify global field after creation

Hi All,

I've noticed that once a field has been created on the new m.global scope I can no longer add or modify its contents.

Example:
m.global.addFields({
content: {}
})


I cannot then add to or modify m.global.content

I have tried the following ways to modify with no avail:
m.global.content.addReplace("test", "1")
m.global.content = {"test, "1"}
m.global.content.test = "1"


Is this expected? Or am I doing something wrong?
Tyler Smith
0 Kudos
3 REPLIES 3
TheEndless
Channel Surfer

Re: Modify global field after creation

Modifying the value doesn't work for me, but resetting it to a new AA does. Your code for that is wrong...
m.global.content = {"test, "1"}

should be...
m.global.content = {"test": "1"}

The latter works for me.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
Tyler_Smith
Binge Watcher

Re: Modify global field after creation

FACE PALM FOR ME.

Ok, so now that a full reset of the field is working is it possible to edit a specific value instead of the whole field?
Tyler Smith
0 Kudos
Tyler_Smith
Binge Watcher

Re: Modify global field after creation

I guess something like this would work

print m.global.content
newcontent = m.global.content
newcontent.test = "1"
m.global.content = newcontent
print m.global.content

newcontent = m.global.content
newcontent.test2 = "2"
m.global.content = newcontent
print m.global.content
Tyler Smith
0 Kudos