Down a rabbit hole again ....
I thought I might have been sending data too quickly, but that has turns out to be unlikely.
So now, I'm trying to write a simple xml file with only two tags when I click on a selection from a table. The functionality of the table is fine and does what I want it to but now I'd like to write that choice out to a xml file.
I'm basing my scripting off the "Write an XML File.grid" sample and the task is triggered by a button push in that sample. I'd like to trigger the task from the mouse click for selected table row. This is how my script looks (as it isn't working)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var RowNum = params.getValue('table', 0);
var listname = params.getValue('cols.0', RowNum) + " " + params.getValue('cols.1', RowNum);
var listtitle = params.getValue('cols.2', RowNum)
var savefile = "file2.xml"
//
params.setValue('fname10', 0, listname);
params.setValue('title10', 0, listtitle);
params.setValue('xmlfile', 0, savefile);
//
//
<task tasktype="ogscript">//Create a toplevel node, called "SelectedName"
var xmlDoc = ogscript.parseXML('<?xml version="1.0" encoding="UTF-8"?><SelectedName/>');
var ListSelection = xmlDoc.getDocumentElement();
var savefile = "file1.xml"
//Create a Name node and fill with the selected name
var selname = xmlDoc.createElement('Name');
selname.setTextContent('listname');
ListSelection.appendChild(selname);
//Create a Title node and fill with the select title
var seltitle = xmlDoc.createElement('Title');
seltitle.setTextContent('listtitle');
ListSelection.appendChild(seltitle);
// save the xml to file
//var file = params.getValue("savefile",0);
ogscript.saveToFile(savefile, ListSelection, true);
</task>
//
//
ogscript.debug('This is the variable value: ' + RowNum);
ogscript.debug('Selected Name is: ' + listname + '/' + listtitle);
ogscript.debug('Name to write to file is: ' + listname)
ogscript.debug('Title to write to file is: ' + listtitle)
ogscript.debug('XML File Name is: ' + savefile);
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
So the question is: How do I trigger this 'file save' based on my selection from a table??
As I've said --- I'm a pretty good "monkey see - monkey do" but an absolutely terrible programmer/code /script writer.
Hope I've made this relatively clear....
Thanks for anyone's help on this!!
p.s. How do I determine a static path for the written file
------------------------------
JerryB
------------------------------