Solved

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

Posted on 2002-06-05
2
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
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…

749 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