Need To Return Calendar Events For Current Day

Hello,
I have a calendar which includes seperate start and end date fields. I need to write a query that will return events for each day in a month, but I need to be mindful of the fact that some events span multiple days. Here is my query so far which isn't working quite right.
<cfquery name="qTodayEvents" datasource="#getDatasource()#">
SELECT eventID, title, summary, code, description
FROM events INNER JOIN eventTypes ON events.typeID=eventTypes.typeID
WHERE deleted=0
AND
  startDate >= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayStartTime#" />
  AND startDate <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayEndTime#" />
) OR (
  endDate >= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayStartTime#" />
  AND endDate <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayEndTime#" />
) OR (
  startDate <= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayStartTime#" />
  AND endDate >= <cfqueryparam cfsqltype="cf_sql_timestamp" value="#todayEndTime#" />
</cfquery>
The query is located inside a loop which loops through the days in a given month.
Does anyone know what I am doing wrong? Any assistance would be appreciated.
Many thanks,
Simon

You have to do nested loops - one for the days of the month, and once for the query.  It probably does not matter which is nested inside of what.  You want your query ordered by EndDate.  Then you can do something like this.
ControlDate = Date1;
MaxDate = arraymax(yourquery["enddate"]);
<cfloop condition = ControlDate lt Date2>
<cfloop from = "1" to = yourquery.recordcount index = 1>
<cfif ControlDate >= StartDate and ControlDate <= EndDate>
your code goes here
<cfelse>
break
</cfif>
<cfloop>
add a day to ControlDate
maybe break if the control date is greater than the max date.
</cfloop>

Similar Messages

  • Display all calendar events for the day in notification centre

    Hi there apple community,
    I was hoping someone could point me in the right direction. I can only see a couple events in notification centre. I was hoping there is a way to show all the events for the day in notification centre.
    Thank you for any help you can give me!

    I want my events and birthdays there... please help me...
    Thanks

  • Auto Refresh OBI Page for Current Day Only

    Hello Guru's
    I have a obiee page which needs to get refreshed every 30 seconds . I could able to do that using <META HTTP-EQUIV = "REFRESH" CONTENT = "30"> . But the triggy part is , auto refresh needs to be applied only for current day and not for any date range selected by user .
    Details :
    Prompts are defaulted to current date and time on the page, but user can also select date ranges as well . So the setting for auto refresh needs to apply only on current date (default prompt values) and not if the the user select data range .
    let me know if any of you guys have come across such .

    Check the below link and tweak it if needed.
    http://www.cool-bi.com/Customize/AutoRefresh.php
    Appreciate if you mark as correct :)
    Let me know for issues
    Edited by: Srini VEERAVALLI on Jan 4, 2013 10:46 AM

  • HT1692 IOS7 calendar.   I want to see all my events for a day listed when I go to that day, not have to scroll through 24 freakin' hours.  How do I manage that?

    When I go to a day, I want to see a list of my events for that day in order, together, not have to scroll through 24 hours. 

    You can tap on the magnifying glass in the upper right and see a list view.

  • Calendar Entries for multiple days

    Can you create one calendar entry for different days without having to enter the entry on each day and setting it to a weekly event?  eg. swimming on Monday and Wednesday every week.  I seem to have to enter it twice.

    You have to enter it twice.  Each event on each day is considered a separate event, so you have to enter them separately as repeating events.

  • Emails for Current Day are not sync with Microsoft Exchange server

    I have bought a Z1 and configured my microsoft exchange server email on it. All is working well. However it is only showing emails till yesterday. I have tried all sync settings including automatic, all, one day and all others but still it is not showing emails for current day. I have also tried all sort options but still no improvement.
    The same setting are working perfectly fine on my Samsung Galaxy Note 2. What is the issue and how to fix it? Please make sure i have purchased a new phone and would use the stock email app and no third party email app. 
    Already there is a downgrade in Z1 stock email app. It is not supporting formatted signatures and formatted outgoing emails. Which is now very common on all phones of its price and class. 
    What is Sony doing on its phones? i do not understand.
    Please let me know how to fix my issue of most recent emails sync.

    http://office.microsoft.com/en-us/support/set-up-email-on-an-android-phone-or-tablet-HA102823196.asp...
    "I'd rather be hated for who I am, than loved for who I am not." Kurt Cobain (1967-1994)

  • "Fix" for Calendar Events displaying one day early

    I posted a question about this a couple of weeks ago, but can't find my original post. No way to search by user name, so I gave up looking for it after 10 or so pages. Because there are several others who have posted about the same problem, I decided to start a new discussion describing the fix that worked for me, with help from Apple Tech Support.
    Background of my problem: New iPhone 4S, set up as "new phone" -- calendar events synced via MobileMe without any problems. Or so I thought. Discovered a few days later that any "All Day" event was shown on the day prior to the actual event -- US Holidays and Birthdays in particular.  Events with specific start/end times were displaying on the correct day.
    Checked these forums and was unable to find a solution, so I made an appointment for the following week with Tech Support to have someone call me. Fred first had me try resetting the phone. Didn't fix it.
    Note: Somewhere in our troubleshooting, he had me turn off the Birthday and US Holiday calendars on both the phone and iCal on my computer, then turn them back on and do a sync. This did not correct the event dates. If I remember correctly (I wasn't taking notes), this was before changing any settings in iTunes and didn't fix the problem. However... it *might* have played a part in the final fix, so if the following steps don't fix it for you, try adding in the off/on for the calendars before changing the iTunes sync settings.
    What finally worked :
    Changing a setting in iTunes to overwrite the Calendar on my iPhone and doing a Sync (bypassing MobileMe entirely). Here's how to do it.
    In iTunes, go to the "Info" tab and scroll down to the Advanced section. There are 5 checkboxes there and selecting one or more will overwrite the corresponding items on the iPhone during the next sync only. He had me check Calendar, then perform a Sync.
    That worked!  For US Holidays, but most of the birthdays were still one day off, except ones I'd entered manually in iCal. All of the misplaced birthdays are published by dates I've entered for contacts in Address Book on my Mac.
    I went back to iTunes and checked Birthdays in the Advanced area and performed another sync. That overwrote the Birthday calendar on the phone and now all of my Birthdays and US Holidays are showing on the correct days.
    Would have been quicker if I had checked Birthdays at the same time as US Holidays, so when you follow the steps, check both Birthdays and Holidays to save yourself some time.
    Hope this helps all of you who are having the same problem I was.

    All of my dates are out by one day in ical (and address book). I can change them manually (best advice I could get from Apple), but it keeps happening to me. Any help appreciated, I have 10.8.6; macbook pro, iphone 4s and am frustrated. This seems to be a common problem but I can't find a fix. 
    In the post above advice is to go to itunes, "info tab", Advanced...but I don't see an "info tab" -
    Thanks for any help!
    Joan

  • Calendar does not show events for current month unless I switch away and back

    I have had this issue on my iPad 1st gen (with OS 5.1, also happened on previous OS version) where when I open my calendar in month view, the entire month will be blank (have no events showing). I have to swipe to a different month and then back to the first month, and then it will show all of my events for the month. This is a pretty annoying bug. Are there any fixes for this?
    edit: I see this has also been reported at https://discussions.apple.com/message/17750848

    Happening to me, too.  Started with 5.0 and continues on 5.1.  I referenced your thread in the one that you listed, just to keep them linked up and build up a list of affected users.

  • Function module to get holiday class from work schedule for current day

    I need to determine what the public holiday class value is for the current day in a user exit.  Is there an SAP function module that can return me this data?  This would be the information that is displayed when pressing the work schedule button from infotype 0007

    Function module HOLIDAY_CHECK_AND_GET_INFO is closer to what I need.  This function module returns an X if the day is a holiday.  I will create a Z program and instead of returning an X for a holiday I will return the THOL-KLASS (holiday class) value.

  • Calendar events on wrong days

    I am baffled. I sync my iPhone 3G with my PC's Microsoft Outlook. My events are correct in Outlook, but many of them show up on the wrong day on my iPhone calendar. These are both repeating and one-time events.
    For example, I have an all-day event for the start of Daylight Savings Time. In both Outlook and the iPhone, it shows as a repeating event "Every year on the second Sunday in March". This year, that means Sunday, March 13, from 12:00 AM to 12:00 AM. But on the iPhone, it is showing as occurring on Friday, March 11, from 12:00 AM to 11:00 PM. Even though the repeat is correct on the iPhone.
    I have tried the sync option of replacing the entire calendar on the iPhone from the Outlook calendar and it does not fix the problem. I've also tried reboot and reset to no avail.
    Any ideas?

    I tried some other things like
    1. Un-sync the calendar from Outlook and let iTunes (10.2.0.34) delete all my events from the iPhone's calendar.
    2. Confirm iPhone calendar is empty.
    3. Reboot the iPhone. Confirm iPhone calendar is still empty.
    4. Re-sync the calendar with Outlook. Confirm iPhone calendar is populated.
    No joy. While most events are correct, many are not.
    My iPhone calendar is now unreliable. It even shows St. Patrick's Day on March 16!
    I've reported this as a bug on the feedback page. I hope it gets fixed soon.
    If anyone has any ideas for fixes or workarounds, I'd love to hear them!

  • Calendar events showing every day

    Hi all,
    Recently it seems that when my Calendar app is displaying month view, every day has a little square in it - the one that indicates an event. However, about half of my days have no events at all.
    I have repeating events set every eight days for four days (for my four-on four-off shift rotation) but that's about all. I'm sure I remember it used to show correctly, i.e. blocks of four with events and blocks of four without.
    Anyone any ideas what's happened?
    Thanks for reading
    BBz

    I have the same problem. With me it is only on the "Birthdays" calendar which was uploaded from iCal to my calendar server before I went with syncing with CalDAV. The daily and list formats do not show anything weird, only the monthly view. I assume it is a problem with a repeating event, but I can't find it.
    I've even done a reset and reload from backup of my iPod and it did not help. Next step is probably to delete the Birthday's calendar completely on my server and see if that cures the problem. I am waiting until there is an easy way to restore it on the server.
    Any other ideas would be appreciated.

  • Calendar events spanning multiple days

    Hi,
    For events lasting multiple days, is there a way edit the calendar package so that it displays the event each day from the start to end date?
    Thanks!

    Hi,
    The values(EVENTS) would anyway appear if there are entries in the table on which you are creating the calendar for e.g.
    EVENT-1 01-JAN-02
    EVENT-1 02-JAN-02
    EVENT-1 03-JAN-02
    EVENT-2 04-JAN-02
    Create the calendar and order by the date field and the data should appear ..
    Pl. could you explain further what exactly you want to display.
    You can also restrict the calendar display by using the start and end month option.
    Thanks,
    Anu

  • Calendar Events design on 'Day' view

    Hi,
    I noticed a change in my iPhone calendar.
    I remember that the colors and design of events under the "Day" view were different in lower versions of iPhone (I'm using 4.1). The colors used to be more vivid and the design of an event was 3D like. Also the font of the event it self was White.
    Now, in 4.1 the colors in calendars are not vivid and the design is flat.
    Have any of you guys noticed it?
    Thanks,
    Lior.

    I have pretty much the same issue except the bolded part.
    {quote:title=EagleOwl wrote:}However, when I scroll backwards in the day view from the 2nd November, the event in the 1st November is now visible *and the event on the 31st October, which was visible while scrolling forward, is lost.*{quote}
    And yeah, there are other dates where the events will behave like the ones on November 1st.
    For example: February 1st and March 1st 2010... August 1st 2011... October 1st 2012, and so on...
    I noticed that they all have something in common: they don't have any "grey" dates at the beginning of the month (in "Month" view)...

  • Report for current day and current month

    Hi gurus,
    i 've a report, where i 've to display the values for qty and cost of the material for the current day and current month
    HOw can i do this in BEx Query designer..If any document plz share
    thanks
    rakesh

    hi Kolli
    here i want to filter the data on system date,
    i wnt the report to pick the date dynamically based on the system date.
    but i think restricting on calmonth and calday is not going to solve my scenario..
    rakesh

  • Ipad calendar events are one day early

    Hello,
    I recently switched over to iCloud. And now all-day events are one day early on my iPad only. The dates are fine when I look at iCal on the web, and they're fine on my Mac Pro and my MacBook. I tried resetting the iPad, and it didn't fix it. The time zone is was set to automatic, I tried setting it to manual, but still no change. Any other ideas?
    thanks!
    Joe

    All of my dates are out by one day in ical (and address book). I can change them manually (best advice I could get from Apple), but it keeps happening to me. Any help appreciated, I have 10.8.6; macbook pro, iphone 4s and am frustrated. This seems to be a common problem but I can't find a fix. 
    In the post above advice is to go to itunes, "info tab", Advanced...but I don't see an "info tab" -
    Thanks for any help!
    Joan

Maybe you are looking for

  • Iphone 6 rotation issue...

    Basically dropped my phone a couple of times, also spilt water on it...both in the same night...water didnt appear to penetrate the phone but for some reason i can now only view things in landscape that have landscape capability...ie messages, photo'

  • Connecting external speakers, connecting external speakers, connecting bose companion external speakers

    having trouble connecting my bose companion external speakers,  it does not appear in the sound configuration in system preference menu.  i am using macbook 15" on Lion OS. this has worked previously until i took the the speakers to Bose for repair o

  • Sharing global routing table with vrf for intra-as traffic

    We have a network block of 10.201.0.0/16 which is divided into two subnet 10.201.0.0/18 and 10.201.192.0/18. We are getting a internet feed for each subnet. 10.201.192.0/18 is in global routing table, and 10.201.0.0/18 is in a vrf-lite green. I am th

  • DW MX 2004 will not open

    I have been using DW MX 2004 for several years without incident.  today when I went to open it up I got an "access denied" error message.  I tried to install the updater and got another message that said that DW MX 2004 was not in the designated fold

  • VPN from an RDP Session

    Hello there, We are trying to connect to an anyconnect instance through an RDP session.  We have no difficulty connecting, but once we do the RDP session is terminated.  This makes sense in theory, but is there any way to avoid this?  Enabling split-