[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Seeking an SQR 'In' function
How about:
evaluate $Ernch
when = 'REG'
when = 'OVT'
etc
end-evaluate
I don't know if this is any easier to write than
if $Erncd = 'REG' or
$Erncd = 'OVT' or
etc
nor do I think it's noticably faster, but it IS a little easier to read and add to if you need to in the future...
If the actual codes you're looking at are completely exclusive, you could do
if substr('REGOVTTRF....',$Erncd,1) > 0
but if one of the codes, say, is GOV then you would be in trouble... a way around this would be
let $temp = $Erncd || ' '
if substr('REG OVT TRF ....',$temp,1) > 0
How much work do you want to do to make it easy?
Dave
At 10:27 AM 10/8/1999 +0800, you wrote:
>SQR 3
>
>As you know in SQL you can have a condition such as:
>
> WHERE ERNCD IN ('REG','OVT','TRV',...)
>
>The other day I was modifying an SQR that had a variable $Erncd that I
>needed to test for over 20 distinct values. I was unable to find in the
>manual an SQR equivalent of the above functionality and ended up coding it
>as:
>
> if $Erncd = 'REG' or $Erncd = 'OVT' or $Erncd = 'TRV' or ...
>
>What a pain!! Is there a simpler way in SQR?
>
>Thanks
>
>Wayne Ivory
>Information Services
>Iluka Resources Limited
>
Dave Donnelly <dave@isisbio.com> or <isisdave@usa.net>
ISIS BioComp phone (909) 677-2446 fax (909) 677-3991