[xquery-talk] divide by zero

David Carlisle davidc at nag.co.uk
Thu May 25 12:50:16 PDT 2006

> but i got errors

you have the syntax for let wrong: it needs to be used with return.

 if (count($paths[.=$papa]) = 0)
  let $rat:=1  <--- this is an incomplete expression
  let $rat:=count($paths[.=$papa]) <-- and so is this

just do as originally suggested and replace

  zzzz div grrrr


zzzz div max((1,grrr))

so in your case

 round( count($paths[.=$p]) div max((1,count($paths[.=$papa]))) * 100 )


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

More information about the talk mailing list