PDA

View Full Version : JsonReader with Agent?



waldav00
6 May 2008, 11:29 AM
I had another post where an XML file as well as an agent returning XML data where not displaying data in my grid. It was suggested there that I use a JSONReader rather than XML. I have made the appropriate code changes as follows:

JS Header on form:


var jsonReader;
var mySOPstore;
var allSOPstore;
var subSOPstore;
Ext.onReady(function()
{
jsonReader = new Ext.data.JsonReader({
root: 'sops',
totalProperty: 'totalCount',
id: 'recordID',
fields: ['category','title','id',
{name: 'version', type: 'float'},
{name: 'releaseDate', type: 'date', dateFormat: 'n/j/Y'},
'status','location','createCR','package','jobAid','form','processFlow','checklist','procedureRef'
]
});
mySOPstore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '(testsop)?openAgent',
method: 'POST'
}),
reader: jsonReader,
autoLoad: true,
remoteSort: false
});

function renderTitle(value, p, record) {
return String.format('<a href="http://srv-reg-unx-01.saskpower.sk.ca/soponline/showSOP.php={1}">{0}</a>' (http://srv-reg-unx-01.saskpower.sk.ca/soponline/showSOP.php=%7B1%7D%22%3E%7B0%7D%3C/a%3E'),
value, record.id);
}
function renderID(value, p, record) {
return String.format('<a href="http://srv-reg-unx-01.saskpower.sk.ca/soponline/showSOP.php={1}">{0}</a>' (http://srv-reg-unx-01.saskpower.sk.ca/soponline/showSOP.php=%7B1%7D%22%3E%7B0%7D%3C/a%3E'),
value, record.id);
}
function renderPkg(value) {
if (value == 'gold') {
pkgIcon = "<img src='images/gold_ico.gif' alt='Gold package' />";
}
if (value == 'silver') {
pkgIcon = "<img src='images/silver_ico.gif' alt='Silver package' />";
}
return pkgIcon;
}
function renderCR(value) {
return String.format('<a class="cr" href="newChangeRequest.html?={1}">new CR</a>',
value);
}
function getRowContent(record, index) {
var content = this.bodyContent[record.id];
if(!content){
content = this.tpl.apply(record.data);
this.bodyContent[record.id] = content;
}

var rowTemplate = "";
if (content != ",,,,") {
rowTemplate += '<img src="images/attachment.gif" alt="paperclip" />';
} else {
return rowTemplate + "<p>There are no attachments in this SOP.</p>";
}
if (content.substr(0,1) == ",") {
var brackets = "[]";
content = brackets.concat(content);
}
var xtraData = content.replace(",,", ",[],");
xtraData = xtraData.substring(xtraData.indexOf("[")+1,xtraData.lastIndexOf("]"));
xtraData = xtraData.split('],[');
var aidIDs = new Array(),
aidTitles = new Array(),
formIDs = new Array(),
formTitles = new Array(),
processIDs = new Array(),
processTitles = new Array(),
checklistIDs = new Array(),
checklistTitles = new Array(),
procedureIDs = new Array(),
procedureTitles = new Array();
var divider = /\},\{/;

if (xtraData[0] != "") {
var jobAids = xtraData[0].slice(1,xtraData[0].lastIndexOf("}"));
if (jobAids.search(divider) >= 0) {
rowTemplate += "<p>Job Aids: ";
jobAids = jobAids.split('},{');
} else {
rowTemplate += "<p>Job Aid: ";
jobAids = new Array(jobAids);
}
for (i=0; i < jobAids.length; i++) {
var jobAid = jobAids[i].split("','");
aidIDs[i] = jobAid[0].slice(jobAid[0].indexOf("':'")+3);
aidTitles[i] = jobAid[1].slice(jobAid[1].indexOf("':'")+3,-1);
rowTemplate += '<a href="'+aidIDs[i]+'">'+aidTitles[i]+'</a> ';
}
rowTemplate += "</p>";
}
if (xtraData[1] != "") {
var forms = xtraData[1].slice(1,xtraData[1].lastIndexOf("}"));
if (forms.search(divider) >= 0) {
rowTemplate += "<p>Forms: ";
forms = forms.split('},{');
} else {
rowTemplate += "<p>Form: ";
forms = new Array(forms);
}
for (i=0; i < forms.length; i++) {
var form = forms[i].split("','");
formIDs[i] = form[0].slice(form[0].indexOf("':'")+3);
formTitles[i] = form[1].slice(form[1].indexOf("':'")+3,-1);
rowTemplate += '<a href="'+formIDs[i]+'">'+formTitles[i]+'</a> ';
}
rowTemplate += "</p>";
}
if (xtraData[2] != "") {
var processes = xtraData[2].slice(1,xtraData[2].lastIndexOf("}"));
if (processes.search(divider) >= 0) {
rowTemplate += "<p>Process Flows: ";
processes = processes.split('},{');
} else {
rowTemplate += "<p>Process Flow: ";
processes = new Array(processes);
}
for (i=0; i < processes.length; i++) {
var process = processes[i].split("','");
processIDs[i] = process[0].slice(process[0].indexOf("':'")+3);
processTitles[i] = process[1].slice(process[1].indexOf("':'")+3,-1);
rowTemplate += '<a href="'+processIDs[i]+'">'+processTitles[i]+'</a> ';
}
rowTemplate += "</p>";
}
if (xtraData[3] != "") {
var checklists = xtraData[3].slice(1,xtraData[3].lastIndexOf("}"));
if (checklists.search(divider) >= 0) {
rowTemplate += "<p>Checklists: ";
checklists = checklists.split('},{');
} else {
rowTemplate += "<p>Checklist: ";
checklists = new Array(checklists);
}
for (i=0; i < checklists.length; i++) {
var checklist = checklists[i].split("','");
checklistIDs[i] = checklist[0].slice(checklist[0].indexOf("':'")+3);
checklistTitles[i] = checklist[1].slice(checklist[1].indexOf("':'")+3,-1);
rowTemplate += '<a href="'+checklistIDs[i]+'">'+checklistTitles[i]+'</a> ';
}
rowTemplate += "</p>";
}
if (xtraData[4] != "") {
var procedures = xtraData[4].slice(1,xtraData[4].lastIndexOf("}"));
if (procedures.search(divider) >= 0) {
rowTemplate += "<p>Procedure References: ";
procedures = procedures.split('},{');
} else {
rowTemplate += "<p>Procedure Reference: ";
procedures = new Array(procedures);
}
for (i=0; i < procedures.length; i++) {
var procedure = procedures[i].split("','");
procedureIDs[i] = procedure[0].slice(procedure[0].indexOf("':'")+3);
procedureTitles[i] = procedure[1].slice(procedure[1].indexOf("':'")+3,-1);
rowTemplate += '<a href="'+procedureIDs[i]+'">'+procedureTitles[i]+'</a>';
}
rowTemplate += "</p>";
}
return rowTemplate;
}
var mySOPexpander = new Ext.grid.RowExpander({
tpl : new Ext.Template('{jobAid},{form},{processFlow},{checklist},{procedureRef}'),
getBodyContent: getRowContent
});
var mySOPcm = new Ext.grid.ColumnModel([
mySOPexpander,
{header: "Category", width: 100, resizable: false, dataIndex: 'category'},
{header: "SOP Title", width: 220, resizable: false, css: "white-space: normal !important;", renderer: renderTitle, dataIndex: 'title'},
{header: "ID", width: 180, resizable: false, renderer: renderID, dataIndex: 'id'},
{header: "Version", width: 65, resizable: false, dataIndex: 'version'},
{header: "Release Date", width: 105, renderer: Ext.util.Format.dateRenderer('Y/m/d'), resizable: false, dataIndex: 'releaseDate'},
{header: "Status", width: 60, resizable: false, dataIndex: 'status'},
{header: "Location", width: 75, resizable: false, dataIndex: 'location'},
{header: "Change Requests", width: 120, sortable: false, resizable: false, css: "padding: 0; border: 0; margin: 0", renderer: renderCR, id: 'chgRequestsCol', dataIndex: 'createCR'},
{header: "", width: 27, sortable: false, resizable: false, renderer: renderPkg, id: 'pkgGridHeader', dataIndex: 'package'}
]);

mySOPcm.defaultSortable = true;
var myGrid = new Ext.grid.GridPanel({
el:'sops',
height: 520,
width: 998,
disableSelection: true,
frame:false,
border:false,
stripeRows:true,
enableHdMenu:false,
enableColumnMove:false,
plugins: mySOPexpander,
store: mySOPstore,
cm: mySOPcm,
trackMouseOver:true,
viewConfig: {
forceFit:true
}
});
myGrid.render();

var mainTabs = new Ext.TabPanel({
renderTo: 'mainPanel',
width: 998,
activeTab: 0,
bodyBorder: false,
plain: true,
border: false,
frame: false,
defaults: { autoHeight: true },
items:[
{id:'myPanel', contentEl:'sops', title: 'My SOPs'},
{id:'allPanel', contentEl:'allSOPs', title: 'All SOPs'},
{id:'subPanel', contentEl:'subSOPs', title: 'Substitution SOPs'}
]
});

function toggleDetails() {
if (mainTabs.getActiveTab().contentEl == "sops") var totalRows = mySOPstore.getCount();
if (mainTabs.getActiveTab().contentEl == "allSOPs") var totalRows = allSOPstore.getCount();
if (mainTabs.getActiveTab().contentEl == "substitutions") var totalRows = subSOPstore.getCount();

myGrid.getView().refresh();
if (Ext.get('toggleInfo').hasClass('expandAll')) {
for (t=0; t<totalRows; t++) {
expander.expandRow(t);
}
Ext.get('toggleInfo').replaceClass('expandAll','collapseAll');
Ext.get('toggleLink').update('Collapse all');
} else {
for (t=0; t<totalRows; t++) {
expander.collapseRow(t);
}
Ext.get('toggleInfo').replaceClass('collapseAll','expandAll');
Ext.get('toggleLink').update('Expand all');
}
}

Ext.get('toggleInfo').on('click', toggleDetails);
mySOPstore.on('loadexception', function(proxy, store, response, e){
alert('load exception occured: ' + proxy+"\n"+store+"\n"+response+'\n'+e.message);
});

});


