Hi folks,
I’m sure there’s a quick answer to this, but I don’t have time to keep trying
different things.
I have the results of a sparql query where ?town may or may not be populated
(optional).
If it is, I need to manipulate the results:
var town = "";
if (! doc.town) {
town = doc.town
.replace(/^MEIR$/,"STOKE-ON-TRENT")
.replace(/^COBRIDGE$/,"STOKE-ON-TRENT")
.replace(/^ETRURIA$/,"STOKE-ON-TRENT")
}
I’ve tried:
(! doc.town)
(doc.town !== null)
(doc.town !== undefined)
(typeof doc.town !== undefined)
But I always get: JS-JAVASCRIPT: .replace(/^MEIR$/,"STOKE-ON-TRENT”) — Error
running JavaScript request: TypeError: undefined is not a function
Time to admit I’m stumped!
Help!
Ed
Ed Outhwaite
Associate Consultant
[cid:42AE8EDF-21C3-4465-8153-0C8CA99DCA9B]
[email protected]
mobile: +44 7467 954464
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general