Last Hour Records in Select Expert

I am using Crystal Reports version 10 and want create a formula which will select records created in the last hour.
Is this possible?
Within the select expert, you have existing formulas/date ranges such as LastFullWeek/LastFullMonth/Last7Days but I need a formula which will select LastFullHour.
The field I am using is {Interaction.Time_Created} which contains records in the HH:MM format.
Thanks in advance

This will give you the last 60 minutes from the second the report was run:
{table.datetimefield} in dateadd("h",-1,currentdatetime) to currentdatetime
And if you wanted the last completed hour, then use this:
in dateadd("h",-1,dateadd("n",-minute(currentdatetime),dateadd("s",-second(currentdatetime),currentdatetime))) to_
dateadd("n",-minute(currentdatetime),dateadd("s",-second(currentdatetime),currentdatetime))
The underscore is there by design

Similar Messages

  • Select Expert Record. Last 6 months and week start date on Monday

    Hello,
    i am trying to use the select expert record to grab the last 6 months worth of data. I require the week start day to be a monday and end on a sunday.
    Can someone please provide some advice the best way to do this
    kind regards
    david

    Hello Abhilash,
    Once again thanks for your reply.
    Yes this is correct, when it goes back 6 months i need it to skip the days prior and begin on a monday as we are reporting on a mon-sunday basis.
    I have tried your formula Date field >= dateadd('m',-6,currentdate) and it seems to grab 6 months of data, but the group weeks are not grouping from Monday to Sunday...
    kind regards
    david
    Edited by: davitali on Dec 2, 2011 9:35 AM

  • Help in selecting last n records

    Hi All
    I have the following tables in my database
    CREATE TABLE MACHINE_M (
    ID     VARCHAR(20)     NOT NULL,
    NAME     VARCHAR(20)
    CREATE TABLE STG_READING (
    ID     VARCHAR(20)     NOT NULL,
    MACHINE_ID     VARCHAR(20),
    DATE_ID     NUMBER,
    TIME_ID NUMBER,
    READING NUMBER
    CREATE TABLE READING_DWR (
    ID     VARCHAR(20)     NOT NULL,
    MACHINE_ID     VARCHAR(20),
    DATE_ID     NUMBER,
    TIME_ID NUMBER,
    READING NUMBER
    CREATE TABLE DATE_DIMENSION (
    DATE_ID     NUMBER     NOT NULL,
    DATE_VALUE     DATE     NOT NULL,
    DAY     VARCHAR(10),
    DAY_OF_WEEK     INTEGER,
    DAY_OF_MONTH     INTEGER,
    DAY_OF_YEAR     INTEGER,
    PREVIOUS_DAY     DATE,
    NEXT_DAY     DATE,
    WEEK_OF_YEAR     INTEGER,
    MONTH     VARCHAR(10),
    MONTH_OF_YEAR     INTEGER,
    QUARTER_OF_YEAR     INTEGER,
    YEAR     INTEGER
    CREATE TABLE TIME_DIMENSION (
    TIME_ID     NUMBER     NOT NULL,
    HOUR     VARCHAR(3),
    MINUTE     VARCHAR(3),
    SECOND     VARCHAR(3),
    INTERVAL     NUMBER
    Referential Constrains:-
         STG_READING(DATE_ID)>>>>>DATE_DIMENSION(DATE_ID)
         STG_READING(TIME_ID)>>>>>TIME_DIMENSION(TIME_ID)
         MACHINE_M(ID)>>>>>STG_READING(MACHINE_ID)
         READING(DATE_ID)>>>>>DATE_DIMENSION(DATE_ID)
         READING(TIME_ID)>>>>>TIME_DIMENSION(TIME_ID)
         MACHINE_M(ID)>>>>>READING(MACHINE_ID)
    i will be getting the reading from the machine every 1min which i will be inserting into STG_READING table. the READING column must always be progressive.
    so i have to validate the reading column from the staging with the last n records in the READING_DWR table.
    selecting the last n records for a particular machine from READING_DWR table every time is causing performance bottleneck.
    Can some one suggest me a way to improve the performance

    Please consider the following when you post a question. This would help us help you better
    1. New features keep coming in every oracle version so please provide Your Oracle DB Version to get the best possible answer.
    You can use the following query and do a copy past of the output.
    select * from v$version 2. This forum has a very good Search Feature. Please use that before posting your question. Because for most of the questions
    that are asked the answer is already there.
    3. We dont know your DB structure or How your Data is. So you need to let us know. The best way would be to give some sample data like this.
    I have the following table called sales
    with sales
    as
          select 1 sales_id, 1 prod_id, 1001 inv_num, 120 qty from dual
          union all
          select 2 sales_id, 1 prod_id, 1002 inv_num, 25 qty from dual
    select *
      from sales 4. Rather than telling what you want in words its more easier when you give your expected output.
    For example in the above sales table, I want to know the total quantity and number of invoice for each product.
    The output should look like this
    Prod_id   sum_qty   count_inv
    1         145       2 5. When ever you get an error message post the entire error message. With the Error Number, The message and the Line number.
    6. Next thing is a very important thing to remember. Please post only well formatted code. Unformatted code is very hard to read.
    Your code format gets lost when you post it in the Oracle Forum. So in order to preserve it you need to
    use the {noformat}{noformat} tags.
    The usage of the tag is like this.
    <place your code here>\
    7. If you are posting a *Performance Related Question*. Please read
       {thread:id=501834} and {thread:id=863295}.
       Following those guide will be very helpful.
    8. Please keep in mind that this is a public forum. Here No question is URGENT.
       So use of words like *URGENT* or *ASAP* (As Soon As Possible) are considered to be rude.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Select the last saved records in a table

    I all
    I have this struct in a table
    create table INT_OBJ
    IDOBJ NUMBER(15) not null,
    IDERP NUMBER(15),
    IDE NUMBER(15),
    CPO VARCHAR2(20),
    VLR VARCHAR2(2500),
    VLRC VARCHAR2(2500)
    How to Select the last saved records in a table. I think usea a temp table for put the last row read and begin to read in the next row.
    The table is reading each four hours.

    Theoretically it can be done with ORA_ROWSCN and enabled ROWDEPENDENCIES, but there are so many nuances, so only adding column for ordering is right.
    Regards,
    Sayan Malakshinov

  • Crystal 2008 problem with Record Select Expert

    I had a Crystal 10 report that worked fine where the Record Select Expert had a database table ID equal to a parameter... it was only supposed to report on 1 record.  After using Crystal 2008 on the same report it completely ignores this Select Record Expert setting.  I have tried deleting and re-adding the parameter.  It acts like there is no record select setting.
    Here is the formula that it shows me it is using:    {Components.ID} = {?@ID}
    If I go to the application opening the same record on a different machine using the old crystal, it works fine.
    This used to only show me the 1 record, now it shows me the report on every record in the table.  I tried upgrading the report to a 2008 report and it still does the same thing.  The report filter no longer works.   Do I need to do something different to select only 1 record in 2008 ?
    After installing Crystal 2008 on my computer none of my reports work correctly anymore - all of them are ignoring my Record Select ...they worked fine before I installed 2008.  The reports are older reports... they worked fine when I had Crystal XI R2 installed.  This all started after installing Crystal 2008
    Thanks,
    Jeff
    Edited by: Jeff Dressing on Aug 27, 2008 12:06 PM

    Hello, Jeff;
    I noticed the Record Selection Formula uses a Stored Procedure parameter:
    {Components.ID} = {?@ID}
    A parameter created in the report (not by a stored procedure) would be:
    {Components.ID} = {?ID}
    A report based on a Stored Procedure does not need a Selection formula for the Stored Procedure parameter. Connecting to the Stored Procedure automatically creates the parameter in the report and the value is passed automatically when the report is run.
    Does the report work in the Crystal Reports 2008 designer?
    Open the report in the designer. Go to Database Set Datasource location. Are the properties of the database at runtime still the same as what is saved in the report.
    If the database is different at runtime, just as a test, change to the new database in a copy of your original report. Do a Database|Verify Database. Does it come back the "Database is uptodate" or are there changes?
    Elaine

  • Select Expert - Record

    I'm trying to limit the values presented in the Select Expert - Record tab based upon it's relationship to a selected value from another field.
    We have several hospitals.  Each hospital has several floors or unit/wards usually identified as 6 East, 2 West, 4 North, etc.  Not all of the hospitals have the same named unit/wards.
    I select use select expert - table_name.Facility_Name = "Hospital A" when I select table_name.Unit_Name I only want those units/wards from the "Hospital_A" to be displayed in the list and not all of the units/wards that are listed in the table.  This way I do not have to wade through all of the unit/wards that a facility does not have.  The report is for unit/ward.
    Thanks
    Michael

    Hi Michael,
    If you are using Crystal XI or newer version then try creating a cascading prompt to get filtered with parent level field value.
    For more information check the sample report prompting.rpt that shows the cascading prompt of Country>Region>city
    Regards,
    Raghavendra

  • Crystal Rpt XI - Select Expert record limits

    Newbie here - please be gentle
    There appears to be @ a 500 record limit that can be used in the formula editor. Is there a way to work around this limit or is it greater in later versions?
    Example;
    {Mrpa99.Pat_Ext_ID} in ["0001400126", "0001401652", "0001402718", "0001402742",......... , "0001665341"]
    would return 'TOO MANY RECORDS' if I had all my desired record sets (@ 700), but if I removed half it would work fine.
    If there is no way to get all values in a single report is there a way to merge the results into a single report.
    Thanks in advance,
    Cj

    First try to push down this filter to DB level if possible, this will improve your report performance.
    Try creating 2 or more formulas that contain those long string separately.
    and write below codes in your select expert: {Mrpa99.Pat_Ext_ID} in formula1 or in formula2 or in ...formulaN.
    Thx, Hao

  • Select last 50 records closed

    Looking for a simple sql select statement that will select the last 50 records closed in the database.
    I found a few helps out there that have an example like:
    SELECT RecordID, closed_date
    FROM ( SELECT RecordID, closed_date, RANK() OVER (ORDER BY closed_Date DESC) date_rank
    FROM table1 )
    WHERE date_rank <= 50;
    Only problem is, this is selecting something like 4000 records and many of them are not even closed.

    I believe you should retrieve the records that are only closed first.
    Try this,
    SELECT RecordID, closed_date
      FROM (SELECT RecordID,
                   closed_date,
                   ROW_NUMBER () OVER (ORDER BY closed_Date DESC) rn
              FROM table1
             WHERE closed_date < SYSDATE)  --Notice this.
    WHERE rn <= 50;G.

  • New Formulas don't show under Select Expert --Record

    Hello,
           Some how my CR 2008 don't show new formulas in my report when I go in Select Expert-Record, all the formulas show under Field Explorer?? the odd part is that old formulas still showing only new ones don't show is a setup that I'm missing????

    The old formulas most likely have the evaluation time function WhileReadingRecords or BeforeReadingRecords referenced in them.
    Try adding WhileReadingRecords to your new formulas (If CR can process those formulas at that time) and you should be able to see them in the Record Select Expert.

  • Select last 50 records

    I have 230 records in a table.
    How to select last 50 records?

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Asad:
    I have 230 records in a table.
    How to select last 50 records?<HR></BLOCKQUOTE>
    Logic : The last 50 records are those records who have less than or equal to 50 records below them.
    Select T1.sortcolumn, ...
    From TABLE T1
    Where 50 >= ( Select Count('x')
    From TABLE T2
    Where T1.sortcolumn >
    T2.sortcolumn
    null

  • Select last ten records

    How can I retrieve the last 10 records in a table

    to get last 10 records
    Sim
    Message was edited by:
    sgalaxy

  • How can I get the last / newest record of a table?

    Hi,
    I am developing an ecard app that has a create greeting page, a preview page with edit and send buttons and an edit page.
    I got he insert working, and on the preview page I created a master record page (displays all records), and delete all unecessary designs. Doing it this way also gives me the 'edit' button, so people are able to edit their page.
    How do I get only the last record displayed though? At the moment it loops through all records and displays them in sets of 10. I found the variable that holds the totla count of records ('$totalRows_rs7417_content1'), but how do I (re-)write the script so it ONLY diplays the last record?
    I need to get the ID of this record as I am writing this into the PARAMs of the object and embed tags of my message .swf (this picks up the ID and based on that sucks the greetings text out of the database via another php script.
    Also, from this page, how can I send an email to the sender (ie creator of the message) as well as the recipient? Both email addresses are in the databse so should be part of the erecord returned.
    Thanks,
    Nik

    -----
    OK, So how do I recreate what I got in a non-ADDT list?
    well, when you´re just about to display one certain record, the term "list" is somewhat inappropriate anyway.
    What you´d simply need to do IMHO, is using DW´s native functions to create the basic "SELECT * FROM table_name ORDEr BY ID DESC" query, add "LIMIT 1" manually, and display the desired "dynamic text" placeholders in 1 table cell -- don´t think there were any need for all the fancy stuff
    (sorting, filtering etc) provided by ADDT´s list, as it´s just 1 record.
    It also occurred to me just now that finding the last record that has been added *may-* notbe enough if the site gets used a lot by our executives (I am thinking of a situation where 2 or three peolpe create greetings at the same time and press submit and then getting each others messges rather than their own).
    in this case you might want to additionally store the respective executive´s "kt_login_id" session variable -- because it´s this unique "identifier" which should be used to show the last inserted record of the person who actually inserted it, means adding a "WHERE submitter_id" equals the session variable kt_login_id - clause to the query.
    When creating a non-ADDT list that´s at some point based on detecting a user session, you´ll BTW need to insert at line 1
    I can't seemt o insert it on the page as it is looking for a insert, update or delete bahaviour on the page which of course I don't have
    please search these forums for several posts I made which explain my "use dummy table" approach that´s made for cases when you actually don´t have anything to insert/update/delete, but need "something" for ADDT´s send email behaviours.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Conditional Select Expert

    Hi,
       I am trying to write a formula in the select expert based on a condition. For certain departments, I want to include specific employee hours, but, for other departments, I want to exclude them.
    Department is based on a number: 010 or 020 etc...
    Employee Job: 0020, 1020, 0430, etc...
    Here is what I am trying to accomplish:
       Ex: If (Department = 010) then DO NOT count employee job 0020   Else count employee job 0020
    Department and employee job are two separate fields in the database.

    I tried the above code and wasn't able to get it to work properly. It only worked when the department was 010. For the other departments, I got no records. I used the formula below, and it works great.
    (if({VP_TIMESHEETITEM.LABORLEVELNAME2} = '010') then {VP_TIMESHEETITEM.LABORLEVELNAME3} <> '0020'
    else {VP_TIMESHEETITEM.LABORLEVELNAME3} <> '' )

  • Simple Query Question - How do I return the Last 3 records of a Table?

    Question.
    For example, I have a table that has 50 records.
    How do I, specify in SQL to only return the last 3 records of the table.
    Select a.* from table a where ????

    I was just trying to show an example to a friend on
    how something like this would work and if it was even possible. But it won't work. Here's a simple example:
    SQL> create table emp
      2  (id)
      3  as
      4  select object_id
      5  from   all_objects
      6  order  by object_id;
    Table created.
    SQL> select *
      2  from  (select rownum rn
      3               ,b.*
      4         from   emp b)
      5  where  rn > ( select (max(rownum) - 3)
      6                from    emp)
      7  ;
            RN         ID
         40830      55891
         40831      55892
         40832      55893So far, so good. These are the "last 3" rows inserted. Now delete a bunch of rows and insert 3 new ones:
    SQL> delete emp where id < 40000;
    33423 rows deleted.
    SQL> commit;
    Commit complete.
    SQL> insert into emp values (60000);
    1 row created.
    SQL> insert into emp values (60001);
    1 row created.
    SQL> insert into emp values (60002);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select *
      2  from  (select rownum rn
      3               ,b.*
      4         from   emp b)
      5  where  rn > ( select (max(rownum) - 3)
      6                from    emp)
      7  ;
            RN         ID
          7410      55891
          7411      55892
          7412      55893Here's the problem. Even though the "last 3 rows" are 60000 - 60002, I still get the same ones as the first query.

  • Crystal Report - Title from Select Expert.

    Hi Experts !
    I need some help here. Recently I have build a new crystal on the production analysis. Part of the select expert for record is between posting date A and posting date B.
    Below is the code I uesd for the select expert whereby Posting Date 1 is a parameter with range that I have defined.
    {ODLN.DocDate} = {?Posting Date1}
    I am interested to have this 2 date from the parameter to appear on my report. For example :
    Date: A date till B date.
    I have tried picking up this data from the parameter, but failed to get what I want. Anyone have syntax for this ??
    Best Regards,
    Alex

    Hi Gordon,
    Yeah, I know the syntax to do this. The real problem lies as I have stated on my first post - I want the date that I have entered on the parameter during the filtering process, to appear on the report itself. I have tried it before, but all that appears is only True value, not date.
    So If, I am about to use two parameter date instead of parameter range with selection expert, will I be able to pull the two parameter date into the report, so that I can print it out with the date on the report itself. It's important for the report to have date because not everyone knows the report is from when to when.
    Best Regards,
    Alex

Maybe you are looking for

  • How to delete a Sparsebundle. A Faster Way.

    After many trials and errors, I might have found a way to erase a Sparsebundle faster without having to wipe your entire Time Capsule, or using 3rd party programs. My Setup: I am using the latest update of OS X Lion up to date. I have a 3 TB Time Cap

  • How to set the filename when downloading a file?

    I'm working on mvc4. I have generated excel file dynamically using following simple code my hosting is on Azure I have created a Root path and then try to save that excel file. Problem is when my Action Result method response comes back it is giving

  • Purchase order form display the BOM of the item material

    Dear :   When i print or preview the purchase order in ME23n,I want to display all of the  components of  material which every item used.(sap standard output type is NEU,form is MEDRUCK)   The components can be displayed when we click the button of "

  • ATV Airplay (audio only) starts then stops

    Pretty much what the subject says. I'll start audio playback from iTunes 11.0.4 to 3rd-gen ATV that is running latest OS 5.2.1. Music plays for 1-2 seconds then stops. Sometimes I can start it again, but it will stop. Usually I can't start it again.

  • Should I go for HH4?

    My Infinity contract is due for renewal in a couple of months time. Should I ask for an HH4 when I renew? My HH3 has worked very well for me. Is anything likely to be worse with the HH4? I've seen one user say he has problems with 2.4ghz wireless - b