btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2017
06:56 PM
Field "Created" -Well Maybe Not
I have seen others post about this problem and have run into it also but with help was able to work thru, except now. I am using the following code to create a child of a contentnode, add a field, assign a value. When executed, the code says the field is created but really it's not.
Have also tried
I basically coped the second code from another part of my app that works fine. The print of dataitem.zip displays correctly but the print of the content doesn't show the field as being added. What else could be done?
content = CreateObject("roSGNode", "ContentNode")
dataItem = content.CreateChild("ContentNode")
dataItem.addfield("zip", "string", false)
?"HAS FIELD "dataItem.hasfield("zip")
dataItem.zip=zipc
m.top.content=content
?content
?dataitem.zip
Have also tried
content = CreateObject("roSGNode", "ContentNode")
dataItem = content.CreateChild("ContentNode")
dataItem.addfields({"zip" : zipc})
?"HAS FIELD "dataItem.hasfield("zip")
?content
?dataitem.zip
I basically coped the second code from another part of my app that works fine. The print of dataitem.zip displays correctly but the print of the content doesn't show the field as being added. What else could be done?
2 REPLIES 2
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2017
08:13 PM
Re: Field "Created" -Well Maybe Not
You are looking in the wrong place - print DataItem and you will see it.
That printing DataItem's parent Content does not print its children nodes is unsurprising. It only prints the fields. But ask for the 1st child and you'll see it:
That printing DataItem's parent Content does not print its children nodes is unsurprising. It only prints the fields. But ask for the 1st child and you'll see it:
Brightscript Debugger> ? content.getChild(0) ' = dataItem `
<Component: roSGNode> =
{
metadata: <Component: roContentMetadata>
change: <Component: roAssociativeArray>
focusable: false
focusedChild: <Component: roInvalid>
id: ""
zip: "zipC"
}
btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2017
06:02 AM
Re: Field "Created" -Well Maybe Not
Thanks EnTerr, once again you have the answer.