m.top.content = Contentm.top is the Task? does it have a field "content" declared in the interface? put a debug "? m.top.content" right after it to see if value got stored.
data = m.ContentTaskp.getChildren(1e4, 0)aren't you missing ".content."? as in "m.ContentTaskp.content.getChildren("
"EnTerr" wrote:
btpoole -
there are pieces of info missing in your explanation, so i would have to guess.m.top.content = Content
m.top is the Task? does it have a field "content" declared in the interface? put a debug "? m.top.content" right after it to see if value got stored.data = m.ContentTaskp.getChildren(1e4, 0)
aren't you missing ".content."? as in "m.ContentTaskp.content.getChildren("
"EnTerr" wrote:
btpoole -
there are pieces of info missing in your explanation, so i would have to guess.m.top.content = Content
m.top is the Task? does it have a field "content" declared in the interface? put a debug "? m.top.content" right after it to see if value got stored.data = m.ContentTaskp.getChildren(1e4, 0)
aren't you missing ".content."? as in "m.ContentTaskp.content.getChildren("
"btpoole" wrote:
What if the m.top.content=Content is not showing the values? I have noticed this happening in past where ?data (in this case) shows the values but the m.top.content does not, like the Content is not wrapping the data into the contentnode.
"EnTerr" wrote:"btpoole" wrote:
What if the m.top.content=Content is not showing the values? I have noticed this happening in past where ?data (in this case) shows the values but the m.top.content does not, like the Content is not wrapping the data into the contentnode.
It would mean the assignment "did not work", one example would be if the field has not been declared (or dynamically added) in advance. You'd think that will cause runtime error, assigning to a non-existent field? Good thinking but no - there is a bug in RSG, in which it silently ignores such assignments without complaining...
"EnTerr" wrote:"btpoole" wrote:
What if the m.top.content=Content is not showing the values? I have noticed this happening in past where ?data (in this case) shows the values but the m.top.content does not, like the Content is not wrapping the data into the contentnode.
It would mean the assignment "did not work", one example would be if the field has not been declared (or dynamically added) in advance. You'd think that will cause runtime error, assigning to a non-existent field? Good thinking but no - there is a bug in RSG, in which it silently ignores such assignments without complaining...
Content = CreateObject("roSGNode", "ContentNode")
for each item in result
data=Content.createChild("ContentNode")
data.addfields( { resultfield: {result:[item] } } )
end for
?data <<<<<<<<<<< ACCEPTS FIELD resultfield
?CONTENT <<<<<<<<<<<< NEVER WRAPS data
m.top.content=data
sub setGridcontent()
?"in setGridcontent"
data=m.ContentTaskp.content
?data
end sub
"btpoole" wrote:sub setGridcontent()
?"in setGridcontent"
data=m.ContentTaskp.content
?data
end sub
When this executes, the ?data displays the following
<Component: roSGNode> =
{
metadata: <Component: roContentMetadata>
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id:
resultfield: <Component: roAssociativeArray> <<<<< RESULTFIELD is part of the contentnode
}
How can I get into the resultfield? Have tried to set data=m.ContentTaskp.content.getChildren(1e4, 0) and run a loop but no luck, returns an empty roArray. Is resultfield not a child of the node?
"EnTerr" wrote:"btpoole" wrote:sub setGridcontent()
?"in setGridcontent"
data=m.ContentTaskp.content
?data
end sub
When this executes, the ?data displays the following
<Component: roSGNode> =
{
metadata: <Component: roContentMetadata>
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id:
resultfield: <Component: roAssociativeArray> <<<<< RESULTFIELD is part of the contentnode
}
How can I get into the resultfield? Have tried to set data=m.ContentTaskp.content.getChildren(1e4, 0) and run a loop but no luck, returns an empty roArray. Is resultfield not a child of the node?
Sorry, i have to admit i couldn't quite follow your explanation - seems to me parts are missing and it's really hard to decode everything when there is no single piece of code.
This said, i will take a guess on the above: given that `m.ContentTaskp.content` in setGridContent() prints what you showed, you should be able to find the array you stored in `m.ContentTaskp.content.resultfield.result`. Did it have to be that complicated - probably not but that's where it seems you put it.
And no - node fields are different from node children, so can't enumerate them like so. That's conceptually close to HTML, if you consider the nested html tags as "children" and a tag's attributes as "fields".
data=content.createchild("ContentNode")
data.addfields( { resultfield: {result:[item] } } )
myNode.addFields({ myField: {bless_RSGs_maker: [1, 2, 3]} })
"btpoole" wrote:
What I was mostly concerned with was that in the Task where m.top.content=content doesn't work. The content being content=createobject("rsgnode", "ContentNode"). The content never incorporates the added fields. Looking back into what I posteddata=content.createchild("ContentNode")
data.addfields( { resultfield: {result:[item] } } )
the content doesn't take in the data, so I set m.top.content=data and it worked. I was under the impression that you create a node (content in this case), then contentnode (data in this case) and then addfields to data. The data would be taken in by the content. At least this is something like I had done in another Task.
...
Well, not sure why the data is not added to the content. Thanks for your advice and guidance thru out you have been most helpful to me many times on the forum.
<node>
<contentNode resultField="{result: [item]}">
</contentNode>
</node>
"EnTerr" wrote:"btpoole" wrote:
What I was mostly concerned with was that in the Task where m.top.content=content doesn't work. The content being content=createobject("rsgnode", "ContentNode"). The content never incorporates the added fields. Looking back into what I posteddata=content.createchild("ContentNode")
data.addfields( { resultfield: {result:[item] } } )
the content doesn't take in the data, so I set m.top.content=data and it worked. I was under the impression that you create a node (content in this case), then contentnode (data in this case) and then addfields to data. The data would be taken in by the content. At least this is something like I had done in another Task.
...
Well, not sure why the data is not added to the content. Thanks for your advice and guidance thru out you have been most helpful to me many times on the forum.
I have no idea what "m.top.content" is supposed to be in your Task, because you have not posted example. It is really, really frustrating to work like that and i will stop. Next time make small and very clear example that contains 100% of the relevant code. Not something to guess. Also see if you can use the "free Roku clinic" chat room - doing it interactively should be less frustrating than trying to read mind from a distance.
The child node is getting added to the parent. Perhaps you are confused about what `createChild()` does - it creates a new ContentNode and attaches it as a child to "content" (whatever is there, i have no idea, i assume some Node subclass). That does NOT however create any field for it, so you cannot find data inside content by indexing like content.data. Instead you should be using one of the https://sdkdocs.roku.com/display/sdkdoc ... deChildren methods to find it later. What i said about HTML/XML analogy, you are creating something like this (make-believe, if it helps your thinking):<node>
<contentNode resultField="{result: [item]}">
</contentNode>
</node>
Content = CreateObject("roSGNode", "ContentNode")
for each item in result
data=Content.createChild("ContentNode")
data.addfields( { resultfield: {result:[item] } } ) <<<<<<<<<<data is not created as child of of ContentNode
end for
?data <<<<<<<<<<< ACCEPTS FIELD resultfield
?CONTENT <<<<<<<<<<<< NEVER WRAPS data
m.top.content=data
'm.top.content=content <<<<<<<<<<<<<<<<<<THIS DOES NOT WORK