Avatar of Ru1995
Ru1995
Flag for United States of America asked on

Match query dates with week dates on a report

I am creating a report that displays whether or not the user submitted a survey during a certain period.  

The header of the report shows all 52 weeks in a year and its displayed like this

<tr><td colspan="2">&nbsp;</td>
            <cfloop from="1" to="52" index="wk"><td class="dspWeek"><a class="date">#wk#<span>Date</span></a></td></cfloop>
      </tr>

However, know the user wants a rollover date functionality that displays the date of when the user submitted the form.  

If I pull distinct dates from a query how would I match it with the title headers on the report?

Also if there aren't any dates to match with the period it should display something like "no surveys submitted"

ColdFusion Language

Avatar of undefined
Last Comment
_agx_

8/22/2022 - Mon
_agx_

I'm not following you on this one.  Can you give an example of what this new report should look like?
Ru1995

ASKER
I have attached a word doc that show what I'm talking about.  Also here is the code that currently have.  agx I think you help me write it
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title><cfoutput>#Application.ApplicationName#</cfoutput></title>
	<link href="../css/style.css" rel="stylesheet" type="text/css">
	<link rel="stylesheet" type="text/css" href="../css/print.css" media="print">
	<script src="../js/scripts.js"></script>
    
    
    <cfinclude template="template_header.cfm">
	
	<style type="text/css">
	

	
	</style>
	
</head>

<cfif isDefined("form.Submit")>
    <cfinvoke 
     component="Review.Components.Review"
     method="rptSub"
     returnvariable="rptSubRet">
        <cfinvokeargument name="date" value="#form.optDate#"/>
    </cfinvoke>

</cfif>



<body>
<table class="rptSubTable">

<cfoutput>
<h2>Support Report</h2>
<h3>Survey Submission Report &nbsp; #form.optDate#</h3>
<h4><a class="date">Test!<span>01/01/2011</span></a></h4>
     
	  <tr><td colspan="2">&nbsp;</td>
            <cfloop from="1" to="52" index="wk"><td class="dspWeek"><a class="date">#wk#<span>Date</span></a></td></cfloop>
      </tr>

</cfoutput>

<cfoutput query="rptSubRet">

<tr>
	
	<!---<td>#rptSubRet.organization#</td>--->
    	<td class="orgName">#rptSubRet.organization#</td>
      <cfloop list="#rptSubRet.columnList#" index="col">
      	<td>
        	
      		<cfset colValue = rptSubRet[col][currentRow]>
            	<!---#rptSubRet[col][currentRow]#--->
            	<cfif val(colValue) eq 1>
                	<img src="../img/check.gif">
                <cfelseif val(colValue) eq 0>&nbsp;
                	<!---<img src="../img/check2.gif">--->
                </cfif>
                	<!---#rptSubRet[col][currentRow]#--->
					<!---#colValue#--->
                
         </td>      
       </cfloop>
      
</tr>

   </cfoutput>
</table>
</body>
</html>

Open in new window

Submission-Report.doc
ASKER CERTIFIED SOLUTION
Zvonko

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
_agx_

What if there's more than one survey for that week?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Ru1995

ASKER
The survey can only be taken on a friday of each week
Zvonko

My title date was a Friday :-)
_agx_

Then you don't really need to query the dates?  Just set the starting Friday. Then as you loop, increment the date by 1 week each time.  If any surveys were found, show the date as Zvonko described. Otherwise, show a spacer image w/the message "no surveys submitted"

...
<!--- reinitialize date --->
<cfset fridayDate  = firstFridayOfReportYear >
<cfloop list="#rptSubRet.columnList#" index="col">
          <cfif cfif val(colValue) eq 1>
              <img src="../img/check.gif" title="#DateFormat(fridayDate, 'mm/dd/yyyy')#" >
          <cfelse>
                <img src="../img/clear.gif" title="no surveys submitted" >
          </cfif>
         <cfset fridayDate  = dateAdd("d", 7, fridayDate )>
  </cfloop>
...

Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
_agx_

>> My title date was a Friday :-)

lol.  Now that's a funny coincidence.
Ru1995

ASKER
Thank you that really helped
_agx_

Did you not need my sample?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Ru1995

ASKER
No sorry agx I just inserted the responsedate to the query and use that as the title like zvonko said
_agx_

>> If I pull distinct dates from a query how would I match it with the title headers on the report?


Oh, I thought that was your question.  But if you already knew how to match the dates up then your question was totally different than I thought ;-)