Automatically eliminating a record at the begining of a new month

Hello;
I have a little app I am building that makes a list of records organized by the month the record falls in. this is how it looks:
JUNE
Record title goes here as a link
record date
the location of the event
<!--- all the records for JUNE fall in here, the link goes to a page with all the details --->
JULY
same thing as June
and so on....Now as it is the code works fine, BUT when lets say it goes to JULY, the JUNE records are still visible, I want them to go away after the month passes. Is that possibly an easy task using the code I wrote for this? The don't have to be deleted from the DB, but they need to "disappear" in the web site when the month passes.
This is the code:
<cfquery name="gTempx1" datasource="#APPLICATION.dataSource#" blockfactor="5">
SELECT DISTINCT(YEAR(eventDate)) AS gTempx2, display
FROM events
WHERE display = 0 AND YEAR(eventDate) >= #dateFormat(now(), 'yyyy')# ORDER BY YEAR(eventDate) ASC
</cfquery>
<cfset distintYearEventDate = DateFormat(now(), "yyyy")>
<cfset tempdx = DateFormat(now(), "mm/dd/yy")>
                <cfif DateFormat(now(), "mm/dd/yy") GTE "#tempdx#">
                  <cfoutput query="gTempx1">
                    <cfset gTempx5 = "#gTempx1.gTempx2#">
                    <cfif DateFormat(now(), "mm/dd/yy") GTE "#tempdx#">
                      <cfset gTempx6 = DateFormat(now(), "yyyy")>
                      <cfset gTempx7 = DateFormat(now(), "mmmm")>
                      <cfset distintYear = DateFormat(now(), "yyyy")>
                    </cfif>
                    <cfquery name="gTempx3" datasource="#APPLICATION.dataSource#" blockfactor="5">
                      SELECT DISTINCT(MONTH(eventDate)) AS gTempx4, display
       FROM events
       WHERE display = 0 AND YEAR(eventDate) = #gTempx5#
                      ORDER BY MONTH(eventDate) ASC
                    </cfquery>
                    <cfset dateAdd = DateFormat(now(), "mmmm")>
                    <cfset thirtyTempx1 = "#dateFormat(dateAdd('d',-30,Now()),'mm/dd/yyyy')#">
                    <cfloop query="gTempx3">
                      <cfset gTempx6 = "#gTempx4#/01/#gTempx5#">
<b><u>#ucase("#DateFormat(gTempx6,'mmmm YYYY')#")#</u></b>
<cfquery name="GetRecordevent" datasource="#APPLICATION.dataSource#">
      SELECT events.title AS ViewField2, events.eventDate AS ViewField3, events.location AS ViewField5, events.ID AS ID
      FROM events
      WHERE display = 0 AND YEAR(eventDate) = #gTempx5# AND MONTH(eventDate) = #gTempx3.gTempx4#
      ORDER BY DAY(eventDate) ASC
                      </cfquery>
                      <cfloop query="GetRecordevent">
<a href="detail.cfm?ID=#ID#" class="subNav">
#ViewField2#
#dateformat(ViewField3, "mmm-dd-yyyy")#<br>
Location: #ViewField5#
</cfloop>
</cfloop>
</cfoutput>
</cfif>
can anyone help me out? Don't know what to tweekout on this to make it rotate through the months like a normal calendar.
thank you
CFmonger

I am getting someplace now.
I have been messing with the where statement. I have it so it will eliminate the previous months records, but it is duplicating the records now and makeing them for lets say I have a record is set for July 2009 that same record will appear as July 2010 as well.
This is what I changed my 2 querys to:
q1
<cfquery name="gTempx1" datasource="#APPLICATION.dataSource#" blockfactor="5">
                SELECT DISTINCT(YEAR(eventDate)) AS gTempx2, display
                FROM events
                WHERE YEAR(eventDate) >= #dateFormat(now(), 'yyyy')#
    ORDER BY YEAR(eventDate) ASC
               </cfquery>
q2.
<cfquery name="gTempx3" datasource="#APPLICATION.dataSource#" blockfactor="5">
                      SELECT DISTINCT(MONTH(eventDate)) AS gTempx4, display
       FROM events
       WHERE eventDate > #NOW()#
                      ORDER BY MONTH(eventDate) ASC
                    </cfquery>
q3.
<cfquery name="GetRecordevent" datasource="#APPLICATION.dataSource#">
                        SELECT events.title AS ViewField2, events.eventDate AS ViewField3, events.eventTime
                        AS ViewField4, events.location AS ViewField5, events.ID AS ID
      FROM events
      WHERE eventDate > #NOW()# = #gTempx5# AND MONTH(eventDate) = #gTempx3.gTempx4#
      ORDER BY DAY(eventDate) ASC
                      </cfquery>
