Rani wrote:
> I appologies if my original post offended you.
> i did not know i am not suppose to write examples with more line of codes
Huh? Nobody said that. Two dozen lines of code isn't excessive, when relevant.
(The only thing that offends me is ugly and unnecessary characters stuck to the front of my name.)
However, the worst bit of the code you showed is the bit you're still showing...
<cfswitch expression="#IIF(Find("word",form.myfield) GTE 1, DE("true"), DE("false"))#">
...and I'm still hoping this is some joke or troll or something, because it really is horribly bad code!
You should never ever use anything like it in a real application.
Even if you'd somehow gone insane, and really needed to use cfswitch instead of cfif, you don't want all that, you just need:
<cfswitch expression=# ( form.myfield contains 'word' ) # >
But using a switch statement for something that can only ever have two outcomes doesn't make sense.
Also, if you needed to retrieve an arbitrary value based on a boolean, just use the ternary conditional operator:
<cfset Colour = find("word",form.myfield) ? "green" : "red" />
No need to mess about with IIF or DE any more.