calculate age using sysdate and 3 combobox

Hello.. Im having a problem on how I remove sysdate to my 3 combobox [value of 1 day (1-31), 2 months (JAN, FEB etc.), value 3 years value (2009,2007 etc.)]
IM thinking to put my codes in when-validate-item trigger on each combobox... or shud I use the change list? IM using oracle 9i

Hello
You can use the WHEN-LIST-CHANGE, but before that you must convert values selected in date then you can perform arithmetic functions. As.


DECLARE
  vDateSelected DATE;
BEGIN
  vDateSelected:=TO_DATE(:COMBOBOX1||'-'||:COMBOBOX2||'-'||:COMBOBOX3,'DD-MON-YYYY');
  :FORM_AGE_FIELD:=(ROUND(SYSDATE-vDateSelected))/365;  -- You can remove the round on ur requirement.
  :FORM_AGE_FIELD:=ABS(MONTHS_BETWEEN(SYSDATE,vDateSelected))/12;
END;

Copy the following code in WHEN-CHANGED the list of the last selected field. Assume that the user will select the last year field so create the trigger in this area and use the code above.

-Clément

Published by: Hannah on May 9, 2010 17:44

Tags: Oracle Development

Similar Questions

  • PowerCLI Script required to identify all clusters in a data center and all hosts within each cluster and calculate it using cpu and ram, avg, min, and max.

    Hi all

    I'm new to powercli and try to create a script to list all clusters in a data center and all hosts in a cluster and calculate min, max and avg cpu usage and ram by the host and cluster. So far, I have tried the below but I can't publish the results of my script.

    $Function = @)
    ForEach ($DataCenter Get-Data Center)
    {
    ForEach ($cluster in ($DataCenter |)) Get - Cluster)) - need help to post the information here and confirm if this is correct or not.
    {
    ForEach ($hosts in ($cluster |)) Get - VMHost))
    {
    ForEach ($vms to ($hosts |)) Get - VM)) - do not know if I called you here functions properly
    {
    $allvms = @)
    $allhosts = @)
    $hosts = get-VMHost
    $vms = get - Vm

    {foreach ($vms in $hosts)
    $hoststat = "" | Select the host name, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin
    $hoststat. Host name = $vmHost.name

    $statcpu = get-Stat-entity ($vmHost) - start (get-date). AddDays(-30)-Finish (Get-Date) - MaxSamples 10000 - stat cpu.usage.average
    $statmem = get-Stat-entity ($vmHost) - start (get-date). AddDays(-30)-Finish (Get-Date) - MaxSamples 10000 - stat mem.usage.average

    $cpu = $statcpu | Measure-object-property value - average - Maximum - Minimum
    $mem = $statmem | Measure-object-property value - average - Maximum - Minimum

    $hoststat. CPUMax = $cpu. Maximum
    $hoststat. CPUAvg = $cpu. Average
    $hoststat. CPUMin = $cpu. Minimum
    $hoststat. MemMax = $mem. Maximum
    $hoststat. MemAvg = $mem. Average
    $hoststat. MemMin = $mem. Minimum
    $allhosts += $hoststat
    }
    }
    }
    }
    }

    $Function | Select the host name, MemMax, MemAvg, MemMin, CPUMax, CPUAvg, CPUMin | Export-Csv "c:\Function.csv" - noTypeInformation

    Any help on this is much appreciated.

    [Ordered] casting was introduced in v3 PowerShell.

    For PowerShell v2, you can use

    $vms = get - VM

    $stat = 'cpu.usage.average ','mem.usage.average '.

    $start = (get-Date). AddDays(-31)

    $report = get-Stat-entity $vms - start $start - Stat $stat - ErrorAction SilentlyContinue |

    Group-object - property {$_.} @entity.name} | %{

    $cpu = $_. Group | where {$_.} MetricId - eq "cpu.usage.average"} | Measure-object-property value - average - Maximum - Minimum

    $mem = $_. Group | where {$_.} MetricId - eq "mem.usage.average"} | Measure-object-property value - average - Maximum - Minimum

    New-object PSObject-property @ {}

    Datacenter = Get-Datacenter - VM $_. Group [0]. Entity | Select the name of ExpandProperty-

    Cluster Cluster Get - VM = $_. Group [0]. Entity | Select the name of ExpandProperty-

    VMHost = $_. Group [0]. Entity.Host.Name

    Name = $_. Group [0]. @entity.name

    CpuMin = $cpu. Minimum

    CpuAvg = $cpu. Average

    CpuMax = $cpu. Maximum

    MemMin = $mem. Minimum

    MemAvg = $mem. Average

    MemMax = $mem. Maximum

    }

    }

    $report | Sort-Object-property Datacenter, Cluster, VMHost name |

    Export Csv report.csv - NoTypeInformation - UseCulture

  • Calculate age with date of birth only? OBIEE

    I would like to calculate age based on DOB.  I get a syntax error.  Not familiar with the proper syntax of PL/SQL for nesting of IF/THEN statements.  Any help would be fantastic:

    @{Current_Date} = current Date

    "Employee personal attributes. "" Date of birth of the employee ' = DOB

    WHEN IFNULL("Employee Personal Attributes"."Employee Birth Date", 0)<> 0 THEN
        
        WHEN MONTH("Employee Personal Attributes"."Employee Birth Date") <  (Month(@{CURRENT_DATE})) Or (Month("Employee Personal Attributes"."Employee Birth Date") = Month(@{CURRENT_DATE}) And Day("Employee Personal Attributes"."Employee Birth Date") <= Day(@{CURRENT_DATE})) Then
        
        TIMESTAMPDIFF(SQL_TSI_YEAR,"Employee Personal Attributes"."Employee Birth Date", @{CURRENT_DATE})
    
        Else
    
        TIMESTAMPDIFF(SQL_TSI_YEAR,"Employee Personal Attributes"."Employee Birth Date", @{CURRENT_DATE})-1
        
        End
        
    ELSE
    
    0
    
    End
    

    Any help would be much appreciated!

    Hello

    I managed to find a date column with some null on my test platform (SA406).

    The formula I posted without the NULL case already return 0 when date is NULL (was not really planned).

    If you want to use a CASE IFNULL WHEN ("personal attributes used". "" Employee Date of birth»(, 0) <> 0 THEN you'll get an error: "

    [nQSError: 59021] CASE conditional expressions have correspond to data types.

    So 2 options:

    CASE WHEN IFNULL ("personal attributes used". "" Date of birth of the employee»(, CURRENT_DATE) <> CURRENT_DATE THEN "

    TIMESTAMPDIFF (SQL_TSI_YEAR, "personal attributes used" "." ") Date of birth of the employee", CURRENT_DATE) + BOX WHEN DAYOFYEAR ("personal attributes used". "Date of birth of the employee") > DAYOFYEAR (CURRENT_DATE) - THEN 1 ELSE 0 END "

    ELSE 0 END

    or

    TIMESTAMPDIFF (SQL_TSI_YEAR, IFNULL ("personal attributes used". "" Date of birth of the employee "(, CURRENT_DATE)(, CURRENT_DATE) + BOX WHEN DAYOFYEAR (IFNULL ("personal attributes used"." Date of birth of the employee", CURRENT_DATE)) > DAYOFYEAR (CURRENT_DATE) - THEN 1 ELSE 0 END

    Both did the same thing.

  • Calculation of age using TimeStampDiff problems

    Hi, I'm running a strange problem. 'âge' is not an attribute stored in our data warehouse - but is "Date of birth".

    I try so to dynamically calculate age based on the difference between the date of birth and whatever "date statement" the user chooses. In the business layer, I defined the age as (note that field date_key on the date dimension is actually a DATE field, not the surrogate key):

    Try #1: TimeStampDiff (TSI_SQL_YEAR, birth_date, dim_date.date_key)
    Try #2: TimeStampDiff (TSI_SQL_MONTH, birth_date, dim_date.date_key) / 12
    Try #3: Truncate (TimeStampDiff (TSI_SQL_MONTH, birth_date, dim_date.date_key) / 12, 0)

    The problem I encounter is that, when written OBIEE the SQL in the Oracle database, instead of translating the TimeStampDiff function to use Oracle "months_between", it uses ROUND (months_between), like this:

    ROUND (MONTHS_BETWEEN (T48594. DIM_DATE_KEY, T48615. (BIRTH_DATE) / 12)

    And the problem is, when the flare, he pipes the calculation of age. For example, I get the following for an employee with a date of birth 20 October 1967:

    RPT Date Birthdate age
    Jan 2009 10/20/1967 41
    Feb 2009 10/20/1967 41
    Mar 2009 10/20/1967 41
    Apr 2009 10/20/1967 41
    Apr 2009 10/20/1967 42
    May 2009 10/20/1967 42
    Jun 2009 10/20/1967 42
    Jul 2009 10/20/1967 42
    Aug 2009 10/20/1967 42
    Sep 2009 10/20/1967 42
    Oct 2009 10/20/1967 42
    Nov 2009 10/20/1967 42
    Dec 2009 10/20/1967 42

    As you can see, on 20 April, the age increased from 41 to 42 years. April 20 is exactly 6 months before date of actual birth of 20 October (so the problem with the ROUND function).

    I need to somehow "force" OBIEE use TRUNC (months_between), not ROUND (months_between). Well, to tell you the truth, not sure at all why he puts ROUND here... If I wanted the rounded number, I would add this feature in muself. Other creating a view in the physical layer to support this, is possible to do what I'm trying to do it directly in the business layer?

    Thanks in advance!
    Scott

    If so...

    use the functions of database directly with function evaluate in OBIEE

  • I lost at the age of Mythology the titans expansion disc, but I still have key code, is there a way I can download age of mythology and put the key in to make it work?

    I lost at the age of Mythology the titans expansion disc, but I still have key code, is there a way I can download age of mythology and put the key in to make it work?

    Hi mxbot221,

    It is very unfortunate to know that you have lost the game disc. It is indeed a nice game that requires precision and work of the spirit.

    But the good thing is that you can download the demo version of the game among the links below and then, can enter the product key to unlock all its features.

    Here are the links: 1) http://www.microsoft.com/games/pc/titans.aspx

    2) http://www.microsoft.com/games/titans/downloads.aspx

    In addition, you can try to contact the Microsoft Supplemental Parts team for a replacement CD. To locate the phone number, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh; EN-US; CNTACTMS

    Ref: How to replace Microsoft software or hardware, order service packs and upgrades, and replace product http://support.microsoft.com/kb/326246 manuals

    You can also try http://forums.gamesforwindows.com/ Games Microsoft support forum> for more discussions about the game.

    Hope this information was useful.
    -------------------------------------------------------------------
    Naveen
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Age of MSG and Max in RSTP

    Hello

    Please, someone shed some light on the logic behind the age Message fields and age Maximum of RSTP BPDU. I have a block of temporary brain.

    Thanks in advance. Nice day!!

    Hello Bilal,

    In your previous post you was explaing the 802.1 d (STP) process not 802.1W (rstp)

    The maximum age timer specifies the maximum scheduled time of arrival of Hello BPDU. If the expiration of the timer of the age limit, the bridge detects that the link to the root bridge failed, and he initiated a convergence of the topology. The timer of the age limit should be longer than the configured Hello timer.

    RSTP does not rely on STP timer values (delay and age max).

    Instead, it uses a mechanism of proposal/agreement for a rapid convergence to a port.

    Please check this document rstp ORC , it gives a good explantion with topologys how rstp synchronizes its ports not desgianted and how the proposal or the agreement is respected.

    RES

    Paul

    Please do not forget to note all messages that have been useful.

    Thank you.

  • Compatibility of Windows 8 with Age of Mythology and Titans

    Bought a new laptop with Windows 8 preload.  The only thing I use the laptop for is to play Age of Mythology and it does not work.  Looked like all the forums for corrections and Windows 8 seems to be preloaded with DirectX11 and all the correct s/w but still the "Initialization failed" error at startup.

    Is there a version of patch to fix this?  Otherwise anyone who upgrades to the new sys Op MS will have this prob.

    Hey Loren,

    Microsoft Age Of Mythology: Titans is not compatible with windows 8. Then I suggest to install the game in compatibility mode and check if it helps. Here is the link that tells you about the incompatibility of the game with Windows 8.

    Windows Compatibility Center

    Follow the steps to install the game in Compatibility Mode:

    a. right click on setting up the file, then select Properties and then tap or click on the compatibility tab.

    b. check the box run this program in compatibility modof e.

    c. press or click the menu drop down and select a previous operating system, and then tap or click OK.

    See the article for more information.

    Make the programs more compatible with this version of Windows

    Hope this information helps. Answer the post with an up-to-date issue report to help you further.

  • Difference between Sysdate and trunc (sysdate)?

    SYSDATE and trunc (sysdate) both return the current date.

    So I would like to know is there a difference between them?

    Thank you

    DATEs in Oracle ALWAYS have a portion of time (what you call a timestamp). Using tronque() on a DATE fixed the part time at midnight that day there

  • Calculate the use of operating rooms

    I received this question in an e-mail.

    I will post it here, as well as my own answer-, so that other people with the same problem can find and learn, and that responses can be given (here there are smart people who might have alternative solutions of large .)

    Here's the post with the question:

    ------------------------------------------

    Hi Kim,

    I'm stuck in a SQL query.

    I want to calculate the use of operating rooms. follwing is my data structure

    create the table room_usage
    (in_time DATE,
    out_time DATE,
    mr_no VARCHAR2 (15).
    room_no, NUMBER (3));

    insert into room_usage
    values
    (to_date('11-Feb-15 8:33:00 AM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 10:17:00 AM', 'dd-mon-RR hh:mi:SS am'),
    '00052740',
    733);
    insert into room_usage
    values
    (to_date('11-Feb-15 10:56:00 AM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 12:36:00', 'dd-mon-RR hh:mi:SS am'),
    '00111780',
    733);
    insert into room_usage
    values
    (to_date('11-Feb-15 12:56:00 PM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 2:46:00 PM', 'dd-mon-RR hh:mi:SS am'),
    '00111777',
    733);
    insert into room_usage
    values
    (to_date('11-Feb-15 3:02:00 PM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 6:12:00 PM', 'dd-mon-RR hh:mi:SS am'),
    '00052713',
    733);
    insert into room_usage
    values
    (to_date('11-Feb-15 6:51:00 PM', 'dd-mon-rr hh:mi:ss am'),
    to_date('11-Feb-15 7:57:00 PM', 'dd-mon-RR hh:mi:SS am'),
    '00052760',
    733);
    insert into room_usage
    values
    (to_date('12-Feb-15 8:51:00 PM', 'dd-mon-rr hh:mi:ss am'),
    to_date('12-Feb-15 9:57:00 PM', 'dd-mon-RR hh:mi:SS am'),
    '00082760',
    733);

    Select IN_TIME, OUT_TIME, (OUT_TIME - IN_TIME) * 24 * 60 stay, MR_NO, ROOM_NO
    of room_usage
    When trunc (IN_TIME) between February 11, 15 'and 12 February 15'
    order of in_time


    in_time out_time stay_min mr_no room_no

    11 February 15 08:33 11 February 15 10:17 104 00052740 733
    11 February 15 10:56 11 February 15 12:36 100 00111780 733
    11 February 15 12:56 11 February 15 14:46 110 00111777 733
    11 February 15 15:02 11 February 15 18:12 190 00052713 733
    11 February 15 18:51 11 February 15 19:57 00052760 733
    12 February 15 20:51 12 February 15 21:57 00082760 733

    But I also want to get time slots to USE NOT. This is the result I want

    in_time out_time stay_min mr_no room_no

    11 February 15 12:01:00 AM February 11, 15 08:32 511 no use of 733
    11 February 15 08:33 11 February 15 10:17 104 00052740 733
    11 February 15 10:18 11 February 15 10:55 37 no use of 733
    11 February 15 10:56 11 February 15 12:36 100 00111780 733
    11 February 15 12:37 February 11, 15 12:55 18 no use of 733
    11 February 15 12:56 11 February 15 14:46 110 00111777 733
    11 February 15 14:47 11 February 15 15:01 14 no use of 733
    11 February 15 15:02 11 February 15 18:12 190 00052713 733
    11 February 15 18:13 February 11, 15 18:50 37 no use of 733
    11 February 15 18:51 11 February 15 19:57 00052760 733
    11 February 15 19:58 11 February 15 23:59 241 no use of 733

    How can I get that.

    A problem like this is easy to solve with the model clause:

    Select in_time, out_time, round ((out_time-in_time) * 24 * 60) stay_min, mr_no, room_no
    of room_usage
    model
    partition (room_no, trunc (in_time) d)
    dimension (row_number() on rn (partition room_no, trunc (in_time) order of in_time))
    measures (in_time, out_time, mr_no)
    rules iterate (1000) until (presentv (in_time [iteration_number + 1], 1, 2) = 2)
    (in_time [iteration_number + 0.5] = presentv (out_time [iteration_number], [iteration_number] out_time, trunc (in_time [iteration_number + 1])) + interval minute '1'
    , out_time [iteration_number + 0.5] = presentv (in_time [iteration_number + 1], in_time [iteration_number + 1], trunc (out_time [iteration_number] + 1))-'1' minute of interval
    , mr_no [iteration_number + 0.5] = 'no use '.
    )
    order of in_time

  • I have 3 domains. A field is a constant date mm/dd/yy. The second field is a digital number (1-120) and can be changed. The third field calculates two fields 1 and 2 in the summation and shown in mm/dd/yy. How do I calculate that in the script?

    How do I calculate that in the script? I have 3 domains. A field is a constant date mm/dd/yy. The second field is a digital number (1-120) and can be changed. The third field calculates two fields 1 and 2 in the summation and shown in mm/dd/yy.

    You searched for ' add days?

    You must write a custom for this JavaScript calculation because you cannot add a number any date. Also the date strings are not just a number, even if we can convert a given date in a number for that date that represents the time form a date date (Epoch). Witn this value, we can achieve them all kinds of date calculations and collect a little information about the date. JavaScirpt uses midnight on January 1, 1970 UTC for starting point or the date of the time. Its value is zero, and every millisecond increases the value of 1. When a date string is converted to the date object JavaScirpt we have access to many properties of the date and can use several methods to extract information or adjust the date object.

    Field 1 is in the format "Date" with a format of "mm/dd/yy".

    Field 2 is in «Number» format with 0 decimal.

    Zone 3 is in the format 'None '. The custom calculation script applies to the formatting.

    The custom for JavaScript calculation area 3:

    var cField1 = this.getField("Field_1").valueAsString;

    var cField2 = this.getField("Field_2").valueAsString;

    Event.Value = "";

    If (cField1! = "" & cField2!) = "") {}

    Console.println (cField1 + "" + cField2);

    calculate that if we as no null data;

    var cDateFormat = "mm/dd/yy";

    convert start date date object.

    Kai var = util.scand (cDateFormat, cField1);

    get the date of the month;

    David var = oDate.getDate ();

    Add field 2 number of days;

    David = Number (nDate) + Number (cField2);

    of being updated for the new date.

    oDate.setDate (nDate);

    Set the field to update formatting;

    Event.Value = util.printd (cDateFormat, letter);

    } / / end of data not null;

  • I created form in adobe acrobat X 1 Professional. Now, I want to put logic on a field. I want that the document will be closed if someone between age under the age of 18. and display a message for minors?

    I created form in adobe acrobat X 1 Professional.

    Now, I want to put logic on a field.

    I want that the document will be closed if someone between age under the age of 18. and display a message for minors?

    The final document is a little drastic... Perhaps simply display an error message? In any case, you can do it like this, as a custom field validation script:

    if (event.value && Number(event.value)<18) {
        app.alert("You must be an adult to fill in this form!");
        this.closeDoc(true);
    }
    

    Be aware that using this code will close the file without saving it, and the user will lose all unsaved data that they have entered.

  • How to generate date thru sysdate and day of the week

    Hello world!

    Please give me a hand with this:

    I need calculate a date thru sysdate and day of the week.

    For example:

    SYSDATE: 22/08/2013

    DAY: TUESDAY

    Result: 27/08/2013 (the date for Tuesday next from today ' hui).

    Another example:

    SYSDATE: 22/08/2013

    DAY: FRIDAY

    Result: 23/08/2013 (the date for Friday next today).

    My version of oracle's 8i (I work with a legacy database).

    Thanks in advance! ... and sorry for my English

    Search the NEXT_DAY function it does exactly what you want

  • sysdate and systimestamp question

    Hello

    We have infrastructure of grid 11 GR 2 CARS with 10.2.0.5.0 (CRS) database with the UTC time zone.

    Recently, we changed the UTC time zone to the EAST for servers

    After changing the time zone, I've updated the dbtimezone parameter of ' 0.00' to '-'4.00 and recycled the entire grid (CRS), including the database, analysis listeners etc.»»

    Now, when I directly connect to putty and query sysdate and systimestamp, I am EST.
    But if I use the client / Toad or service, even within the server, it gives the hour UTC for sysdate and systimestamp.

    other parameters such as current_timestamp, current_date, localtimestamp etc. gives the same value in any way access

    If anyone can help.

    Hello!

    Please use

    setenv srvctl database d racdb t TZ = America/Chicago

    to configure the environment of the DB.

    Thank you
    Rohit Véronique CHASSAGNE
    http://www.rohitchandok.com

  • it take ages to download and install flash player

    I realize that for some time, it will take ages to download and install adobe flash player! is there a problem with the server, I just can't install it I use windows 7 and windows 8 in both I have download it but wen trying to install, it starts to install and it is said that it takes time to download and stop instalation what I can do to install flash player? Thank you very much

    Try the offline installation program of http://helpx.adobe.com/content/help/en/flash-player/kb/installation-problems-flash-player-Windows.html #main - pars_header

  • Using Sysdate with picker within the Application Express

    We use sysdate Auto Fill a date field on one of our forms. The user can keep this date or use the date picker to update a different date value. The problem we encounter, is that when we use the sysdate, the date picker appears with the current month, but the year is 1920 instead of the current year. When choosing a date with 1920, i.e. 2 June 1920 the date displayed value is 02/06/11. When we remove the sysdate, the date picker displays the current month and year and the returned value is also correct.

    Everyone knows this and is at - it a way to get the datePicker to the correct month and year when using sysdate Auto Fill a field date display?

    We are on the verision - 3.2.1.00.12


    Thank you
    Marian

    Hello

    1920 is the minimum possible value of year that provides the date picker. In my view, it is failing for it because you have a data mask uses the figures of 2 years, try to use format of 4 years as:
    to_char(your_date,'dd-mon-yyyy')

    Sam

Maybe you are looking for

  • Cannot start windows 7 from mac (™x@QQ 0000225).

    Windows completely blocked after a download of the OS X 10.11.6. The new update of apple works very well, but I tried everything for windows, USB bootable, ISO, etc. Nothing works! Any help please?

  • external clock or wave pulse or sinusodial?

    Hello I'll plug an external clock to 6711 map source. But I wonder if the source should be trains of pulses (wave squre) or it might be vague sinusodial. When we say the frequency of the clock, it means the occurrence of the rising or falling on boar

  • Threshold values

    Hi all If I have a sin-wave captured from an oscilloscope labview went from zero to 10 seconds, how can I do to make labview will tell me all the time when values is exactly 0? I have explored the peak of waveform detection.vi, but do not get back us

  • Aspire S3 - will not start with the disc of recovery USB USB ports.

    I try to use a USB drive to recovery W8 (made with the acer recovery management) in my S3-391.  The computer starts not with a USB key into one of the ports.  When turned on, the computer will display the "Acer" screen, then the screen goes black, th

  • Determining factor in buying the Atrix - SMS font size

    I have a sort of a time reading incoming and outgoing SMS on my iPhone 3G so it's time to upgrade. I like the sound of the Atrix and would like to know: The release of Gingerbread will allow font changing on the Atrix for incoming and outgoing text m