Hi, Sini: If you don't want to use if / else, you could put a predicate on the literals, as in:
$address, "-"[exists($address) and (exists($postcode) or exists($city))], $postcode, " "[exists($postcode) and exists($city)], $city Erik Hennum ________________________________ From: [email protected] [[email protected]] on behalf of sini narayanan [[email protected]] Sent: Monday, May 06, 2013 5:50 AM To: MarkLogic Developer Discussion Subject: [MarkLogic Dev General] Appropriate method to check multiple conditions in Marklogic 6 Hi All, I have few documents in my database and each document have the following three tags, address, postCode and city. All the three tags will not have values in all the documents. Certain might have only address and some others only postCode and city. In total it would result in 9 conditions(with all the permutation and combinations). (All node have values, none have values, only city node has value, only address and postCode have value, etc...) After all these condition checks, the final output I need is concat(address,"-",postcode," ",city) Here I need to pass by the seperating characters (- and space), if a field is empty. I.e: If address is absent then the output should start with the postCode and not "-". Similarly for all other cases. Please tell me an appropriate method to use this other than if() else(). Thanks, Sini
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
