In a message dated 98-09-21 11:20:12 EDT, you write:
I have created a short demo for a client using an Access database. They
now want to expand on this using Sybase. I was using the IIF function in the universe with the Access connection now must do the same in Sybase.
Basically I have a numeric field and must group these by a range of values. ie
if ‘number’ < = 36 then return “<36”
else if ‘number’ <=72 then return “36-72” else return “>72”
Kerry:
Try something like the following (assumes whole numbers):
replicate(“<36”, sign(36-x)) +
replicate(“36-72”, sign(73-x)*sign(x-35)) + replicate(“>72”, sign(x-72))
The sign() function works as follows:
x < 0, sign(x) = -1
x = 0, sign(x) = 0
x > 0, sign(x) = 1
x is null, sign(x) is null
replicate() repeats a string from 0 to n times
Since the sign() function returns a value of -1, 0, or 1, the replicate function will repeat your desired label 0 or 1 times. I believe that replicate will ignore the -1 possibility.
So, if x = 2…
replicate(“<36”, sign(36-2)) +
replicate(“36-72”, sign(73-2)*sign(2-35)) + replicate(“>72”, sign(2-72))
becomes
replicate(“<36”, 1) + replicate (“36-72”, (1*-1)) + replicate (“>72”, -1)
which evaluates to
replicate(“<36”, 1) + replicate (“36-72”, (-1)) + replicate (“>72”, -1)
so only the “<36” string will be replicated. I will leave verification of the others to the reader. 
Caveat: I don’t currently have access to a Sybase system to test this, so there may be syntax errors in my logic. But the idea should help you get started.
Regards,
Dave Rathbun
Integra Solutions
www.islink.com
Listserv Archives (BOB member since 2002-06-25)