Page 1 of 1

using MATCHES or LIKE in <CASE> ??

Posted: Tue Mar 27, 2001 2:10 pm
by guestroom
I KNOW THE FOLLOWING WONT WORK. There is no Matches nor Like in Vortex.
But this is the logic of what I want to do.
SO HOW DO I DO THIS?

<lower $kword>
<$lkw=$ret>

<SWITCH $lkw >
<CASE "asia">
<!-- how do I get a MATCHES or LIKE in a case statement -->
$lkw - exactly asia!
<CASE LIKE "asia">
$lkw - matches asian or asia
<DEFAULT>
no matches for $lkw !
</SWITCH>
</A>

thanks

using MATCHES or LIKE in <CASE> ??

Posted: Wed Mar 28, 2001 6:43 am
by bart
The closest thing to your desired operation is to use the SANDCALL option to <fmt> and <sb></sb>.

I know this might sound odd, but it can locate one or more patterns and then call functions based on the
pattern located.

using MATCHES or LIKE in <CASE> ??

Posted: Wed Mar 28, 2001 7:05 am
by John
Another option is to use a cascading <IF>, e.g.

<if $lkw eq 'asia'>
...
<elseif $lkw MATCHES 'asia%'>
...
<else>
...
</if>

since <IF> will allow the full range of conditions available to a SQL WHERE clause.

using MATCHES or LIKE in <CASE> ??

Posted: Wed Mar 28, 2001 9:59 am
by bart
I was semi-wrong: John's method seems like a more direct solution than mine.