can anyone help me fix this so it works properly. for some reason it is making the same records appear every year.

Similar Messages

  • Add records in the beginning of the table

    Hi,
    Is that possible to add or append the records in the beginning of the table.
    For example,
       CREATE TABLE app_test (n NUMBER, n1 VARCHAR2(200));
       and inserting new records
      INSERT INTO app_test
         VALUES (1, 'test');
      INSERT INTO app_test
         VALUES (2, 'test');
      INSERT INTO app_test
         VALUES (3, 'test');
      select * from app_test;
    N     N1
    1     test
    2     test
    3     test
      Is that possible to add the records like below. Appending newly inserted rows in the beginning of the table.
    N     N1
    3     test
    2     test
    1     test
      Thanks
    Radha K

    hI,
    Radha K wrote:
    To get achieve sorting order, i have done the following, but the when i
    query the record, its not showing the order which i created in the index.
    CREATE TABLE iot_app_test (
    n NUMBER,
    n1 VARCHAR2(10),
    n2 TIMESTAMP);
    CREATE INDEX
    iot_app_test_indx
    ON
    iot_app_test
    SUBSTR(n2,1,9) DESC, SUBSTR(n2,11) ASC);
    INSERT INTO iot_app_test
    VALUES (1, 'test', SYSDATE);
    INSERT INTO iot_app_test
    VALUES (2, 'test', SYSDATE);
    INSERT INTO iot_app_test
    VALUES (3, 'test', SYSDATE);
    INSERT INTO iot_app_test
    VALUES (1, 'test', SYSDATE + 1);
    INSERT INTO iot_app_test
    VALUES (2, 'test', SYSDATE + 1);
    INSERT INTO iot_app_test
    VALUES (3, 'test', SYSDATE + 1);
    INSERT INTO iot_app_test
    VALUES (1, 'test', SYSDATE + 2);
    INSERT INTO iot_app_test
    VALUES (2, 'test', SYSDATE + 2);
    INSERT INTO iot_app_test
    VALUES (3, 'test', SYSDATE + 2);
    SELECT *
    FROM iot_app_test
    WHERE n2 <> SYSDATE + 3
    N     N1     N2
    1     test     4/28/2010 1:59:26.000000 PM
    2     test     4/28/2010 1:59:30.000000 PM
    3     test     4/28/2010 1:59:33.000000 PM
    1     test     4/29/2010 1:59:38.000000 PM
    2     test     4/29/2010 1:59:41.000000 PM
    3     test     4/29/2010 1:59:44.000000 PM
    1     test     4/30/2010 1:59:48.000000 PM
    2     test     4/30/2010 1:59:51.000000 PM
    3     test     4/30/2010 1:59:53.000000 PM
    The query doesn't have an ORDER BY clause, so the results could be in any order. In fact, you can run the exact same query with the exact same data seconds apart, and get a different order every time.
    The index doesn't change that. Someone above mentioned an Index Organized Table (which is not merely a table with an index), where you can control the order in which rows are stored (as if you wanted to). There is still no guarantee that, absent an ORDER BY clause, output will be in any particular order.
    But when i use the same function in order by clause, its showing the correct result.To repeat what others have said already, the only way to get output in any particular order is to use an ORDER BY clause.
    (CONNECT BY queries are the only exception of which I know. There is a partial ordering in CONNECT BY output, even if you don't use ORDER BY or ORDER SUBLINGS BY.)
    >
    SELECT   *
    FROM iot_app_test
    ORDER BY SUBSTR (n2, 1, 9) DESC, SUBSTR (n2, 11) ASC;
    N     N1     N2
    1     test     4/30/2010 1:59:48.000000 PM
    2     test     4/30/2010 1:59:51.000000 PM
    3     test     4/30/2010 1:59:53.000000 PM
    1     test     4/29/2010 1:59:38.000000 PM
    2     test     4/29/2010 1:59:41.000000 PM
    3     test     4/29/2010 1:59:44.000000 PM
    1     test     4/28/2010 1:59:26.000000 PM
    2     test     4/28/2010 1:59:30.000000 PM
    3     test     4/28/2010 1:59:33.000000 PMCan anyone tell me what's wrong with this.Nothing is wrong.
    You're getting the correct output, in the correct order. Why do you think anything is wrong?

  • How do I automatically create a new file at the beginning of a new day, otherwise I only want to append that days file?

    In my robotics application I store my data using "Write to Spreadsheet.vi". I would like to append the file each time I run the program on any given day. On a NEW day I would automatically like to create a new file with a smiliar name and append that file for the day on which it is created. It's easy to do using the "Write to Measurement File. vi" but the text file created is vertical rather than horizontal, so I would like to use "Write to Spreadsheet". Any suggestions?
    Also how to I include my VI as part of this question for others to see?
    Thank you.
    Attachments:
    Untitled 4 (SubVI).vi ‏7 KB

    Does the file you are writing have a timestamp in it?  If so you could read the timestamp from the last time it was written and see if the day has changed, handling the name of the file appropriately.  The easiest way to record the timestamp is probably to write the timestamp as the number of seconds that have elapsed since 12:00 am on Firday January 1st 1904 in UT.  The "Get Date/Time in Seconds" function will give you this value.
    Message Edited by jmcbee on 03-05-2009 12:56 PM
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

  • When I do a voice over in PP CC, it starts recording from the beginning of my timeline every time.

    Why doesn't it start at the point where my "playhead" thingy is? 
    How do I fix this?  It's incredibly annoying...

    http://forums.adobe.com/community/premiere?view=discussions
    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index http://forums.adobe.com/index.jspa
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says ALL FORUMS) to open the drop down list and scroll

  • How to handle the failed records from the table when using DB Adapter

    Hi,
    I am reading some records from table using DB Adapter inside my synchronous BPEL process. Say like reading 100 records from table in between after successful reading of 90 records an error occured in 91st record due some various reasons(like DB down, Connection interrupted etc.). Then how to handle this situation, whether i have to read all the records from the begining and is there any option to continue from where it stopped reading.
    Can please anybody help me out in the regard?
    Thanks in advance
    Regards,
    Aejaz

    we had the same requirement some time ago and had two option:
    1. ask the R/3 development team add a deletion indicator in the table (and thus not actually deleting the record). this deletion indicator could then be used like for any other standard datasource
    this option was however refused, due to huge data volume after a while
    2. at the end of the load we copied the ZTABLE1 to ZTABLE2. then in the begin of the load (day after) we compare the data of table1 to table2. entries available in table2 but not in table1 are deleted, and we put a 'D'. in deletion indicator; as we only keep the deleted entries for one day, the volume of the new table is acceptable.
    M.

  • How can I "clear" my old IPad? I'll sell it and must restart it from the begining as new, create new Apple ID,etc?

    How can I "clear" my old IPad ? I'll sell it and must restart it from the begining as a new one. To leve it as when I had purchased it.

    Settings>General>Reset>Erase All Content and Settings

  • Make an alert box at the beginning of every month

    I'm writing a budgeting tool and at midnight at the beginning of every month I want to pop up an alert saying it is the start of a new month and enable a button in jsp.
    I have tried a couple ways to do this. First I wanted to keep creating a calendar and check if the date was 1. But then this would be much more work than is needed.
    Next I tried to use the TimerTask class and set a boolean to true at the first of every month, but then I couldn't figure out how to make the javascript run when the run method of that thread executes. I tried using a while loop in the jsp page itself to check the boolean but this just caused the page to hang.
    A third idea I was trying is to have an invisble form with a hidden field using this boolean. I was trying to figure out a way to use onChange to trigger the javascript, but this would only work for some sort of visible input.
    Anyone have any exprience on scheduling a task like this at the beginning of every month or about how to force a page to reload at a specific time? Thanks.

    You could even put that in a frame with a form to navigate a seperate frame:
    //frameset
    <html>
    <frameset frameborder="0" framespacing="0" rows="26px,*">
    <frame scrolling="no" frameborder="0" marginheight="0"
        marginwidth="0" name="frameA" noresize src="testingB.jsp" />
    <frame scrolling="no" frameborder="0" marginheight="0"
        marginwidth="0" name="frameB" noresize src="http://www.google.com" />
    </frameset>
    </html>
    //then your time-important page (called testingB above)
    <html>
    <body>
        <script type="text/javascript">
            function navigate() {
              var navigateTo = document.forms[0].address.value;
              if (navigateTo.toLowerCase().indexOf("http://" == -1)) {
                  navigateTo = "http://"+navigateTo;
              parent.frameB.location.href = navigateTo;
              return false;
            function doAlert() {
                alert("Time to do Something");
                window.location.reload(); //so it will happen again next month.
    <%
        //When first created, the calendar points to now.
        Calendar cal = Calendar.getInstance();
        long curTime = cal.getTimeInMillis();
        //then, lets set it to the 1st day of the month, at 00:00:01.00 (1 second after midnight
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 1);
        cal.set(Calendar.MILLISECOND, 0);
        //finally, add a month to get the first second of next month
        cal.add(Calendar.Month, 1);
        long triggerTime = cal.getTimeInMillis();
    %>
            //set the doAlert to occur after the # of milliseconds between now and
    next month.
            setTimeout("doAlert()", <%= (triggerTime - curTime) %>);
        </script>
        //form will read address you type in input, and navigate the other frame there.
        <form onSubmit="navigate();" name="nav">
          <input type="text" name="address" size="100" style="margin:3px" />
          <input type="submit" name="Go" value="Go" style="margin:3px" />
        </form>
    </body>
    </html>

  • ATV3 plays wrong song and has gap at the beginning

    Hi there,
    just got my ATV3 exchanged, because the old new one has got this media-library-connection-error, however with the new one I am experiencing a strange behaviour via WLAN and via Ethernet.
    Whenever I stream music and skip songs manually playback will start immediately from the beginning of each song.
    Playing playlists or entire albums causes a freeze at the beginning of a new song and playback starts between 3 or 6 seconds later, from this length of gap on in the song, so not starting at the beginning. Often it plays a different track than the one displayed (most of the time the next in sequence).
    Anybody else experiencing this?
    Thanks for your help,
    Andreas

    Solved it by turning homesharing off an on again!

  • Style a pic as the beginning of a chapter? Epub

    Hello,
    I am using Pages to export to Epub.  I understand how to style text to be the beginning of a new chapter, but I have not found a way to "style"  a picture as the beginning of a new chapter.  Any advice?
    I have access to both pages 4 and pages 5 if either can do the trick.

    Hi narin1975,
    Welcome to Apple Support Communities.
    It sounds like you want to add a page in your iBooks Author project. Take a look at the iBooks Author Help webpage below, it will walk you through adding or deleting pages, chapters and sections.
    Add, reorder, or delete chapters, sections, and pages
    http://help.apple.com/ibooksauthor/mac/#blsa47d9392
    Add a new page
    In the Book pane (shown above), select the chapter or section you want to add pages to.
    Click Add Pages in the toolbar, and choose Pages > Option.
    Tip:  You can also add a new page by Control-clicking a page in the Book pane and choosing Insert Page from the shortcut menu. The new page uses the default layout for the chapter or section.
    I hope this helps.
    -Jason

  • Recording a show after it starts.. you only get a recording from that spot...not the beginning

     (as it says on page 19 of User Guide)
    I fear I have made a major mistake switching from Direct TV... this feature worked flawlessly on their DVR (to which I had a 1TB external drive attached) .     I may eat the $400 termination fee and go back..  I think a week on FIOS is about all I can stan.

    Your 100% correct, Direct TV can only record the entire live program if you were already tuned to it, not if you just change to it. I never said that Direct TV could do that and Direct TV never says or implies that either.  Verizon on the other hand explains it this way...verbatim from page 19 of the Verizon FiOS user guide:
    "HERES HOW TO RECORD LIVE TV
    To record a show that's currently playing:
    o Press the REC button on the remote
    Got to the show late? No Problem: If you start recording after the show has started, the DVR will actually record the show from the beginning. So you'll have it all.
    To schedule recording of an upcoming program........"
    The limitation with Direct TV is obviously because it automatically is buffering channel feed, usually as long as the last couple of hours.... you can even go back and record the previous show if its in that window.  By a sat feed.
    Verizon has a fat fiber-optic cable pipe plugged into my house carrying internet, phone and tv with room to spare. Sadly,  I am not the genius you obviously are, Mr. Faraday,  so I'm not certain that Verizon doesn't do something like buffer this stuff on their end and then push it down the pipe to me if I want to see it from the beginning.   Would be an easy qualification in the manual don't ya think? You know ".....Got to the show late? No Problem, as long as you are have been tuned that channel....... "        
    Oh wait... this is the same company who matter-of-factly told me caller id would work on my tv, all I had to do was enable it.    Kewl.. I enabled it.   Nuthin.  Called support. Told me it takes 24-48 hours to kick-in.  No prob.  I can wait. Couple days later.. still nothing, called support back.  This time got someone who knew something and they informed me that you need Verizon's Call Assistant and Visual Mailbox for on-screen caller id to work.  Evidently only Verizon, well at least some in Verizon, know  this little tidbit.  (as I'm certain you do as well, von Goethe) Dummy Me, I didn't know that.  Gosh.. maybe a couple lines in a manual or on screen....you know for us nitwits.... would that kill them?  
    So you are correct, Mr. Wittgenstein, I am a **bleep**. I'm a Verizon customer aren't I?

  • SQL: Finding the LIKE value on the Begining of a Field in a Record

    I am looking for find the results using php and MySQL of the
    1st 3 characters of a field in a recordset, for instanace the first
    three numbers of a zip code. I know that using the like statement
    and a % in the front will get me all records that have those
    numbers in there (i.e. 074 >>> 07410, 07420, and 10742)
    but what I want is only those that START with 074.
    Thanks

    Sorry I figured it out I had the % in the beginning and it
    should have been at the end.

  • While recording in captivate 4 I get a pop at the beginning of each recording

    While recording narration over a PP conversion in captivate 4 I get a pop at the beginning of each recording,  It doesn't seem to matter if I use keyboard shortcut or the mouse. Any thoughts?
    Paul

    Welcome to our community
    Is the unwanted bit part of the countdown?
    If so, there are a couple of ways to avoid it.
    1. Don't record your narration at the same time you record the actions. Record it separately. No narration means no countdown.
    2. After the countdown stops, consider that first slide to be a throwaway and ensure you don't begin recording in earnest until after you hear the first camera shutter sound.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • I'm trying to record only part of my screen using my Quicktime 10.0, but once I press record in the "Screen recording" feature it automatically starts recording and doesn't give me the option to choose what part of the screen to capture. What gives?

    I'm trying to record only part of my screen using my Quicktime 10.0, but once I press record in the "Screen recording" feature it automatically starts recording and doesn't give me the option to choose what part of the screen to capture. What gives?

    QuickTime version 10 can only record the entire screen.
    10.1, 10.2 and 10.3 offer part of the screen recording.

  • How do I automatically capitalize the beginning of each sentence in Pages?

    Hello there!
    Please help...
    How do I automatically capitalize the beginning of each sentence in Pages version 5.2?
    The old version of Pages (Pages '09) automatically capitalizes the first word of each sentence. But in Pages 5.2, I have to manually capitalize the first word of every sentence. How can I make this automatic?
    The options in Menu > Format > Font > Capitalization, do not show an option for sentence capitalization. Please help. Thank you!

    Feature removed from Pages 5 along with over 100 others,
    Pages '09 should still be in your Applications/iWork folder.
    Pages 5 is a disastrous beta pushed onto users, and misrepresented by Apple as an "Upgrade".
    Peter

  • Edited Recording jumps back to the beginning after crop

    I have several recorded Connect meetings that have been lightly edited. The first few seconds have been removed and, on some, a few seconds in the middle have been cropped out when the speaker flubbed a word or two. I am finding that, on the ones with mid-recording crops, the playback jumps back to the begining for a few seconds and them catches up and contimues normally. Is this just a limitation of the Connect editing mechanism (as limited as it is)?
    I have tried to leave the beginning alone and just crop out the middle and it still hiccups when it hits that section. Any thoughts on this?
    Thanks!
    My Connect version info:
    7.0,723
    Connect 7.0 r. 723/c. 427912/b. Fri Jun 27 15:37:57 2008
      Presenter r. Presenter7GM
      FMS r. Mustang_Connect 3_0_0_1208
      Licensed

    Hello,
    You can set a timeout to handle what happens when no one
    interacts with the computer for a certain period of time. In your
    startMovie script, add
    on startMovie
    the timeOutLength = 60*60 --Add a length here. It is in 60ths
    of a second, so 1 minute is 60*60
    end
    Then, in a movie script, add
    on timeOut
    --Put your script here
    go to frame 1
    end
    That should be it. I realize you don't speak English well,
    but this should put you in the right direction if you don't
    understand it all.

Maybe you are looking for

  • How do you open a link within a PDF in a new window?

    I created a PDF that will be viewed in a browser. Is there a way to set the links within the PDF to open in a new window?

  • Obiee 11g Publisher Bursting Report error

    Hi I am using Obiee 11g (ver. 11.1.1.3.0) and trying to achieve report bursting. I have created Data model and Report. Report is showing result but once I schedule report by bursting to file, 1. I am getting error (ORA-00923: FROM keyword not found w

  • Select statement: LIKE IN?

    I have this SQL statement that I want to select as follows: select * from customer where cust_desc like in (select partnumber from orders ) I hit an error doing this. How should I requery my sql statement? Please note: I retrieve 10 records when I di

  • Business Catalyst Admin - no longer have access to domain or site.

    Hello, we were using business catalyst with a domain that we have since given up and no longer have any access too. We are seeing the weekly status reports come in but can't find any way to stop them due to no longer having access to the associated d

  • Acrobat-Reader's Crash Msg..:(

    When I open pdf file, Reader is crash. And show bottom message.. AppName: acrord32.exe AppVer: 9.1.0.163 ModName: ntdll.dll ModVer: 5.1.2600.5755 Offset: 0000fe60