3 Replies Latest reply on Jun 22, 2006 2:29 PM by Newsgroup_User

# &lt;cfif&gt; questions

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#")>
• ###### 1. Re: &lt;cfif&gt; questions
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.
• ###### 2. Re: &lt;cfif&gt; questions
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>
>
• ###### 3. Re: &lt;cfif&gt; questions
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#")>
>