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.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Channel Surfer

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

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
Channel Surfer

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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.