Helps the model clause. Date field in the Dimension

Hello, all.

I'm having a problem with the clause type in my query. In my view, it may be a misunderstanding on my part, but I can't find any documentation that is opposed to the use of the date fields in the dimensions of my model.

Given these data;
LOGDATE               SHIFTNAME  BUILDING  UNIT  DOORNUMBER  INOUT    EVENTCOUNT
2012-02-01 06:00:00      A        1800      R      Door 4     Out         14
2012-02-01 06:00:00      A        1800      R      Door 4     In          15
2012-02-01 18:00:00      D        1800      R      Door 4     Out         17
2012-02-01 18:00:00      D        1800      R      Door 4     In          19
2012-02-02 06:00:00      A        1800      R      Door 4     Out         14
2012-02-02 06:00:00      A        1800      R      Door 4     In          14
...
I write my SQL like this:
SELECT logdate, shiftname, building, unit, doornumber, inout, eventcount
  FROM door_events
 WHERE building='1800' AND unit='R' AND doornumber=4
 MODEL DIMENSION BY (logdate, shiftname, building, unit, doornumber, inout)
       MEASURES (eventcount)
      RULES ()
And I get the expected result. (The same table as above) But when I try to add rows using rules, I get no new line until the LOGDATE field is a date. For example, by using this code, I expect to get a new line, with a 100 EVENTCOUNT (and other fields as written) but I stiill get the same set of data (no line is added)
SELECT logdate, shiftname, building, unit, doornumber, inout, eventcount
  FROM door_events
 WHERE building='1800' AND unit='R' AND doornumber=4
 MODEL DIMENSION BY (logdate, shiftname, building, unit, doornumber, inout)
       MEASURES (eventcount)
       RULES (eventcount[SYSDATE,'X','1800','R',4,'In'=100)
However, when I turn the LOGDATE field in a CHAR data type (and make the SYSDATE a TANK in the same way) with the code below, all of a sudden I get the line I was expecting!
SELECT TO_CHAR(logdate,'YYYY-MM-DD HH24:MI:SS') logdate, shiftname, building, unit, doornumber, inout, eventcount
  FROM door_events
 WHERE building='1800' AND unit='R' AND doornumber=4
 MODEL DIMENSION BY (logdate, shiftname, building, unit, doornumber, inout)
       MEASURES (eventcount)
       RULES (eventcount[TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS'),'X','1800','R',4,'In'=100)


LOGDATE               SHIFTNAME  BUILDING  UNIT  DOORNUMBER  INOUT    EVENTCOUNT
2012-02-01 06:00:00      A        1800      R      Door 4     Out         14
2012-02-01 06:00:00      A        1800      R      Door 4     In          15
2012-02-01 18:00:00      D        1800      R      Door 4     Out         17
2012-02-01 18:00:00      D        1800      R      Door 4     In          19
2012-02-02 06:00:00      A        1800      R      Door 4     Out         14
2012-02-02 06:00:00      A        1800      R      Door 4     In          14
...
2012-02-07 15:18:33      X        1800      R      Door 4     In          100
Can someone explain this behavior? I intend to do some calculations on the LOGDATE dimension and I would like to keep it as a date. Thanks in advance for any help!

I do not get the same result. When I use SYSDATE, I don't get the extra line. When I use TO_CHAR (SYDATE...) as you say, I still don't get the extra line.

However, when I use a constant date, such as TO_DATE (' 2012/02/07 02:00 ',' YYYY-MM-DD HH24:MI:SS'), then I get the extra line.

This behavior is described in http://docs.oracle.com/cd/E11882_01/server.112/e25554/sqlmodel.htm#BEIGGGFJ

«Using UPSERT creates a new cell corresponding to that referenced on the left-hand side of the rule when the cell is absent, and the cell reference contains only positional references * qualified constants *.»

Best regards, stew Ashton

P.S. "Oracle Database 11g Enterprise Edition Release 11.2.0.2.0.

Published by: stew Ashton on 7 February 2012 23:03

Tags: Database

Similar Questions

  • help the dimensions

    I am trying to create a portfolio site. What is the size (width and height) should I choose to have a sensitive website with slideshow image full screen?

    Hi Angelica,.

    Please refer to my reply on this thread, the sensitive design parameters, it seems to be a similar question that you put in on the forums as a thread different. You can use this other thread for any question you may have follow-up.

    - Abhishek Maurya

  • Help with a script for the date field

    Is this possible when the display of a date field is not also: date {EEEE, MMMM D, YYYY}

    then

    Message: "Please select a date from the calendar to the date.

    and focus on the date field

    Thank you

    I thought the event output, if you change the this.rawValue to xfa.event.change, you can try to use the calculate... event, which would mean that they get the message earlier.

    Anyway they will always be able to cut-and - paste a date if it is in the correct format.

    Bruce

  • How can I automatically populate the date field after only one "digitally signs" a .pdf form? Help, please! Thank you!

    How can I automatically populate the date field after only one "digitally signs" a .pdf form? Here's a sample:

    _ Digital Signature___ (signs), Date (Auto-remplit)

    Under field properties of the signature on the signature tab, you can use a custom script, like this:

    this.getField("Date").value = util.printd ("mm/dd/yyyy", new Date());

    You know, however, that a digital signature always displays the date and time, it has been applied?

  • The Date fields limited to allow only the past or future Dates?

    Hello

    I use LiveCycle ES3.  My request is simple.  I have several date throughout my form fields.  Some date fields must enable the last dates; Some date fields must enable as dates in the future.  When an invalid date is entered, the date should be dismissed, the rest of the required field and an error message pops up, saying: "this date cannot be in the future" or "this date cannot be in the past", depending on the field in which it is.

    As a note, I used the exact script of the demo file "Highlighting the required fields", but I discovered that this script is too complicated and even worse still it is incorrect.

    Any help would be greatly appreciated.

    Thank you.

    Hello

    could you please send a link to "highlight fields"?

    This code is what you ask for:

    var d = this.rawValue;

    dArr var = d.split("-");

    D1 var = new Date (dArr [0], dArr [1-1, dArr [2]]);

    var dNow = new Date();

    var diff1 = Math.floor ((dNow.getTime () - d1.getTime (()) / 86400000);

    If (diff1 > 0) {}

    xfa.host.messageBox ("past" + diff1);

    }

    diff2 var = Math.ceil ((d1.getTime () - dNow.getTime (()) / 86400000);

    If (diff2 > 0) {}

    xfa.host.messageBox ("future" + diff2);

    }

    Put it in the Validate event.

    Also define the Model of Validation... to this day {J MMMM AAAA}

    in both screen | Change | Validation tab

    That's how I tested it, but you should be able to choose what Validation model you like.

    It will be useful.

  • Move focus horizontally in the date field

    Hello world

    Date field the focus moves by the movement of the trackball vertical by default. I'm doing it in horizontal also using STATUS_MOVE_FOCUS_HORIZONTALLY during initialization datefield. It does not work.

    I tried to datefield navigationMovement substitution, which helps not or can I not move horizontally within this function.

    It works if I substitute navigationMovement of screen, but I can't find a way to move the focus in the field date when this happens.

    Any help or suggestion on this would be greatly appreciated.

    You will not be able to do. The DateField has a method getSubField, but not setSubField, it is managed internally.
    If you really need, I suggest you re - implement it with the functionality you need, should not be too difficult, however need some coach.

  • Pupulating of the date field to the top of the opening of the document

    Hello

    Have a 6 page doc.  some pages contain date, but with different field names field.  On the first page I want to check if the date is null then fill it with the current date, and then copy the date populated to other pages... If the document has been record and reopened the latter I want the first populated date to be kept because it was populated for the first time.

    First date field 'TodaysDate' is open for date fields to update on other pages are read-only.

    Date field named first page: TodaysDate.

    and the following code is executed as soon as the doc. under the tool/JavaScript/Document JavaScripts:

    function populate_date (doc)

    {

    var f = this.getField ("TodaysDate");

    If (! f.value) f.value = util.printd ("d/m/yyyy", new Date());

    }

    populate_date (this); call my function

    Problem I do not get filled at all... and it's the screenshot that I receive via Consul:

    no idea what could be the problem?

    Kind regards

    Jeff P.

    Assuming that the TodaysDate field exists, you encounter a timing problem.

    At the time, that the function is executed, the fields have not yet established. This is quite common with MultiPage forms.

    Therefore, you can define the function in a script at the level of the document, but you'll call in the event PageOpen of the page on which the document opens. You can protect it, so that it runs only once.

    On the function, I have my doubts that it works, because test you if the value of the field is. It is always the case. Instead of test if the value of the field is equal to the field's defaultValue. The function would then look like this:

    function populateDate()

    {

    If (this.getField("TodaysDate").value is {this.getField("TodaysDate").defaultValue})

    this.getField("TodaysDate").value = util.printd ("dd/mm/yyyy", new Date();)

    }

    }

    As stated, it is not even necessary to set the function, simply run the code in the event pageOpen.

    I hope this can help.

  • A date today can be added in a date field when you press the submit button?

    I created a form with a "submit" button and the form is sent by e-mail.  Then the date when the form is submitted to appear in a date with the key field is pressed?


    Any help with this is appreciated. Thank you.

    Hello

    There is a preSubmit event to form objects that you can use.

    Select your date field, open the script editor and add this script (language is FormCalc) in the preSubmit event.

    $ num2date = (date (), ' MM/DD/YYYY')

  • How to display the records from a query in the non-base data field

    Hello

    I have a problem:
    I have a query with a lot of tables and column 6 (select a, b, c, d, e, f x, y, z, t, s, g where the conditions) and I use 3 parameters.
    I create 3 settings: datai,: dataf and: partner and a button with a trigger when the button is pressed.
    Then a create a block manually with six field non-database a1, b1, c1, d1, e1, f1.
    Now, I want to display all the records in my query in a1, b1, c1, d1, e1, f1 where a1 = a, b1 = b, etc. and all the records (if I have 20 record, it will display 20 records in the non-base data field) when I press the button.

    How I did it:
    I create a cursor with the query, and then
    start the open cursor
    loop
    Fetch cursor in: a1,: b1,: c1: d1: e1,: f1;
    end loop;
    close the cursor;
    end;

    It displays a single record in a1, b1, c1 only, and it must display 100 records and date for all fields.

    Can someone help me with this problem?
    Thank you.

    Published by: 928437 on October 1, 2012 02:55

    Creating a view and the query in a database block are a great solution.

    To use the block non-base of data:
    You are missing the most important Next_Record; command.

     Begin
    Go_block('X'); -- block X is the non-database block
    Clear_Block(No_Validate);
    open cursor X1;
    loop
    If :System.Record_status != 'NEW' then
    Next_Record;
    End if;
    fetch X1 into :a1,:b1,:c1,:d1,:e1,:f1;
    Exit when X1%NOTFOUND;
    end loop;
    close X1;
    end;

  • Problems while extracting the hours of the Date field

    Hi guys,.

    We hope that you do well.

    I am facing some problems during extraction of the hours of the date field. Here is an example of my orders table:-

    Select * from orders;

    Arrival time of Order_NO product name
    1 computer Office November 20, 10 10:10
    2 November 21, 10 17:26:34 portable
    3 22 January 11 printer 08:10

    Earlier, it is stated that the daily number of orders take place in the roll of the order, I used to write a query

    arrival_time > = trunc ((sysdate-1), 'DD')
    and arrival_time < trunc ((sysdate), 'DD')

    The above query gives me yesterday how many orders have been been held.

    Now I have the new requirement to report on every 4 hours the number of orders will be held. For example if the current time is 08:00 IST then the query must extraction from 04:00 until 08:00 how many orders took place. The report will take place at 12:00 IST which will give me an order took place from 08:00 until 12:00.

    The report will be run every 4 hours per day and generate report of orders taken place for the past 4 hours. I have a programmer who will run this query every hour, but how to understand to get the order at the request of details who arrived for the past 4 hours. I'm not able to do this using trunc.

    Can you please help me how to make this happen. I checked "Extract" also, but I am not convinced.

    Help, please.

    Thanks in advance
    Aalami

    try something like

    with testdata as (
      select sysdate - level/24 t from dual
      connect by level <11
    )
    
    select
      to_char(sysdate, 'DD-MM-YYYY HH24:MI:SS') s
    , to_char(t, 'DD-MM-YYYY HH24:MI:SS') t from testdata
    where
    t >= trunc(sysdate, 'HH') - numtodsinterval(4, 'HOUR')
    
    S     T
    19-06-2012 16:08:21     19-06-2012 15:08:21
    19-06-2012 16:08:21     19-06-2012 14:08:21
    19-06-2012 16:08:21     19-06-2012 13:08:21
    19-06-2012 16:08:21     19-06-2012 12:08:21
    

    trunc (, 'HH') truncates the minutes and the seconds of the date.
    Extract the hour only works on timestamps
    concerning

    Published by: chris227 on 19.06.2012 14:13

  • How to create a date field that is fixed at the signing?

    Hello

    I created a series of PDF forms on Adobe Pro XI which are designed to be filled out using Adobe Reader (where are saved as Adobe Reader Extended). Once the form is complete there are fields of signature that the user who digitally sign then it disables the specific form fields of editing more far. Next to the signature field, I have a date field that, at present, is using JavaScript to automatically generate the date of business at the opening. However, the question that I have is that I want this field date which will be fixed when the form is signed, rather than update again when the form is opened. Is this possible?

    The document JavaScript that I use to generate the date currently is:

    this.getField("Date1").value = util.printd ("dd/mmm/yyyy", new Date());

    But obviously, this is independent of the signature field.

    How can I create a date field which is set by the current date at the signing?

    I am very new to Adobe in general so I don't have much of an idea about how to go about doing this. Could someone please help me to do it if possible?

    Thank you

    KC

    Go to the properties of the field of Signature and on the signing tab, add

    Copy the following code in the section previous "this script is run when the field is signed.

  • How to fill my date fields placed on the Master Page to several pages?

    I have a dynamic form with fields flowing. I inserted date fields using the tab of Master Pages in Adobe LiveCycle Designer ES2, Windows 7 operating system. I have only 1 Master Page. Everything on the form works fine, except when I have several pages, date fields are empty on all except the first page. One of the date fields in the event javascript has exit to calculate the second field. I can manually change the fields of date subsequent page (s), but I don't want the end user to have to do. I want that date fields on the new pages to match the date fields in the first pages. Here's my output with notes to provide a visualization of what I'm looking for.

    IM Question.png

    Thank you very much in advance for anyone who can help me with this problem!

    Caroline

    You set the binding of the two fields date to the ' global mandatory?

    Important each of these fields need to own a meaningful name, for example "date_UserEntry" and "date_Calculate".

  • 11g you can store Timestamp in the Date field?

    In our 9i database, we store a timestamp in a Date field - this is not correct, I know, but it's a legacy issue that we have not solved at the present time.

    We have updated to 11g and now insert a model date Timestamp is successful BUT the time part gets cut off then when search you again you get only the data of the DD-MM-YYYY.

    It is a problem for us, and I would like to know if its possible to set up a Date on the ground in 11G to store data of hh.mm.ss.ssss DD-MM-YYYY entirely.

    Any constructive thoughts appreciated :)

    In our 9i database, we store a timestamp in a Date field... We have upgraded to 11g

    There is no change in the specification of the DATE data type that the Oracle RDBMS is concerned.
    What you have managed to insert and to persist in a DATE previously in 9i should be the same in 11g (all other things being equal).

    We have updated to 11g and now insert a model date Timestamp is successful, BUT the time part gets ébranchée off then when search you again

    How do you recovered it?
    Have you checked to go using a format full explicit TO_CHAR that the time element is actually missing?
    Verified that this is not a conversion implied and/or associated NLS_DATE_FORMAT error?
    And you can always check with the DUMP function which is really persistent.

    Once the foregoing double-check, then the question is what is inserting this time stamp?
    What application? What does say? The pilots have changed? etc.etc
    For example, at one point, I remember that changed how jdbc drivers dates with times must be mapped to the types of data Oracle, i.e. of something as a java.sql.date to java.sql.timestamp. But it is rather a distant memory.

  • Calculation of the date fields

    Hello

    I have three fields. 2 are formatted with the date field, and the third for the calculation of the difference between 2 date fields.

    For example, Field1 said August 2012, and field 2 said Sep 2012. Is it possible that I can do field 3 dipslay the 1 (month) response?

    Any help would be greatly appreciated.

    Thank you

    Yes, you use the date object JavaScript extract fields of the whole of the year and the month, create a common denominator for the month and year, and do the math.

    The event of calculation for the number of months:

    Delete the result value

    Event.Value = "";

    get field values

    var sStart = this.getField("Date1").value;

    Send var = this.getField("Date2").value;

    process if we have data

    If (sStart! = "" & send!) = "") {}

    convert date objects date strings

    var start = util.scand ("mmm yyyy", sStart);

    oEnd var = util.scand ("mmm yyyy", sending);

    get the full date and month year beginning

    var nStartFullYear = oStart.getFullYear ();

    var nStartMonth = oStart.getMonth ();

    convert data from start of month

    var nStartMonths = (nStartFullYear * 12) + nStartMonth;

    Get the complete year end date and month

    var nEndFullYear = oEnd.getFullYear ();

    var nEndMonth = oEnd.getMonth ();

    convert data from end of month

    var nEndMonths = (nEndFullYear * 12) + nEndMonth;

    do the math

    Event.Value = nEndMonths - nStartMonths;

    } / / end have given

    You will need to adjust the names for the start and end dates.

  • Adding a year to the current date field

    Hello

    Can someone please help on how to add a year to the current date field.

    for example 19/07/2011 over a year = 19/07/2012

    Thank you

    DAO Han

    If you had a DateTimeField1 field and you want to display the following year in DateTimeField2, you may do the following in JavaScript;

    var d1 = util.scand ("yyyy-mm-dd", DateTimeField1.rawValue);
    If (d1! == null)
    {
    D1.setFullYear (D1.getFullYear () + 1);
    DateTimeField2.rawValue = util.printd ("yyyy-mm-dd", d1);
    }

    Good luck

    Bruce

Maybe you are looking for

  • Why can we not deleat deleated all emails at once?

    Why should I click on each email removed from removing it from my computer? Why can't I select Remove all, then remove them?

  • Adding slides by Option + up/down

    In numbers you can add rows or columns by Option + up/down. Why add slide by Option + up/down arrow is not available? Keynote 6.6.1 Mac OS X

  • VISA reading significantly slows down to 20 Hz (Labview, Arduino + Xbee project)

    Hello I am quite new to Labview and Arduino, so I apologize if I use the incorrect terms. I'm having some trouble with the next project, I hope that you guys can give me some advice!I have 16 sensors connected to the 16 analog pins on an Arduino mega

  • Shared C240M3 LOM Ext

    Hello Configuration of a new C240 and I noticed there is another option in the config MMIC page called "Shared LOM Ext. Reading guides, this seems to suggest that I can share access to the administration of the CICM with one of the LOM standard and a

  • Smartphones from blackBerry Torch 9850 freezes App World

    I have a 9850 which freezes when I go to App World and try to do anything in the App World. If I click on 'My account' or 'My World', it freezes and says please wait with the Green wheel. I left this appointment for 2 days and no progress.  Even if I