?
Solved

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

Posted on 2002-06-05
2
Medium Priority
?
192 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 300 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

762 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