Seems like this is a way to do it. I would suggest, without tetsing it...
that instead of doing this

<cfif getTestCount() lt 2>
  <cfreturn "TRUE" />

 <cfelse>
  <cfreturn "FALSE" />
 </cfif>

Do this...

<cfif getTestCount() lt 2>
  <cfset myReturnVar = "TRUE" />

 <cfelse>
  <cfset myReturnVar = "FALSE" />
 </cfif>

<cfreturn myReturnVar/>


Are you getting an error or anything, or was this more of theorhetical
question?
On 10/3/06, Michael Hughes <[EMAIL PROTECTED]> wrote:
>
> Hey folks - I'm brand new to Cold Fusion and inherited an application from
> an advanced developer. I'm trying to change a function in a cfc to allow an
> online test to be taken multiple times based on the user's role and how many
> times they've already taken the test:
>
> <cffunction name="getTestCount"
> returntype="numeric">
>                <cfquery name="getMyTests" datasource="#request.maindsn#"
> dbtype="ODBC" >
>                SELECT count(test_id) total_tests
>                FROM user_tests
>                WHERE user_id = '#THIS.userId#'
>                </cfquery>
>
>                <cfreturn getMyTests.total_tests />
>
>        </cffunction>
>
> <cffunction name="canTakeTest"
>    returntype="boolean">
>
> <cfif getTestCount() lt 2>
>   <cfreturn "TRUE" />
>
> <cfelse>
>   <cfreturn "FALSE" />
> </cfif>
>
> Couldn't I conceivably add a function that would query the database and
> return the role for the specific user id, assign that role as a variable,
> and rewrite the getTestCount() function so that if the test count is <  2
> and the role = a certain value, then the user can take the test multiple
> times?  Thanks for your help! ~M
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:255319
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to