EasyCFM.COM ColdFusion Forums / Coding Help! / Controlling Dynamic Sequencing

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Controlling Dynamic Sequencing

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

TheLadyCoder
12-03-2002 @ 2:37 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 4
Joined: Dec 2002

I am trying to control my dynamic sequentialling. I want a message to display if there is nothing in the next numbered sequence, then it states that the test has been completed and the 'next' link goes away. I'm not quite sure how to do the <cfif> portion of it.

Thanks in advance.


<CFIF scenariosequence is true>
  <cfset url.scenariosequence = url.scenariosequence + 1>
  <td>
     <CFOUTPUT>
        <a href="assessment.cfm?ModuleID=#qryModuleInfo.ModuleID#┬žionID=#qrySectionInfo.sectionID#&
           scenarioID=#qryScenario.scenarioID#&scenariosequence=#url.scenariosequence#">next</a>
     </CFOUTPUT>
  <cfelse>
    <BR>
    <BR>
    <CFOUTPUT><B>You have completed this section of Module 1</B></CFOUTPUT>
   </cfif>
</TD>
</FORM>

TheLadyCoder
(I modified your post to make it easier to readn so it wouldn't throw forum tables off - Pablo)

This message was edited by Webmaster on 12-4-02 @ 3:07 PM

Webmaster
12-03-2002 @ 5:06 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4542
Joined: Jan 2002

How are you arriving at how many items there are to process?

in other words, is there a recordcount of some sort?

Thanks,
Pablo Varando
EasyCFM.COM, LLC.

TheLadyCoder
12-04-2002 @ 7:14 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 4
Joined: Dec 2002

No, there is no record count, which is why I am having an issue. What happens is that variables are passed from the previous form and data populates that page according to matching id's in 2 tables. Here is the whole code:

<cfif isdefined ("url.SectionID") and isdefined ("url.ModuleID")>
     <cfparam NAME="url.scenariosequence" DEFAULT="1">

     <cfquery name="qryScenario" datasource="#request.database#">
     select ScenarioID, ScenarioSequence, ScenarioTitle, ScenarioText
     From tblScenarios
     where sectionID = '#url.SectionID#' and Active = 1 and scenariosequence = '#url.scenariosequence#'
     order by ScenarioSequence
     </cfquery>
     
     <cfquery name="qrySectionInfo" datasource="#request.database#">
          select SectionID, SectionTitle, SectionSequence, SectionText, ModuleID, Active, Weight
          from tblSections
          where  ModuleID = '#url.ModuleID#' and Active = 1
          order by s.SectionSequence
     </cfquery>

     <cfquery name="qryModuleInfo" Datasource="#request.database#">
     Select moduleID, moduletitle
     from tblmodules
     where ModuleID = '#url.ModuleID#'
     </CFQUERY>
     
     <cfquery name="qryQuestions" Datasource="#request.database#">
     Select QuestionID, QuestionText, QuestionDesc, QuestionSequence, QuestionName, ImagePath, Active, CorrectAnswer
     from tblquestions
     where ScenarioID = '#qryScenario.ScenarioID#' and Active = 1
     order by QuestionSequence
     </CFQUERY>
     
     <cfelse>     
     <cfoutput>No module has been selected</CFOUTPUT>
     <cfabort>
     </cfif>
<cfsetting enablecfoutputonly="no">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
</head>

<body bgcolor="#ffffff" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">

          
<table width="60%" cellpadding="6" cellspacing="0" border="1" ALIGN="center">
     <TR>
          <TD><P ALIGN="center"><B>SECTION MENU</B></P></TD>          
     </TR>

<!---Display the name of the Module that the user is on --->
     <tr>
          <td><A HREF="modules.cfm">Back to Module Menu</A></TD>
     </TR>
     
     <tr>
          <td id="h14k-b"><cfoutput>#qryModuleInfo.ModuleTitle#</CFOUTPUT></td>
     </tr>
     

<!--- Display the appropriate scenarios for the selected Module --->

     <CFLOOP QUERY="qryScenario">
     <cfset currentScenarioID = qryScenario.ScenarioID>
     <tr>
          <TD VALIGN="top" ALIGN="left" BGCOLOR="FFFFFF"><FONT FACE="Arial" SIZE="2"><CFOUTPUT>#qryScenario.ScenarioTitle#</CFOUTPUT></td>          
     
     </TR>
     </CFLOOP>
</table>
<BR>
<TABLE WIDTH="60%" BORDER="1" CELLSPACING="0" CELLPADDING="6" ALIGN="center" BORDERCOLOR="#0000FF">
<TH>Scenario Questions</TH>
<CFLOOP QUERY="qryQuestions">     
     <tr>
          <TD VALIGN="top" ALIGN="left" BGCOLOR="FFFFFF"><FONT FACE="Arial" SIZE="2"><CFOUTPUT>#qryQuestions.QuestionText#</CFOUTPUT></td>          
     
     </TR>
</CFLOOP>
</TABLE>     
     
     
<table width="60%" cellpadding="6" cellspacing="0" border="1" ALIGN="center" BORDERCOLOR="#cc12FF">
<BR>
     <TR>

<FORM>
<INPUT TYPE="button" VALUE="Previous" onClick="history.back()" style="background-color: #DBD3C1; color: #000000; border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0; border-top: 1px solid #C0C0C0; border-bottom: 1px solid #C0C0C0">

<!---  <cfif url.scenariosequence is true> --->
<CFIF scenariosequence is true>
<cfset url.scenariosequence = url.scenariosequence + 1>
<td>
<CFOUTPUT>
<a href="assessment.cfm?ModuleID=#qryModuleInfo.ModuleID#┬žionID=#qrySectionInfo.sectionID#&scenarioID=
#qryScenario.scenarioID#&scenariosequence=#url.scenariosequence#">next</a>
</CFOUTPUT><cfelse>
<BR><BR><CFOUTPUT><B>You have completed this section of Module 1</B>
</CFOUTPUT></cfif></TD>
</FORM>
</TR>
</table>

</body>
</html>

TheLadyCoder

This message was edited by Webmaster on 12-4-02 @ 3:08 PM

TheLadyCoder
12-04-2002 @ 8:31 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 4
Joined: Dec 2002

Actually, let me clarify the function that is needed. The user will complete a set of questions within a scenario. So, it needs to be determined if there are any more questions within that sequence. If so, the word 'next' will stay visible and if not, then a message will appear that they have completed the questions for that section.

TheLadyCoder

TheLadyCoder
12-06-2002 @ 10:36 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 4
Joined: Dec 2002

Never mind, I have figured a solution.

Thanks anyway.

TheLadyCoder


Website Designed and Developed by Pablo Varando.