1

I am using Guide template language to pull content from a remote url.

This works but takes the title from too high up in json structure:

{{.dataobject JsonVar type=variable source=@json maxrows=3}}
{{.data}}
{"target":"@json"}
{{/data}}
{{/dataobject}}

{{#each JsonVar}}
{{title}}
{{/each}}

(I need the each-function to be there since I have some functions there) So since title is pulled from top item I need to get the title from the sub item, and that is the part that doesn't work:

{{.dataobject JSONVar type=variable maxRows = 1}}
{{.data}}
{ "target" : "@json" }
{{/data}}

{{.dataobject items type=nested maxRows = 3}}
{{.data}}
{ "target" : "JsonVar.items" }
{{/data}}

{{/dataobject}}
{{/dataobject}}

{{#each items}}
{{title}}
{{/each}} 

But I keeep getting this error when I try the last version:

The data source referenced by a Guide Each tag was not found. JobID: 0 SlotID: 0 DataSourceIDType: Unspecified DataSourceID: items Guide Tag: {{#each items}} Tag Index: 2605

So how can I access items in a sub item and still use #each?

  • Can you post the XML? Hard to help without it. – Adam Spriggs Jan 8 '17 at 3:32
  • I solved it using TreatAsContent("{{items.title}}") – Tove Walden Jan 8 '17 at 7:11
2

I would use datasource instead of dataobject in the example you provided. Simply replace the four occurrences of dataobject with datasource, then move your two closing {{/datasource}} tags after the closing {{/each}} tag and that should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.