Skip to main content
Inspiring
June 22, 2006
Question

<cfif> questions

  • June 22, 2006
  • 3 replies
  • 365 views
When i use <cfoutput>#Mid(str, 15, 3)</cfoutput> it produces the value 16.....so 16 is GT 12 but all my results say AM....Can anyone see where i am making the mistake in the logic.... It goes right to the <cfelse block>......thanks

<cfif Mid(str, 15, 3) GT 12>
<cfset str = str & Right(Evaluate("dateseen#i#"), 5) & " PM , ">
<cfset str = str & Left(Evaluate("dateseen#i#"), 10) & " , ">
<cfelse>
<cfset str = str & Right(Evaluate("dateseen#i#"), 5) & " AM , ">
<cfset str = str & Left(Evaluate("dateseen#i#"), 10) & " , ">
<cfset str = str & Evaluate("pnum#i#") & " , ">
<cfset str = str & Evaluate("loca#i#") & " , ">
<cfset str = str & Evaluate("vider#i#")>
This topic has been closed for replies.

3 replies

Inspiring
June 22, 2006
You maybe doing a string comparison instead of the numeric you want.

You could try <cfif val(Mid(str,15,3)) GT 12>

Also, may I ask what kind of variables dateseen, pnum, local, and vider
are? I suspect you should be able to remove all the Evaluate()
functions which seldom are necessary.


PackinDaMAC wrote:
> When i use <cfoutput>#Mid(str, 15, 3)</cfoutput> it produces the value
> 16.....so 16 is GT 12 but all my results say AM....Can anyone see where i am
> making the mistake in the logic.... It goes right to the <cfelse
> block>......thanks
>
> <cfif Mid(str, 15, 3) GT 12>
> <cfset str = str & Right(Evaluate("dateseen#i#"), 5) & " PM , ">
> <cfset str = str & Left(Evaluate("dateseen#i#"), 10) & " , ">
> <cfelse>
> <cfset str = str & Right(Evaluate("dateseen#i#"), 5) & " AM , ">
> <cfset str = str & Left(Evaluate("dateseen#i#"), 10) & " , ">
> <cfset str = str & Evaluate("pnum#i#") & " , ">
> <cfset str = str & Evaluate("loca#i#") & " , ">
> <cfset str = str & Evaluate("vider#i#")>
>
Inspiring
June 22, 2006
I agree with you. The 3 character variable obviously contains a
non-numeric character.

jdeline wrote:
> The statement <cfif Mid(str, 15, 3) GT 12> is extracting a 3 character value
> and comparing it to a 2 character value. Without knowing what the value of str
> is, it's tough to get more specific. Try the code below instead of your CFIF.
>
>
> <cfif Trim(Mid(str, 15, 3)) GT 12>
>
June 22, 2006
The statement <cfif Mid(str, 15, 3) GT 12> is extracting a 3 character value and comparing it to a 2 character value. Without knowing what the value of str is, it's tough to get more specific. Try the code below instead of your CFIF.