Stupid Debug Console
HTML
<script src="https://www.quickbase.com/db/bfx7sqpm8?a=dbpage&pagename=SurveyData.js"></script>
<link rel="stylesheet" href="https://www.quickbase.com/db/bfx7sqpm8?a=dbpage&pagename=Default.css">
<h1>My Console</h1>
<ol id="myconsole"></ol>
JavaScript
var input = {
"objectselect" : [{
"lineno" : "22",
"filter" : [{
"lineno" : "23",
"name" : "type",
"value" : "CfgHost"
}, {
"lineno" : "24",
"name" : "subtype",
"value" : "CFGNetworkServer"
}, {
"lineno" : "25",
"name" : "ostype",
"value" : "CFGWindowsServer2003"
}, {
"lineno" : "26",
"name" : "dbid",
"value" : "101"
}
]
}, {
"lineno" : "28",
"filter" : [{
"lineno" : "29",
"name" : "type",
"value" : "CfgHost"
}, {
"lineno" : "30",
"name" : "subtype",
"value" : "CFGNetworkServer"
}, {
"lineno" : "31",
"name" : "ostype",
"value" : "CFGWindowsServer2003"
}, {
"lineno" : "32",
"name" : "dbid",
"value" : "102"
}
]
}
],
"uihint" : "auto",
"hidden" : "false",
"readonly" : "false"
};
function puts(s) {
$("#myconsole").append("<li>> " + s);
}
//type=CfgFolder&filters=subtype=CFGDNGroup+OR+subtype=CFGPerson+AND+folderclass=CFGFCDefault
function findType(filters) {
var typeFilters = filters.filter(function(f) {
return f.name === "type";
});
return typeFilters.length > 0 ? typeFilters[0].value : null;
}
function composeWhereCondition(filters) {
var conditions = [];
filters.forEach(function(f) {
if (f.name !== "type") {
conditions.push(f.name+"="+f.value);
}
});
return conditions.join(" AND ");
}
function composeSelectionFilters(objectselect) {
if (objectselect.length == 1) {
// old version
return;
}
var cfgObjectType = null;
var i;
for (i = 0; i < objectselect.length; i++) {
var type = findType(objectselect[i].filter;
if (!type && !cfgObjectType) {
throw "cfg object type not defined in objectselect";
}
if (type && cfgObjectType && type !== cfgObjectType) {
throw "conflicting cfg object type in objectselect";
}
cfgObjectType...