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: 
EnTerr
Roku Guru

rSG field type Array of Dictionaries?!

How the heck do i get myself a roSgNode field with type "array of dictionaries"?
What do i type in <interface><field id="_m" type="???"/> or in node.addField() to make this happen?

No, i am not confused and i don't need "dictionary of arrays" nor "dictionary of anythings". Nor are "array of float", "array of integer", "array of Boolean", "array of string", "array of vector2d", "array of color", "array of time", "array of nodes" of any help. 

I am very reasonable  🙂 - I'll take a strongly-typed or a weakly-typed option, whatever:

  • I wanted an "array of roAssociativeArray" field type

  • In lieu of that, i'll take an "array of Object" field type

  • In lieu of that, i'll take an "array of Dynamic" field type

  • In lieu of that, i'll take an "Object" field type

  • In lieu of that, i'll take a "Dynamic" field type


Here are my attempts so far in order of increasing desperation:
"port 8089" wrote:
=================================================================
Found 1 parse error in XML file _Scene.xml
--- Line 6: <field> element "type" attribute specifies invalid field type "assocarrayarray"

=================================================================
Found 1 parse error in XML file _Scene.xml
--- Line 6: <field> element "type" attribute specifies invalid field type "arrayarray"

=================================================================
Found 1 parse error in XML file _Scene.xml
--- Line 6: <field> element "type" attribute specifies invalid field type "array"

=================================================================
Found 1 parse error in XML file _Scene.xml
--- Line 6: <field> element "type" attribute specifies invalid field type "arrayassoc"

=================================================================
Found 1 parse error in XML file _Scene.xml
--- Line 6: <field> element "type" attribute specifies invalid field type "objectarray"

=================================================================
Found 1 parse error in XML file _Scene.xml
--- Line 6: <field> element "type" attribute specifies invalid field type "dynamicarray"

=================================================================
Found 1 parse error in XML file _Scene.xml
--- Line 6: <field> element "type" attribute specifies invalid field type "object"

=================================================================
Found 1 parse error in XML file _Scene.xml
--- Line 6: <field> element "type" attribute specifies invalid field type "dynamic"
0 Kudos
3 REPLIES 3
TheEndless
Channel Surfer

Re: rSG field type Array of Dictionaries?!

The only way I've found to do that is to set assocarray as the field type, then add your variant/dynamic array to a single element AA.  Hacky, but...

The preferred/recommended way would be to use ContentNodes instead of AAs.
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
EnTerr
Roku Guru

Re: rSG field type Array of Dictionaries?!

"TheEndless" wrote:
The only way I've found to do that is to set assocarray as the field type, then add your variant/dynamic array to a single element AA.  Hacky, but...

For posterity, an illustration of above workaround idea (copied from here😞
' you cant have this: '
myNode.addFields({ myField: [1, 2, 3] })

' however, you can cheat and do this just fine: '
myNode.addFields({ myField: {bless_RSGs_maker: [1, 2, 3]} })


"TheEndless" wrote:
The preferred/recommended way would be to use ContentNodes instead of AAs.

Not really/not anymore though. First, there are indications the Co will be adding (begrudgingly 8-)) direct support for roArray fields in future firmware, so for my money the above hack is better since can be easily changed to the sane way when available.

And second, if one really wants to use a node as container for a list of ContentNodes, at least use an instance of the parent class Node and not another ContentNode - both are equally privileged re thread ownership. The difference being Node does not have all the content-metadata fields junk ("junk" for our specific purpose as container here, not in general).
0 Kudos
EnTerr
Roku Guru

Re: rSG field type Array of Dictionaries?!

Lo and behold - rOS 7.5 introduces a genuine "array" field type!

As seen in the beta but also public news since today. Best said by 
"Eugene Smoliy" wrote:
@JoeT, With 7.5 OS release nodes support array fields. Syntax is following: <field id="myArray" type="array"/>
0 Kudos