troubleshooting Question

Coldfusion Fusebox nested queries

Avatar of LisaDom
LisaDomFlag for United States Minor Outlying Islands asked on
ColdFusion Language
14 Comments1 Solution613 ViewsLast Modified:
Hi all,
I am using Coldfusion with a Fusebox framework.  I am creating a survey type of application that displays one question per page using previous and next buttons to go back and forth between questions and has the ability to keep the users answers.   I’m using a cfoutput to loop through my main query to get the questions, and then within that loop I need to query the answer table within that main loop.  So I have at the top of my cfm page...
<cfset Question = event.GetValue("qryQuestion")>  
This gets the records I need for my main loop using fusebox framework.  My cfm page has a loop/output of...
<cfoutput query="Question">
   <cfquery name="Answer" datasourse="DSN">
      Select  AID    
     from answers
      where qid =


My main question is how do I call the Answer query using fusebox rather than having a cfquery in my .cfm page? If I put it in my controller page it will query the answers before I need it to.  Isn’t there a way to do a function call of some sort to do a nested query like this?

One solution I have is to use a cfinvoke to call the following cffuntion stored in a cfc in the model folder. This works but I still have a cfinvoke in my .cfm page and doesn’t keep with the MVC or fusebox framework we are currently using.

    <cffunction name=" Answer " returntype="any">
      <cfargument name="myFusebox">
      <cfargument name="event">
      <cfargument name="questionid" default="">
        <cfquery name="getValues" datasource="DSN”>
          Select questionid
          from Answers
          where Answers.questionid = <cfqueryparam cfsqltype="cf_sql_integer" value="#Questionid#">
      <cfreturn getValues>
Any suggestions will be appreciated.

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros