Hello All,
I am working through learning Dashboard. I am a beginner programmer, but committed to learning.
I ultimately wish to build an Xpression op assist panel that will retrieve StatCrew, Dak All-Sport5000, and Excel data and present it in an easy to use interface. So far, I have a sql database that contains my rosters and season stats. I also have a php web api that retrieves the data in a json format. That part was pretty easy.
Right now, I am trying to understand how to populate a table using json. I started with the example in the thread here -API From Rundwon Creator- https://support.rossvideo.com/hc/en-us/community/posts/360040041991-API-from-Rundwon-Creator
I can not get the table to populate and I'm still not sure why after hours of searching and reading. Below is my grid and a sample of the data follows.
Can anyone point me in a direction?
<abs contexttype="opengear">
<meta>
<params>
<param access="1" constrainttype="INT_NULL" name="Jersey Number" oid="params.Jersey" precision="0" stateless="true" type="INT16_ARRAY" value="1" widget="default"/>
<param access="1" maxlength="0" name="First Name" oid="params.FirstName" precision="0" stateless="true" type="STRING_ARRAY" value=" " widget="default">
<value/>
</param>
<param access="1" constrainttype="STRING_CHOICE" name="Table" oid="params.table" precision="0" stateless="true" type="INT16" value="1" widget="table">
<constraint>params.Jersey</constraint>
<constraint>params.FirstName</constraint>
</param>
</params>
</meta>
<meta>
<api immediate="true">function handleResults(resultData)
{
if (resultData == null)
{
ogscript.debug("NO DATA");
}
else
{
ogscript.debug("Data Found");
var resultsAsObject = JSON.parse(resultData);
//ogscript.debug(resultData);
var jerseys = [];
var firstnames = [];
for (var i = 0; i < resultsAsObject.length; i++)
{
jerseys.push(resultsAsObject[i]["jersey"]);
//ogscript.debug(resultsAsObject[i]["jersey"]);
firstnames.push(resultsAsObject[i]["fName"]);
//ogscript.debug(resultsAsObject[i]["fName"]);
}
//We need to make sure we always have at least one element in a parameter
if (jerseys.length == 0)
{
jerseys.push("");
firstnames.push("");
ogscript.debug("Jersey Length= " +jerseys.length)
}
ogscript.debug("Setting All Values...");
ogscript.debug(jerseys);
ogscript.debug(firstnames);
params.setAllValues('params.Jersey', jerseys);
params.setAllValues('params.FirstName', firstnames);
}
}
function fetchRoster()
{
ogscript.asyncPost('http://192.168.1.137:8080/read.php', null, handleResults);
}</api>
<ogscript handles="onload">/*! block id=1000 !*/
fetchRoster()
/*!!
<block id="1000" type="function_fetchRoster" x="10" y="100" w="243" />
!!*/
/*!!<checksum>97f7d234533212934b6c5e069b1d31b0</checksum>!!*/</ogscript>
</meta>
<button buttontype="push" height="81" left="15" name="Refresh" top="17" width="172">
<task tasktype="ogscript">/*! block id=1001 !*/
fetchRoster()
/*!!
<block id="1001" type="function_fetchRoster" x="10" y="100" w="243" />
!!*/
/*!!<checksum>2cd1be6cfe34db06a453cd5214acd084</checksum>!!*/</task>
</button>
<param expand="true" height="209" left="17" oid="params.table" showlabel="false" top="117" width="488"/>
</abs>
Sample Data-
[{"id":"1","jersey":"1","fName":"Harry","lName":"Harris","Positions1":"RB","Gr":"Sr."},{"id":"2","jersey":"1","fName":"Harry","lName":"Harris","Positions1":"DE","Gr":"Sr."},{"id":"3","jersey":"2","fName":"Julius","lName":"Jones","Positions1":"WR","Gr":"Sr."},{"id":"4","jersey":"3","fName":"Kai","lName":"Gordon","Positions1":"WR","Gr":"Sr."},{"id":"5","jersey":"3","fName":"Mehki","lName":"Gordon","Positions1":"WR","Gr":"Sr."},{"id":"6","jersey":"4","fName":"Robby","lName":"Levak (C)","Positions1":"QB","Gr":"Sr."},{"id":"7","jersey":"5","fName":"Jordan","lName":"Jones","Positions1":"WR","Gr":"Sr."},{"id":"8","jersey":"6","fName":"Jon","lName":"Henderson","Positions1":"WR","Gr":"Fr."},{"id":"9","jersey":"6","fName":"Jon","lName":"Henderson","Positions1":"WR","Gr":"Fr."},{"id":"10","jersey":"7","fName":"Aidan","lName":"Bell","Positions1":"DE","Gr":"Sr."},{"id":"11","jersey":"8","fName":"Jason","lName":"Tuttle","Positions1":"WR","Gr":"Jr."},{"id":"12","jersey":"9","fName":"Jason","lName":"Tuttle","Positions1":"QB","Gr":"Jr."},{"id":"13","jersey":"9","fName":"Jahdon","lName":"Wimbush","Positions1":"WR","Gr":"So."},{"id":"14","jersey":"10","fName":"Joel","lName":"Jones","Positions1":"WR","Gr":"So."},{"id":"15","jersey":"11","fName":"Cody","lName":"Pestino","Positions1":"WR","Gr":"Sr."},{"id":"16","jersey":"12","fName":"Billy","lName":"Levak","Positions1":"QB","Gr":"So."},{"id":"17","jersey":"13","fName":"Collin","lName":"Flynn","Positions1":"OLB","Gr":"Sr."},{"id":"18","jersey":"13","fName":"Matthew","lName":"Hayes","Positions1":"WR","Gr":"Fr."},{"id":"19","jersey":"14","fName":"Jacob","lName":"Kraus","Positions1":"QB","Gr":"Sr."},{"id":"20","jersey":"15","fName":"Ricky","lName":"McLeod","Positions1":"QB","Gr":"So."},{"id":"21","jersey":"16","fName":"Brendan","lName":"O'donnell (C)","Positions1":"WR","Gr":"Sr."},{"id":"22","jersey":"16","fName":"Cooper","lName":"Rusk","Positions1":"WR","Gr":"Fr."},{"id":"23","jersey":"17","fName":"Deandre","lName":"Love","Positions1":"WR","Gr":"Jr."}]
Thanks for looking!
-Chris