Solved

How to keep from displaying a record when the day is Saturday or Sunday?

Posted on 2002-06-05
2
185 Views
Last Modified: 2013-12-24
I have a calendar cf application.  The query ouputs the proper records to the correct cells in the calendar.  

I want to not output the record if the day is Saturday or Sunday.  Below is the code I currently have.  How can I edit it to work correctly?

<CFLOOP INDEX="ii" FROM="1" TO="#CalDays#">
               <CFIF #ii# GTE #Offset# and #ii# LTE #LastSlot# >
                    <TD BGCOLOR="whitesmoke" valign=top WIDTH="" height="40">
                         <CFOUTPUT ><FONT SIZE="3"

COLOR="black">#day#</FONT><br></cfoutput>
                         <cfoutput query="SearchResults">
   
  <cfset dayofweek = DayOfWeek(Now()) IS "1">
  <cfset dayofweek2 = DayOfWeek(Now()) IS "7">
   <CFIF #Day# greater than '#day(firstout)#' and #Day# less than '#day(lastout)#'>
<CFIF #Day# is not dayofweek>
 <A HREF="default_details.cfm?pk=#pk#"><FONT size="-2" color="red"></FONT><FONT FACE=ARIAL

size="-2">#name# </FONT><FONT FACE=ARIAL SIZE="-2" COLOR="red">#reasonout#</A></FONT><br>
<cfelseif #Day# is not dayofweek2>
   <A HREF="default_details.cfm?pk=#pk#"><FONT size="-2" color="red"></FONT><FONT FACE=ARIAL

size="-2">#name# </FONT><FONT FACE=ARIAL SIZE="-2" COLOR="red">#reasonout#</A></FONT><br>
<cfelse>
</cfif>
</cfif>
                      <CFIF #Day# is '#day(firstout)#'>      
                                 <A HREF="default_details.cfm?pk=#pk#"><FONT FACE=ARIAL size="-2">#name#

</FONT><FONT FACE=ARIAL SIZE="-2" COLOR="red">#reasonout#</A></FONT><br>

                                 <CFelseIF #Day# is '#day(lastout)#'>
                                 <A HREF="default_details.cfm?pk=#pk#"><FONT FACE=ARIAL size="-2">#name#

</FONT><FONT FACE=ARIAL SIZE="-2" COLOR="red">#reasonout#</A></FONT><br>
                           
                      </cfif> </cfoutput>
0
Comment
Question by:g118481
2 Comments
 
LVL 5

Expert Comment

by:nathans
ID: 7093622
This is not an answer first I want to comment on a few things.  Hopefully the spacing I used for your post does not get messed up.  I added some comments too.  You need to comment your code it helps you and others maintence it and trouble shoot it.  Also provide Default values for fields passed in this makes it easier for the troubleshooter to help you.  Also if you post code make sure the ending of cfloops, cfifs and others are there.

Hope this helps you get started on solving your problem.


Comment:

      <cfset dayofweek = DayOfWeek(Now()) IS "1">
      <cfset dayofweek2 = DayOfWeek(Now()) IS "7">

If today is Sunday:
dayofweek  = Yes
dayofweek2 = No

If today is Saturday:
dayofweek  = No
dayofweek2 = Yes

All other days
dayofweek  = No
dayofweek2 = No

========================================================
<!--- Start of Loop 1 --->
<!--- CalDays?  Where is CalDays coming from? --->
<CFLOOP INDEX="ii" FROM="1" TO="#CalDays#">

     <!--- Start CFIF 1 --->
  <CFIF #ii# GTE #Offset# and #ii# LTE #LastSlot# > 
    <TD BGCOLOR="whitesmoke" valign=top WIDTH="" height="40">

          <!--- Output Day?  Where is Day coming from? --->
    <CFOUTPUT ><FONT SIZE="3" COLOR="black">#day#</FONT><br></cfoutput>

          <!--- Output Query SearchResults where is that query? --->
    <cfoutput query="SearchResults">

      <cfset dayofweek = DayOfWeek(Now()) IS "1">
      <cfset dayofweek2 = DayOfWeek(Now()) IS "7">

               <!--- Start CFIF 2 --->
               <CFIF #Day# greater than '#day(firstout)#' and #Day# less than '#day(lastout)#'>


                    <!---
                    If this is where your checking to see if this is Saturday or Sunday then you need to know... that both dayofweek and dayofweek2 will equal either yes or no and that is all.
                     --->
                    <!--- Day 1 Sunday --->
        <CFIF #Day# is not dayofweek>
          <A HREF="default_details.cfm?pk=#pk#">
                         <FONT FACE=ARIAL size="-2">#name# </FONT>
                         <FONT FACE=ARIAL SIZE="-2" COLOR="red">#reasonout#</A></FONT>
                         <br>
                    <!--- Day 2 Saturday --->
                    <cfelseif #Day# is not dayofweek2>
                         <A HREF="default_details.cfm?pk=#pk#">
                         <FONT FACE=ARIAL size="-2">#name# </FONT>
                         <FONT FACE=ARIAL SIZE="-2" COLOR="red">#reasonout#</A></FONT>
                         <br>
                    <cfelse>
                         <!--- Blank? --->
                    </cfif>

               <!--- End CFIF 2 --->
               </cfif>

               <!--- What is this? where does firstout come from? --->
      <CFIF #Day# is '#day(firstout)#'>      
        <A HREF="default_details.cfm?pk=#pk#">
                 <FONT FACE=ARIAL size="-2">#name#</FONT>
                 <FONT FACE=ARIAL SIZE="-2" COLOR="red">#reasonout#</A></FONT>
                 <br>
               <!--- What is this? where does lastout come from? --->
               <CFelseIF #Day# is '#day(lastout)#'>
                 <A HREF="default_details.cfm?pk=#pk#">
                 <FONT FACE=ARIAL size="-2">#name#</FONT>
                 <FONT FACE=ARIAL SIZE="-2" COLOR="red">#reasonout#</A></FONT>
                 <br>
         </cfif>
     </cfoutput>



     <!--- End CFIF 1 --->
  </cfif>
<!--- End of Loop 1 --->
</CFLOOP>
========================================================

0
 
LVL 1

Accepted Solution

by:
parekh_minal earned 100 total points
ID: 7205755
Hi,

Hope this will help you.

<cfset today = DateFormat(now(), "dddd")>

<cfif (today eq 'Sunday') OR (today eq 'Saturday')>
    Do not display record
<cfelse>
    Display Record
</cfif>
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question