Avatar of 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>

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

8/22/2022 - Mon

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

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">
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<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">


<cfif isDefined("form.Submit")>
        <cfinvokeargument name="date" value="#form.optDate#"/>


<table class="rptSubTable">

<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>


<cfoutput query="rptSubRet">

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


Open in new window


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
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

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

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

My title date was a Friday :-)

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')#" >
                <img src="../img/clear.gif" title="no surveys submitted" >
         <cfset fridayDate  = dateAdd("d", 7, fridayDate )>

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

>> My title date was a Friday :-)

lol.  Now that's a funny coincidence.

Thank you that really helped

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.

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

>> 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 ;-)