Hello, I have created this thread as the questions I have sort of falls into multiple buckets.
I am reaching out as I have an event coming up and I am having difficulty with a few things. I have also provided the code for all my panels below.
1. I would like to find a way to only upload the selected row to Datalinq, rather than having the entire table be read every time. I believe James had tried to help me with this earlier, however I am still having issues with loading the appropriate information.
2. I would like to have a mechanism to add a new row to the table from within the dashboard, as there are times when things may need to be updated during the event.
3. I would like to merge this panel with a previously created panel to have all the information on 1 dashboard/window.
Help would be greatly appreciated as I am quite stuck especially on the first 2 issues.
Thank you
Tejus
Panel with tables:
<?xml version="1.0" encoding="UTF-8"?><abs contexttype="opengear" gridsize="20" id="_top" keepalive="false">
<meta>
<params>
<param access="1" constrainttype="STRUCT" name="article_template" oid="article_template" type="STRUCT" widget="table">
<value>
<subparam access="1" maxlength="0" name="Article Number" suboid="number" type="STRING" value="Article 1" widget="default"/>
<subparam access="1" maxlength="0" name="Article Description" suboid="description" type="STRING" value="Reports of Town Officers/Committees" widget="default"/>
<subparam access="1" maxlength="0" name="Article Short" suboid="short" type="STRING" value="Reports" widget="default"/>
</value>
</param>
<param access="1" constrainttype="STRUCT" name="article_template" oid="articles" templateoid="article_template" type="STRUCT_ARRAY" widget="table">
<value>
<subparam suboid="number" value="Article 1"/>
<subparam suboid="description" value="Reports of Town Officers/Committees"/>
<subparam suboid="short" value="Reports"/>
</value>
</param>
<param access="1" constrainttype="INT_NULL" name="selection" oid="selection" precision="0" type="INT16" value="14" widget="default"/>
<param access="1" maxlength="0" name="filename" oid="filename" type="STRING" value="Full-Articles.xml" widget="text"/>
<param access="1" maxlength="0" name="article number" oid="art_num" type="STRING" value="Article 1" widget="label"/>
</params>
</meta>
<label height="60" left="40" name="Reading XML Files " style="txt-align:west;size:Bigger;" top="40" width="620"/>
<label height="20" left="40" name="ogScript can be used to read an XML file and put the data in a structured parameter." style="txt-align:west;" top="100" width="1100"/>
<param expand="true" height="680" left="60" oid="articles" showlabel="false" top="200" width="740">
<config key="w.selectionparam">selection</config>
</param>
<button buttontype="push" height="40" left="560" name="Read" top="140" width="120">
<task tasktype="ogscript">var xmlDocument = ogscript.parseXML(params.getValue("filename", 0)); //Parse the XML
var nodeList = xmlDocument.getElementsByTagName("Article"); //Get the tags we want to include in the constraint
var articleData = new Array();
for (var i = 0; i < nodeList.getLength(); i++) //Loop through each tag we found
{
var node = nodeList.item(i); //Get the node
articleData.push({"number": node.getAttribute("ArticleNumber"), "description": node.getAttribute("ArticleDescription"),"short": node.getAttribute("ArticleShort")});
}
if (articleData.length == 0) //Placeholder if we don't have anything (OPTIONAL)
{
articleData.push({"number": "Article 0", "description": "No Data Found","short": "N/A"});
}
params.setAllValues("articles", articleData);</task>
</button>
<param expand="true" height="40" left="60" oid="filename" top="140" widget="file-picker" width="480"/>
<button buttontype="push" height="40" left="700" name="Clear" top="140" width="100">
<task tasktype="ogscript">var articleData = new Array();
articleData.push({"number": "Article 0", "description": "No Data Found","short": "N/A"});
params.setValue("articles", articleData);</task>
</button>
<param expand="true" height="40" left="820" oid="selection" top="220" width="160">
<task tasktype="ogscript">var selected = params.getValue("selection", 0);
params.setValue('art_num', 0, params.getElementCount("articles", 0));
var first = params.getValue("articles." + selected + ".fname", 0);
var last = params.getValue("articles." + selected + ".lname", 0);
ogscript.rename("PrintSpace", "<html><center>" + first + "<br>" + last + "</center></html>");</task>
</param>
<label height="20" left="820" name="Selected Row:" style="txt-align:west" top="200" width="160"/>
<param expand="true" height="53" left="83" oid="art_num" showlabel="false" top="332" width="353"/>
</abs>
Full-Articles.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ArticleFile>
<Article ArticleNumber="Article 1" ArticleDescription="Reports of Town Officers/Committees" ArticleShort="Reports"/>
<Article ArticleNumber="Article 2" ArticleDescription="Cemetery Improvement and Development Fund" ArticleShort="Cemetery Fund"/>
<Article ArticleNumber="Article 3" ArticleDescription="Appropriate Commonwealth Transportation Infrastructure Fund Monies" ArticleShort="Transportation Fund"/>
<Article ArticleNumber="Article 4" ArticleDescription="Sewer Construction Stabilization Fund" ArticleShort="Sewer Fund"/>
<Article ArticleNumber="Article 5" ArticleDescription="Affordable Housing Stabilization Fund" ArticleShort="Housing Fund"/>
<Article ArticleNumber="Article 6" ArticleDescription="Funding for Collective Bargaining Agreements" ArticleShort="Collective Bargaining"/>
<Article ArticleNumber="Article 7" ArticleDescription="Unpaid Bills Prior Fiscal Year" ArticleShort="Unpaid Bills"/>
<Article ArticleNumber="Article 8" ArticleDescription="Amend Fiscal Year 2023 Operating Budget " ArticleShort="Amend Budget"/>
<Article ArticleNumber="Article 9" ArticleDescription="Appropriation of Statewide Opioid Settlement Abatement Funds" ArticleShort="Opioid Settlement"/>
<Article ArticleNumber="Article 10" ArticleDescription="Citizen Petition – Funding for School Department Professional Support Personnel" ArticleShort="Citizen Petition"/>
<Article ArticleNumber="Article 11" ArticleDescription="Roadway and Sidewalk Construction" ArticleShort="Roadway/Sidewalk"/>
<Article ArticleNumber="Article 12" ArticleDescription="Sewer Capital Improvements" ArticleShort="Sewer Improvements"/>
<Article ArticleNumber="Article 13" ArticleDescription="PFAS Remediation at 54 Richardson Road" ArticleShort="PFAS Remediation"/>
<Article ArticleNumber="Article 14" ArticleDescription="Transfer Free Cash to Reduce Fiscal Year 2023 Property Tax Levy" ArticleShort="Free Cash Transfer"/>
<Article ArticleNumber="Article 15" ArticleDescription="Transfer Free Cash to the General Stabilization Fund " ArticleShort="Free Cash Transfer"/>
<Article ArticleNumber="Article 16" ArticleDescription="Community Preservation Fund – Historical Commission Property Inventory Program " ArticleShort="CPC Fund"/>
<Article ArticleNumber="Article 17" ArticleDescription="Increase Senior Property Tax Work Off Funding " ArticleShort="Senior Tax Rebate"/>
<Article ArticleNumber="Article 18" ArticleDescription="Increase Chapter 59, Section 5, Clause 41C Property Tax Exemption to Seniors" ArticleShort="Chpt 59 Tax Exempt"/>
<Article ArticleNumber="Article 19" ArticleDescription="Charter Amendment – Annual Audit" ArticleShort="Charter Amendment"/>
<Article ArticleNumber="Article 20" ArticleDescription="Removal of Deputy Fire Chief from Civil Service" ArticleShort="Deputy Fire Chief"/>
<Article ArticleNumber="Article 21" ArticleDescription="Zoning Bylaw Amendment – Warehouse " ArticleShort="Zoning Warehouse"/>
<Article ArticleNumber="Article 22" ArticleDescription="Zoning Bylaw Amendment - Distribution Center" ArticleShort="Zoning Distribution Center"/>
<Article ArticleNumber="Article 23" ArticleDescription="Zoning Bylaw Amendment - Use Regulation Table" ArticleShort="Zoning Use Regulation "/>
<Article ArticleNumber="Article 24" ArticleDescription="Odd Fellows Property Brook Walk Easement Acceptance " ArticleShort="Odd Fellows Easement"/>
<Article ArticleNumber="Article 25" ArticleDescription="Charles Way – Authorization to Acquire Permanent Easement" ArticleShort="Charles Way Easement"/>
<Article ArticleNumber="Article 26" ArticleDescription="Street Acceptance – Nabnasset Drive" ArticleShort="Street Acceptance"/>
<Article ArticleNumber="Consent Agenda" ArticleDescription="Articles 21, 22, 23" ArticleShort="Articles 21-23"/>
</ArticleFile>
Other panel to merge with panel 1:
<?xml version="1.0" encoding="UTF-8"?><abs contexttype="opengear" style="">
<meta>
<params>
<param access="1" constrainttype="INT_CHOICE" name="Names" oid="Constraint_From_XML" precision="0" type="INT32" value="153" widget="*">
<constraint key="0">Aaron Cunningham</constraint>
<constraint key="1">Adam Brandow</constraint>
<constraint key="2">Adam McCusker</constraint>
<constraint key="3">Albert Glenn Diggs</constraint>
</param>
<param access="1" constrainttype="INT_CHOICE" name="Locations" oid="locations" precision="0" type="INT32" value="153" widget="combo">
<constraint key="0">PRECINCT 9</constraint>
<constraint key="1">PRECINCT 6</constraint>
<constraint key="2">PRECINCT 2</constraint>
<constraint key="3">PRECINCT 2</constraint>
</param>
<param access="1" maxlength="0" name="Selected Precinct" oid="selected_precinct" type="STRING" value="PRECINCT 7" widget="label"/>
<param access="1" maxlength="0" name="Selected Person" oid="selected_person" type="STRING" value="William Rice" widget="label"/>
</params>
<ogscript handles="onload">var newConstraint = params.createIntChoiceConstraint(["Nothing"]);
params.replaceConstraint('Constraint_From_XML', newConstraint);
params.replaceConstraint('locations', newConstraint);</ogscript>
<api>function getXML(file)
{
return ogscript.parseXML(file); //Parse the XML
}
function loadData(dataFile)
{
var xmlDocument = getXML(dataFile); //Parse the XML
var nodeList = xmlDocument.getElementsByTagName("person"); //Get the tags we want to include in the constraint
var constraintData = []; //Placeholder for the new constraint data
var idData = []; //Placeholder for the ID data
for (var i = 0; i < nodeList.getLength(); i++) //Loop through each tag we found
{
var node = nodeList.item(i); //Get the node
var idInfo = node.getAttribute("location"); // This is actually ID info
var name = node.getTextContent();
idData.push(idInfo);
constraintData.push(name); //Push the key/value pair
}
if (constraintData.length == 0) //Placeholder if we don't have anything (OPTIONAL)
{
constraintData.push("Nothing");
}
var constraint = params.createIntChoiceConstraint(constraintData); //Create the constraint
params.replaceConstraint('Constraint_From_XML', constraint); //Replace the constraint
constraint = params.createIntChoiceConstraint(idData); //Create the constraint
params.replaceConstraint('locations', constraint); //Replace the constraint
}</api>
</meta>
<param expand="true" height="90" left="32" oid="Constraint_From_XML" top="48" width="626">
<task tasktype="ogscript">params.setValue('locations', 0, this.getValue());
params.setValue('selected_precinct', 0, params.getParam('locations', 0).getValueAsString());
params.setValue('selected_person', 0, this.getValueAsString());
ogscript.rename('selected-take', this.getValue());
</task>
</param>
<button buttontype="push" height="95" left="673" name="Load" top="47" width="183">
<task tasktype="ogscript">loadData('Full-precinct-name.xml');</task>
</button>
<label height="142" id="selected-take" left="34" style="txt-align:center" top="164" width="815"/>
<param expand="true" height="53" left="83" oid="selected_precinct" showlabel="true" top="332" width="353"/>
<param expand="true" height="55" left="454" oid="selected_person" showlabel="true" top="330" width="340"/>
</abs>
------------------------------
Tejus Surendran
------------------------------