Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Coldfusion LIST <cfif> conditions

Posted on 2008-10-14
4
Medium Priority
?
1,204 Views
Last Modified: 2012-05-05
I have a query which returns a list of items in a field #mainsearch.idParticipants#. I am looping the query and only want to display the 'edit' icon if a certain item is in the list that matches either the employee id #session.empl_id# or the idAuthor #mainsearch.idAuthor#. I can't figure out how to write this conditional code.

This is where I'm having the problem in a nutshell...

<cfloop query="mainsearch">
<tr>
  <td><cfif #session.empl_id# = (IF IT IS IN THIS LIST) '#mainsearch.idParticipants#' OR (#session.empl_id# = '#mainsearch.idAuthor#')>Edit</cfif> </td>
</tr>
</cfloop>

I can't figure out how to write the portion that looks at the list #mainsearch.idParticipants#!

Thanks.
0
Comment
Question by:tport_rti
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Expert Comment

by:azadisaryev
ID: 22711862
try:
<cfif listfindnocase(mainsearch.idParticipants, session.empl_id)OR listfindnocase(mainsearch.idAuthor, session.empl_id)>Edit</cfif>

assumes the lists are comma-delimited.

but i strongly suggest you re-consider storing lists as field values. it is not a normalized data model and you can run into all sorts of trouble with it later.
0
 
LVL 27

Accepted Solution

by:
azadisaryev earned 2000 total points
ID: 22711877
oops, i see that idAuthor is not a list, so:

<cfif listfindnocase(mainsearch.idParticipants, session.empl_id) OR (mainsearch.idAuthor eq session.empl_id)>Edit</cfif>
0
 
LVL 19

Expert Comment

by:erikTsomik
ID: 22711884

try something like this
<cfloop query="mainsearch">
<tr>
  <td><cfif LIstFindNoCase(session.empl_id,mainsearch.idParticipants) gt 0  or LIstFindNoCase (session.empl_id,mainsearch.idAuthor) gt 0>Edit</cfif></td>
</tr>
</cfloop>


0
 

Author Closing Comment

by:tport_rti
ID: 31505916
Thanks much!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question