testsop agent code:


Sub Initialize

Msgbox "testsop agent started"

Print|{"totalCount":"30","sops":[|

Print|{"recordID":"1","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.3","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'},{'aidID':'#2','aidTitle':'How to plug a power cord'},{'aidID':'#3','aidTitle':'Avoiding short circuits'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"[{'checklistID':'#1','checklistTitle':'Types of Bulbs'},{'checklistID':'#2','checklistTitle':'Types of cords'}]","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'},{'procedureID':'#2','procedureTitle':'Procedure two'}]"},|
Print|{"recordID":"2","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.0","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"gold","jobAid":"","form":"","processFlow":"[{'processID':'#8','processTitle':'Process three'}]","checklist":"[{'checklistID':'#6','checklistTitle':'Checklist three'}]","procedureRef":"[{'procedureID':'#7','procedureTitle':'Procedure three'}]"},|
Print|{"recordID":"3","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.47","releaseDate":"2/18/2006","status":"active","location":"mobile","createCR":"#7","package":"gold","jobAid":"","form":"","processFlow":"","checklist":"","procedureRef":""},|
Print|{"recordID":"4","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0402-SOP","version":"1.34","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"5","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.02","releaseDate":"2/23/2006","status":"pending","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"6","category":"Administration","title":"Radiodetection PXL2 Precision","id":"TDBU -ADM-MEQ-0301-SOP","version":"1.49","releaseDate":"2/23/2006","status":"pending","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"7","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"2.54","releaseDate":"2/23/2006","status":"pending","location":"mobile","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"8","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-2604-SOP","version":"1.71","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"9","category":"Administration","title":"Radiodetection PXL2 Precision","id":"TDBU -T&D-MEQ-0001-SOP","version":"2.39","releaseDate":"2/23/2006","status":"pending","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"10","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"3.04","releaseDate":"2/23/2006","status":"pending","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"11","category":"Human Resources","title":"Recruitment Process Confidentiality","id":"TDBU -T&D-MEQ-0001-SOP","version":"3.28","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"12","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.64","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"13","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.23","releaseDate":"2/14/2006","status":"active","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"14","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"2.74","releaseDate":"2/23/2006","status":"pending","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"15","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.08","releaseDate":"8/27/2006","status":"pending","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"16","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.13","releaseDate":"2/21/2006","status":"active","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"17","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0451-SOP","version":"1.58","releaseDate":"8/23/2006","status":"pending","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"18","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"2.54","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"19","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.09","releaseDate":"3/19/2006","status":"pending","location":"mobile","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"20","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"2.15","releaseDate":"2/23/2006","status":"pending","location":"mobile","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"21","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"2.40","releaseDate":"12/23/2006","status":"active","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"22","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.01","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"23","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.45","releaseDate":"2/23/2006","status":"pending","location":"mobile","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"24","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.58","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"25","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.02","releaseDate":"8/23/2006","status":"pending","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"26","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.02","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"27","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"2.88","releaseDate":"1/23/2006","status":"active","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"28","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.11","releaseDate":"2/23/2006","status":"pending","location":"office","createCR":"#7","package":"silver","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"29","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.63","releaseDate":"4/23/2006","status":"pending","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}]"},|
Print|{"recordID":"30","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"2.81","releaseDate":"2/23/2006","status":"pending","location":"office","createCR":"#7","package":"gold","jobAid":"[{'aidID':'#1','aidTitle':'How to change bulbs'}]","form":"[{'formID':'#1','formTitle':'Bulb-changing form'},{'formID':'#2','formTitle':'Cord-pluggin form'}]","processFlow":"[{'processID':'#1','processTitle':'Process One'},{'processID':'#2','processTitle':'Process Two'}]","checklist":"","procedureRef":"[{'procedureID':'#1','procedureTitle':'Procedure One'}|

Print|]"}]}|

Msgbox "testsop agent ended"
End Sub


So, now when I load my webpage, I get a loadexception error stating 'Syntax Error' (which means nothing to me) and no data is displayed in the grid.

If I point the url in mySOPstore to a text file with exactly what is in my agent (without the print | | statements), the page loads fine and the records are displayed in my grid.

What is the difference? What could the problem be? This is a show stopper for our application and we have a very strict timeline.

Zakaroonikov
6 May 2008, 5:09 PM
Shouldn't this:



Print|{"recordID":"2","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.0","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"gold","jobAid":"","form":"","processFlow":"[{'processID':'#8','processTitle':'Process three'}]","checklist":"[{'checklistID':'#6','checklistTitle':'Checklist three'}]","procedureRef":"[{'procedureID':'#7','procedureTitle':'Procedure three'}]"},|


be more like this:



Print|{"recordID":"2","category":"Operations","title":"Straighten Poles in the Alive State","id":"TDBU -T&D-MEQ-0001-SOP","version":"1.0","releaseDate":"2/23/2006","status":"active","location":"office","createCR":"#7","package":"gold","jobAid":"","form":"","processFlow":"[{'processID':'#8','processTitle':'Process three'}]","checklist":"[{'checklistID':'#6','checklistTitle':'Checklist three'}]","procedureRef":[{'procedureID':'#7','procedureTitle':'Procedure three'}]},|


Notice the "s are removed from the procedureRef value in your object

parnold
6 May 2008, 5:11 PM
try adding this line to the top of your agent:

Print |Content-Type:text/html; charset=us-ascii|

Keeps Domino from adding all the HTML junk.

waldav00
6 May 2008, 6:03 PM
The last tip was almost dead on! Thank you so much. I had to add this at the top of my agent:

Print "Content-type:text/html; charset=UTF-8" ' Format a nice header telling the content type.
Print |Cache-control: no-cache, no-store, must-revalidate| ' Not a good idea to cache this.
Print ""

Cheers!!