coldfusion - Show where column equals a specific data? -
I have a column (cse_dept) where this integer, I just want to show those columns where it's 12 or 39 Is there any way to do this?
& lt; Cfif (# GetCurrentUser.cse_dept # eq '12'39') & gt; & Lt; H1 & gt; Trial & lt; / H1> & Lt; / Cfif>
It does not show any error to me, it does not work the way I want it.
You can use listFind
. If the value of GetCurrentUser.cse_dept
is 12 or 39 listFind
is greater than 0
& lt; Cfif listFind ('12,39', GetCurrentUser.cse_dept) & gt; & Lt; H1 & gt; Trial & lt; / H1> & Lt; / Cfif>
listFind
is case sensitive, if you were looking for something other than numbers, if you need case-incentive search, then you listFindNoCase
Alternatively you can check each value individually
Cfif GetCurrentUser.cse_dept EQ 12 or GetCurrentUser.cse_dept EQ39 & gt; & Lt; H1 & gt; Trial & lt; / H1> & Lt; / Cfif>
If you want to check that GetCurrentUser.cse_dept
is 12 or 3, then you
for any result in your query < Code> & lt; Cfif listFind (getCurrentUser, 12) or search in the list (getCurrentUser, 39) & gt; & Lt; H1 & gt; Trial & lt; / H1> & Lt; / Cfif>
Comments
Post a Comment