I think I would like DashBoard to reload the XML each time the source updates.
I also see that there might be a benefit to updating manually...any insight here would be appreciated.
I look at what your code does when I get in this afternoon.
James.
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
Original Message:
Sent: 11-11-2024 20:54
From: James Hessler
Subject: Using XML in DahBoard
I'm trying to use this XML file in DashBoard that reflects some columns in my show rundowns
<?xml version="1.0" encoding="UTF-8"?><runningorders><ro slug="MONDAY 4PM" roid="ENPSxxxx3;P_xxxxNEWS\W;05A26EF1-BE61-4376-996F2427960F18FC"/><ro slug="MONDAY 5PM" roid="ENPSxxxx3;P_xxxxNEWS\W;6500BEB3-AE0F-4FEB-ADBA034619DA341E"/><ro slug="MONDAY 6PM" roid="ENPSxxxx3;P_xxxxNEWS\W;A8F44DA3-08AF-4A79-80FCD787F8C51A96"><story id="ENPSxxxx3;P_xxxxNEWS\W\R_A8F44DA3-08AF-4A79-80FCD787F8C51A96;0898E8CB-715D-4D00-B26851F8E81D21FE" slug="HL: HOMECOMING FOR LIMESTONE COUNTY WOMAN-LIVE" headline="friday" qualifier="thunderstorms" status="PLAY"/><story id="ENPSxxxx3;P_xxxxNEWS\W\R_A8F44DA3-08AF-4A79-80FCD787F8C51A96;AE6D78FD-1B6D-492E-A111EF9128C2D632" slug="HL: DEADLY TWIN PEAKS SHOOTING FOLO-LIVE" headline="saturday" qualifier="snow" status="STOP"/><story id="ENPSxxxx3;P_xxxxNEWS\W\R_A8F44DA3-08AF-4A79-80FCD787F8C51A96;1B2B26AF-5652-476A-89E32A3438355DEE" slug="HL: FREE HAIRCUTS FOR VETERANS-SOTVO" headline="sunday" qualifier="sunny" status="STOP"/></ro><ro slug="MONDAY 10PM" roid="ENPSxxxx3;P_xxxxNEWS\W;96A0FC71-CA20-4A79-AC4B8340AE86C4BE"/><ro slug="BGFN Week 12" roid="ENPSxxxx3;P_xxxxNEWS\W;860C881A-98BA-4430-9E952F3B645BC1B8"/></runningorders>
I also need to be able to select which rundown I'm looking at from the text file RunningOrderList.txt which contains:
MONDAY 4PM
MONDAY 5PM
MONDAY 6PM
MONDAY 10PM
BGFN Week 12
I'm basing this on a tutorial file that populates a table with data and with some help from a programmer who is unfamiliar with ogScript, I have this script.
var xmlDocument = ogscript.parseXML('RunningOrders.xml'); //Parse the XMLvar nodeList = xmlDocument.getElementsByTagName("ro"); //Get the tags we want to include in the constraintvar colData0 = []; //Placeholder for the new constraint datavar colData1 = []; //Placeholder for the new constraint datavar colData2 = []; //Placeholder for the new constraint datavar colData3 = []; //Placeholder for the new constraint datafor (var i = 0; i < nodeList.getLength(); i++) //Loop through each tag we found{ var ronode = nodeList.item(i); //Get the node var storyList = ronode.getElementsByTagName("story"); //get story nodes, if any inside the ro if( storyList.getLength() == 0 ) { colData0.push(parseInt(node.getAttribute("slug"))); colData1.push(node.getAttribute("headline")); colData2.push(node.getAttribute("qualifier")); colData3.push(node.getAttribute("status")); } else { for (var j = 0; j < storyList.getLength(); j++) { colData0.push(parseInt(node.getAttribute("slug"))); colData1.push(node.getAttribute("headline")); var story = storyList.item(j); colData2.push(story.getAttribute("qualifier")); colData3.push(story.getAttribute("status")); } }}params.setAllValues('cols.0', colData0);params.setAllValues('cols.1', colData1);params.setAllValues('cols.2', colData2);params.setAllValues('cols.3', colData3);
I am getting no data to my table---can anybody see what I have done wrong?
Am I even close to something that works?
Thanks,
James.
------------------------------
James Hessler
WAAY TV (ALLEN MEDIA BROADCASTING)
------------------------------