Solved

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

Posted on 2002-06-05
2
183 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now