Roku Developer Program

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

Example of Creating Custom Field in Task

Can somebody post an example of how to create a custom field. I have a task that runs, gets data from server, parses the data. I would like to assign part of the parse to a custom field name but have been unsuccessful in creating the custom field. Just putting it in the interface doesn't seem to do it. I have created an extends of the Task and added the field but I am not sure how to tell the Task an extend exists. I have something like the following:
<component name = "programContentReader" extends = "Task" >
  <field id = "content" type = "node" />
 <field id = "myfield" type = "string" />
  <script type = "text/brightscript" >
    sub init() = "readcontent"
    end sub

Function readcontent() as object
content = CreateObject("roSGNode", "ContentNode")
Stuff going on here to parse

dataItem = content.CreateChild("ContentNode")
dataitem.myfield= whatever is in parse
end function

Extend of Task
<component name="extendprogram" extends="ContentNode" >
    <field id ="myfield" type="string" />
0 Kudos
Level 11

Re: Example of Creating Custom Field in Task

What you have posted is a jumble and makes no sense! 
No offense meant, it just seems you are not sure what you want to do - your code pokes in all directions.

Two things though - are you trying something that is in a beta version of the firmware?! If so, you are under NDA on it - ask in the beta forum!

And there is no need to pre-declare in interface, creating a custom filed is as easy as:
dataItem.addFields({myField: "some value here - string or array or dictionary"})
0 Kudos
Level 8

Re: Example of Creating Custom Field in Task

None taken what so ever.  I was using the SimpleMarkupList example as sort of a guide, but was making it harder than it needed to be. I think I was mixing in group as in the example when I didn't need to.  Thanks for pointing me in the right direction.
0 Kudos