Skip to main content
Inspiring
May 27, 2006
Answered

<CFIF> and Trim Help Needed

  • May 27, 2006
  • 2 replies
  • 446 views
The code below is not supposed to show a URL link if the the returned results record is empty. Instead it shows " http:///" even though the record is empty and I need some help fixing it please.

Thanks
----

<cfloop from="1" to="6" index="i">
<cfif Trim(Evaluate("qrySchedule.room" & i)) NEQ "">
<cfset variables.spaceused = variables.spaceused + 1>
<cfif "trim(qrySchedule.room#i#web)" NEQ "" >
<a href=" http://#Evaluate('qrySchedule.room' & i & 'web')#" target="_blank" class="schedule_performer">#Evaluate('qrySchedule.room' & i)#</a>
<cfelse>
<span class="schedule_performer">#Evaluate('qrySchedule.room' & i)#</span>
</cfif>
<br>
</cfif>
</cfloop>
----

    This topic has been closed for replies.
    Correct answer IraMSN
    Query works fine. Returns the proper data but inserts a hyperlink into each result.

    Played around a little more and found this solution:

    <cfif trim (Evaluate("qrySchedule.room#i#web")) NEQ "" >

    Thank you for your suggestions. It steered me in the right direction.

    2 replies

    Inspiring
    May 27, 2006
    You can start by taking the quotes away left of NEQ. Does your query not tell you what performer is in what room?
    IraMSNAuthorCorrect answer
    Inspiring
    May 27, 2006
    Query works fine. Returns the proper data but inserts a hyperlink into each result.

    Played around a little more and found this solution:

    <cfif trim (Evaluate("qrySchedule.room#i#web")) NEQ "" >

    Thank you for your suggestions. It steered me in the right direction.
    Inspiring
    May 27, 2006
    Too much code. This is all you need.
    <cfoutput query="something">
    <cfif thefield neq "">
    hyperlink
    <cfelse>
    no hyperlink
    </cfif>
    </cfoutput>
    IraMSNAuthor
    Inspiring
    May 27, 2006
    I have 6 possible performers in that room so I need to loop though and see if there is a match.

    This line is my problem but I can't get the syntax correct: <cfif "trim(qrySchedule.room#i#web)" NEQ "" >