Hey Aury,
I didn't have any luck with your latest snippet, but I have been making good progress otherwise.
There are two problems I've encountered that have worried me.
The story slug doesn't populate in DashBoard in any way, although it shows up correctly in the XML file itself.
The other is the run order list---your templates reference the run orders by index, but I haven't been able to convert the run order list to include the index of each run order---what I'm hoping for is a pulldown where I can select run order by name and then reference its index in the script to make the selection.
I've found posts in the community that I thought might point me in the right direction, but I haven't been able to make them work.
Any ideas what happens to the slug? Is it too long? I'm not at work yet, but it might be a concatenation of two columns separated by a hyphen--- would that explain it?
Is the run order pulldown possible?
Thanks,
James.
------------------------------
James Hessler
WAAY TV (ALLEN MEDIA BROADCASTING)
------------------------------
Original Message:
Sent: 11-14-2024 12:50
From: Aury Rukazana
Subject: Using XML in DahBoard
Hey James,
Can you clarify further on the xml updating automatically? You want to have the xml on your local machine be updated? Or the xml that has already been loaded by DashBoard? You can load the xml and create an object that references it and make updates to the object as needed.
var runningOrdersObject= ogscript.parseXML('runningorders.xml'); // read the xml ogscript.putObject('orders',myObject); // store the xml in a an objectvar myStoredObject= ogscript.getObject('orders'); // read the object
------------------------------
Cheers,
Aury Rukazana
Senior Software Developer
Ross Video
------------------------------
Original Message:
Sent: 11-13-2024 22:00
From: James Hessler
Subject: Using XML in DahBoard
Hey Aury,
I've been able to spend some time in DashBoard and made a table that references the stories in running order 0, or running order 1, basically by index and so on.
I'd like a way to have the xml update automatically without refreshing/reloading, but I'm not sure that is possible at all.
I'm working on being able to chose the rundown by name as the index scares me---what if somebody created a new rundown or disabled running order 0---I'm thinking that the indices would shuffle and I'd be lost or suddenly in another rundown.
I'm out of time tonight, so I'll look again tomorrow.
Thanks again, James.
------------------------------
James Hessler
WAAY TV (ALLEN MEDIA BROADCASTING)
Original Message:
Sent: 11-12-2024 16:26
From: Aury Rukazana
Subject: Using XML in DahBoard
Hi James,
The only thing that I could point out is that you are trying to get the attributes on the variable called "node" when your node is called "ronode". Here is a custom panel example which uses struct parameters to load the XML data and set it into a struct array.
<abs contexttype="opengear" id="_top" keepalive="false"> <meta> <params> <param access="1" constrainttype="STRUCT" name="story_template" oid="story_template" type="STRUCT" widget="table"> <value> <subparam access="1" maxlength="0" name="Id" suboid="id" type="STRING" value="" widget="default"/> <subparam access="1" maxlength="0" name="Slug" suboid="slug" type="STRING" value="" widget="default"/> <subparam access="1" maxlength="0" name="Headline" suboid="headline" type="STRING" value="" widget="default"/> <subparam access="1" maxlength="0" name="Qualifier" suboid="qualifier" type="STRING" value="" widget="default"/> <subparam access="1" maxlength="0" name="Status" suboid="status" type="STRING" value="" widget="default"/> </value> </param> <param access="1" constrainttype="STRUCT" name="ro_template" oid="ro_template" type="STRUCT" widget="table"> <value> <subparam access="1" maxlength="0" name="Id" suboid="id" type="STRING" value="" widget="default"/> <subparam access="1" maxlength="0" name="Slug" suboid="slug" type="STRING" value="" widget="default"/> <subparam access="1" maxlength="0" name="Stories" suboid="stories" templateoid="story_template" type="STRUCT_ARRAY" value="" widget="table"/> </value> </param> <param access="1" constrainttype="STRUCT" name="running_orders" oid="running_orders" templateoid="ro_template" type="STRUCT_ARRAY" widget="table"> </param> </params> <ogscript/> </meta> <meta> <api immediate="true">function initXMLData(){ var document = ogscript.parseXML("orders.xml"); var running_orders = document.getElementsByTagName("ro"); for(var i = 0; i < running_orders.getLength(); i++) { var ro_node = running_orders.item(i); if(ro_node != null) { var roid = ro_node.getAttribute("roid"); var ro_slug = ro_node.getAttribute("slug"); var stories = ro_node.getElementsByTagName("story"); var stories_data = []; if(stories.getLength() > 0) { for(var j = 0; j < stories.getLength(); j++) { var story = stories.item(j); if(story != null) { var data = { id: story.getAttribute("id"), slug: story.getAttribute("story_slug"), headline: story.getAttribute("headline"), qualifier: story.getAttribute("qualifier"), status: story.getAttribute("status") }; stories_data.push(data); } } } var new_ro = { roid: roid, slug: ro_slug, stories: stories_data }; params.setValue("running_orders", i, new_ro); } } } initXMLData();</api> </meta> <param expand="true" height="913" left="61" oid="running_orders" showlabel="false" top="41" width="1419"/></abs>
Let me know if that answers your question,
------------------------------
Aury Rukazana
Senior Software Developer
Ross Video