Wednesday, August 13, 2014

Useful XQuery functions

Following are the useful XQuery functions which can come handy while doing the OSB programming.

Function to join different strings with a delimiter:

fn:string-join(
for $empName in $empList/emp:Employee/emp:Name
return
data($empName/text()),',')

DateToString and StringToDate conversion functions:

fn-bea:date-to-string-with-format('MM/dd/yyyy',fn-bea:date-from-string-with-format('MM-dd-yyyy', $requestDate))
fn-bea:date-from-string-with-format('yyyy/MM/dd', $requestDate)

Code snippet to convert any phone number format to the USA phone number format:

fn:replace(fn:replace($phoneNbr,"\(|-|\)| ",""),'(\d{3})(\d{3})(\d{4})', '($1) $2-$3')

Rounding to an integer value:

xs:int(fn:round($varTranSeqID))

No comments:

Post a Comment