Hi George.
Here is a fairly complete example that loads 3 columns from an Excel spreadsheet saved in "XML Spreadsheet 2003" format. it loads the columns into a table and creates a list of buttons using column 2 as their text.
Not Loaded
param.col1
param.col2
param.col3
//ASSUME EXCEL DOCUMENT IS SAVED IN "XML Spreadsheet 2003" FORMAT
var xmlDocument = ogscript.parseXML('excel.xml');
var rows = ogscript.runXPath('//*[local-name()=\'Row\']', xmlDocument);//Row
var col1 = new Array();
var col2 = new Array();
var col3 = new Array();
ogscript.debug('Returned ' + rows.getLength() + ' rows');
for (var i = 0; i < rows.getLength(); i++)
{
var cells = ogscript.runXPath('./*[local-name()=\'Cell\']', rows.item(i));//Cell
if (cells.getLength() >= 3)
{
col1[i] = cells.item(0).getTextContent(); //column 1
col2[i] = cells.item(1).getTextContent(); //column 2
col3[i] = cells.item(2).getTextContent(); //column 3
}
}
params.setAllValues('param.col1', col1);
params.setAllValues('param.col2', col2);
params.setAllValues('param.col3', col3);
//Create choice constraint for 'selecton button'
var choiceConstraint = params.createIntChoiceConstraint(col2);
params.replaceConstraint('param.selection', choiceConstraint);
true
50
var selection = this.getValue();
if (selection >= 0)
{
var itemText = params.getValue('param.col3', selection);
if (itemText != null)
{
params.setValue('param.selectedItemText', 0, itemText);
}
}#DashBoard