Link to home
Start Free TrialLog in
Avatar of wkolasa
wkolasaFlag for United States of America

asked on

CFqueryparam - list="Yes" not working as intended

Hi again,

I have a cfqueryparam being used to submit a value to the oracle DB.  It submits a letter, compares it to a field with comma delimited enters (ex.  A,S,E,H,D), and if a positive match happens it returns results.  It's not working though.  Code is below:

((Database Field c.class_level = E,M,H,S,A))
 
<cfset session.level = 'H'>
 
c.class_level in  (<cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#session.level#" list="Yes">)
 
<!---This returns no results.  It SHOULD be returning 1 result because 'H' is among c.class_level--->

Open in new window

Avatar of wkolasa
wkolasa
Flag of United States of America image

ASKER

the LIKE operator works... is this okay to use?
can you just do this . Try using in instead of equal
c.class_level in ('E','M','H','S','A')
storing lists as db values is a bad practice.

the LIKE operator will work in this particular case, but you may have a lot of trouble dealing with your comma-delimited list later when you want to do other things.

normalize your db.

Azadi
Avatar of wkolasa

ASKER

can't normalized the DB.  I would love to.  I'm working with a system that is in-place and not going anywhere.
but anyway you still need to use IN , otherwise it only looking for the combination and of course it will never find it
yeah, that happens sometimes...
brace yourself, then... and good luck!

Azadi
Avatar of wkolasa

ASKER

Can't do it like this:  c.class_level in ('E','M','H','S','A')   because this is an exclusion.  If session.level = "E"  and E isn't in the DB field (db field = M,H)  then no results are suppose to return.  So I need to compare the session.level varible to the list in the DB field and see if there's a match.
we ll just do the comparison this way <cfif ListFindNoCase(session.level, class_level )>
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial