[xquery-talk] contains or tokenize usage help required in Xquery

Andrew Welch andrew.j.welch at gmail.com
Thu Jun 6 08:47:16 PDT 2013


On 6 June 2013 16:36, sudheshna iyer <sudheshnaiyer at yahoo.com> wrote:
> Hello All,
>
> I will get a string  of error codes from my vendor in a comma seperated
> format.
> I need an xquery function, which will return "Success" or "Failure" or
> "Error" based on the following:
>
> If string contains AE* or -> Return "Failure"
> else if  GE* or SE*  -> Return "Error"
> else "Success"

if (contains($str, 'AE')) then 'Failure'
else if (contains($str, 'GE') or contains($str, 'SE') then 'Error'
else 'Success'

you get the idea....  if that's not sufficient then tokenize on comma
and iterate the sequence checking each using starts-with().


> Below are the samples of strings that I can receive.
> AS01,GS03
> -> Should return Success
> AS01,GS01
> -> Should return Success
> AS01,GE02
> -> Should return Error
> AE01,GE02
> -> Should return Failure
>
> Thank you very much for your help.
>
>
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk



-- 
Andrew Welch
http://andrewjwelch.com


More information about the talk mailing list