Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cf filter not working 1

Status
Not open for further replies.

maximos

Technical User
Sep 27, 2002
109
CA
Hi i , have a directroy search, that certain result will show Bolded (special customers) which works no problem, but what i'm trying to do is, have another alternative color or font size for more special customers,

but my cfif statememnt is not outputing the right result here is my codes ,, (i have a ms access database with 2 feilds each are yes/no data type , one is called "bold" and one called "more_bold"
------------------------------------------------------------
<cfif qItems.bold>

<td><a href=&quot;detail.cfm?ContactID=#ContactID#&quot; ><font color=&quot;##FFF000&quot; size=&quot;3&quot;><strong>#CompanyName#</strong></font></a></td>

<cfelse>
<td><a href=&quot;detail.cfm?ContactID=#ContactID#&quot; >#CompanyName#</a></td>
</cfif>

<cfif qItems.bold>

<td><a href=&quot;detail.cfm?ContactID=#ContactID#&quot; ><font color=&quot;##FF0000&quot; size=&quot;2&quot;><strong>#CompanyName#</strong></font></a></td>

<cfelse>
<td><a href=&quot;detail.cfm?ContactID=#ContactID#&quot; >#CompanyName#</a></td>
</cfif>


----------------------------------------------------------
I have a feeling i'm ending the cfif in the wrong place, or the table somehow is not right,

Thanks alot in adavnce
 
You haven't stated exactly what results you are expecting so it's a bit difficult to figure out the solution to your problem.

But..

looking at the code you posted, the second cfif condition looks suspicious:

Why do you run the same condition twice? ie. The first condition is <cfif qItems.bold> and the second condition is <cfif qItems.bold>. It seems to me you want to have the second condition be <cfif qItems.more_bold>.

That being said, I'm thinking that your conditions should be wrapped up in one set of conditions. ie:

<cfif qItems.more_bold is &quot;yes&quot;>
<td><a href=&quot;detail.cfm?ContactID=#ContactID#&quot; ><font color=&quot;##FFF000&quot; size=&quot;3&quot;><strong>#CompanyName#</strong></font></a></td>
<cfelseif qItems.bold is &quot;yes&quot;>
<td><a href=&quot;detail.cfm?ContactID=#ContactID#&quot; ><font color=&quot;##FF0000&quot; size=&quot;2&quot;><strong>#CompanyName#</strong></font></a></td>
<cfelse>
<td><a href=&quot;detail.cfm?ContactID=#ContactID#&quot; >#CompanyName#</a></td>
</cfif>

As a side note; Have you thought about adding a field in your database that defines formatting values?

For instance; if you were to add a couple more fields to your table (sColor,sTextSize), you could store the hex value of the color and the numeric size of the text in your table. The implication of this is that you wouldn't have to run any conditions at all in your output. You would simply do something like this in your output:

<cfoutput query=&quot;qryName&quot;>
<td><a href=&quot;detail.cfm?ContactID=#ContactID#&quot;><font color=&quot;#sColor#&quot; size=&quot;#sTextSize#&quot;><strong>#CompanyName#</strong></font></a></td>
</cfoutput>

If you add the xtra two fields you can then get rid of your bit fields (bold and more_bold).

Of course changing your db design may be more work than it's worth - I just thought I'd throw out an idea.
 
Works beatifull now,

Thanks alot , you deserve a star
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top