How to perform arithmetic operation on adf.currentDateTime

Hello

Our health care system, we perform a lot of operations with datetime (especially for babies patients) data.

For example, we need to start bind variable with adf.currentDateTime plus/minus 30 minutes, 2 hours, 8 hours etc etc...

I tried to set to the default value, an expression such as

adf.currentDateTime - 1/48 (30 minutes)

adf.currentDateTime - 2/24 (2 hours)

But I get the following error:

No signature of method: java.sql.Timestamp.minus () applies to the types of arguments: (Java.Math.BigDecimal) values: [0.0208333333] possible solutions: minus (int), UNMIS (java.util.Date), UNMIS (int), find(), more (int), is (java.lang.Object)

I also tried a groovy expression

adf.currentDateTime - 2.hours

but without success

I see adf.currentDateTime, which define a method in the ViewObjectImpl class, but of course our system, we need to define a method more complex that can receive different arguments for the minutes, hours and even any other argument to datetime data to perform the previous operation.

There is an easier way to set the default values using groovy expressions only without the need of the add methods of the ViewObjectImpl class?

I use Jdev 12.1.3 on win7 64 bit

Thank you

I tried to set to the default value, an expression such as

adf.currentDateTime - 1/48 (30 minutes)

adf.currentDateTime - 2/24 (2 hours)

Well, this isn't like in Oracle DB

You can use some arithmetic java.util.Calendar, java.util.Date and similar items, but probably not fractions, for example:

def now = Calendar.instance
def tomorrow = now.time + 1
return new java.sql.Timestamp(tomorrow.time)

I also tried a groovy expression

adf.currentDateTime - 2.hours

but without success

It will not work without proper import.

For example:

import groovy.time.TimeCategory
def now = new Date()
use(TimeCategory) {
    after2h = now + 2.hours
    return new java.sql.Timestamp(after2h.time)
}

Dario

Tags: Java

Similar Questions

  • How to perform the operation in LabVIEW and c language IF condition, tat too with strings?

    Hey Hey geeks,

    I have a small doubt. I want to check if an input string is equal to 'EI202' (for example) and if it s true, a 5 v signal has b sent thro a data acquisition to a relay? juice as if the condition in c language...

    How v can interface a mind scan barcode LabVIEW? I mean I want to get a string entry to the reading of the bar code on an object with the barcode scanner?

    How can I get the number for the difference in days between two dates in LabVIEW?

    Please please please answer my questions... If you giv me the dia block of the above issues, I'll b abt very very very happy there. am not able to continue my project last year because of these...

    YEW is equal to the structure of the case, the connection string to the selector, write the text as it stands and place a write of data within the case.

    It's very basic LV

    A barcode scanner keyboard =. Activate a chain control and fire bar codes, same as type 'barcodenumber [enter]. "

    DateTime - datetime = lag.

    /Y

  • How perforem arithmetic operations on time

    Studio Edition Version 11.1.2.3.0

    How to perform arithmetic operations on time

    I have a timestamp of data type attribute in VO

    based on the Oracle database field

    I can get the hour and the minutes using the value default adf.currentDateTime and simple date format hh: mm a

    I'm trying to add more hours to calculate the hours of service as Expression groovy

    Ex DocumentDate +(2/24) 2 hours

    I have error

    (oracle.jbo.JboException) Houston-29000: Unexpected exception caught: groovy.lang.MissingMethodException, msg = no signature of method: java.sql.Timestamp.plus () applies to the types of arguments: (Java.Math.BigDecimal) values: [0.2083333333]

    -Level 1: retail - 0

    (groovy.lang.MissingMethodException) no signature of method: java.sql.Timestamp.plus () applies to the types of arguments: (Java.Math.BigDecimal) values: [0.2083333333]

    I have added a transitional attriburte TestHire to the Employees (from a HR DB schema) table

    and in the expression of the value the groovy

    When I run now present in the Module Tester Application I see that the TestHire attribute is HireDate + 2 h

    Timo

  • How to perform the customization & personalization in ADF? Any body set good example demonstration...

    How to perform the customization & personalization in ADF? Any body set good example demonstration...

    Hello

    If you want to know the customization & personalization demo, you go through the following link...

    Oracle JDeveloper 11g Release 2 tutorials - customization and customize an Application

    I think that his may be useful for you.

    Thank you

    MAGO

  • How to perform the reset operation after an operation?

    Hello

    I want to know the reset function.

    in my system, I'm dealing with a different instrument like power, GPS, GSM...

    in my system, I have 2 article to article 1, I put only ON and OFF of my devices and operation to the second section so that I have to deal with the task of GSM current liabilities and tensions, I put a switch to start (from boolian) after giving a start 2nd section will begin to perform any operation until the end and LED of concerning section will be the , but when I press start again to switch the my 2nd section is located and must be released and since, to begin in Sciez.

    Here, as an attachment, I enclose my Panel until you see the button, I used after that pressing on it that my system needs to be reset I can't do.

    Please let me know what kind of logic I need to use to reset the function. ???

    Thanks in advance.


  • How to perform simple tasks in Windows 8

    I know how the various Windows 8 is that previous versions of Windows.

    I found a few demo videos with many tips on how to use Windows 8. The videos give how to research, sharing, switching and closing applications and how to perform simple tasks in t he operating system.

    Here is a link to the videos.

    Enjoy!

    I hope the videos help out!

  • Arithmetic operation on complex numbers

    How can I do Arithmetic operations on complex numbers in the table?

    oiuuhjoi wrote:

    exponential, more, less etc.

    The standard digital palette operations should work for you.

  • Error number - DETAIL - profile of Windows XP performing an operation of paging

    Whenever I start my computer, I get the following at the start up error message:

    Windows cannot load the user's profile, but you have logged on with the default profile for the system.
    DETAILS - error running of a paging operation.

    How can I solve this problem?

    Try one of the following solutions to fix a user profile:

    "How to recover a damaged Windows XP user profile"
      <>http://support.Microsoft.com/kb/555473 >

    "Windows XP problems if your profile is corrupted"
      <>http://support.Microsoft.com/kb/326688 >

    "How to copy data from a corrupted to a new profile in Windows XP user profile"
      <>http://support.Microsoft.com/kb/811151 >

    Corrupt profiles are usually accompanied, if not caused by, a corruption of the file system.  A full audit of the disc with the ' / F ' or ' / R ' option is recommended after recovering or as part of the recovery.

    "How to perform the disk error checking in Windows XP"
      <>http://support.Microsoft.com/kb/315265 >

    HTH,
    JW

  • Not able to download error summary "could not perform this operation because the mail by default is not installed correctly"

    Victorinox original title: Windows problem

    Im a senior looking for a job. When I'm craig's list and to to load my windows exployer RESUME come with a window that says "cannot perform this operation because the default mail is not properly installed. Can someone give me please a detailed step by step procedure to solve this problem?  Thank you so much Denny

    Hello Denny carguy,

    -Who is your provider of mail service?

    Windows XP has the default Outlook Express e-mail client. To send and receive emails using Outlook Express, you must configure it.

    See the links to find out how to set up Outlook Express in Windows XP.

    How to set up Outlook Express

    Microsoft Outlook Express

  • Can not open CD player - you don't have sufficient rights to perform this operation Vista Business

    I put a CD or DVD in the drive and double-click it (it can be either a blank disc or an already burned disc just try to see what is on the disk) and every time we get

    "You don't have sufficient rights to perform this operation.

    I'm lost,

    Windows Vista Business

    Hello

    ·        Are you connected the computer as an administrator?

    Method 1:

    You can try running the fix in the below article data and check if this is useful.

    http://support.Microsoft.com/mats/cd_dvd_drive_problems/en-us

    Method 2:

    You can check if the third-party application is causing the problem. To determine which application is causing the problem, you can configure the computer to clean the start State and check if that helps. To configure the startup mode minimum State follow the link below.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    http://support.Microsoft.com/kb/929135

    Note: When you are finished troubleshooting, follow step 7 article to start on normal startup.

    Hope this information is useful.

    Amrita M

    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to reinstall the operating system on a Curve 8310 blackBerry smartphones?

    There seems to be missing elements of my OS (vs 4.5.0.182).  How can I reinstall the original operating system to get everything working again?

    Hello and welcome to the community!

    From a PC, you can install any compatible OS package (for example, for your exact model of BB number) to a BB via this procedure:

    Note Although written to "recharge" and the storm, it can be used to upgrade, downgrade or recharge any BB device model - depends on the operating system package you download and install on your PC. You can even use a different OS package carriers simply insert, between steps 1 and 2, the deletion, on your PC, a file named PROVIDER. XML. remember that you remove from your PC, no matter what other packages devices OS BB as having more than one installed on the PC can cause conflicts with this procedure.

    If you are on a MAC, you are limited to only your sanctioned carriers OS packages... but can still use any level they currently have to sanction. See this procedure:

    • KB19915 How to perform a clean reload of the smartphone BlackBerry using BlackBerry Desktop Software application software

    Good luck and let us know!

  • Error message when opening the parts attached Windows could not perform this operation because the explore default e-mail client has not been installed correctly.

    Original title: fault of the Explorer

    How can I solve this problem.

    Sometimes when you try to open an attachment, I see this message:

    Windows could not perform this operation because the explore default e-mail client has not been installed correctly.

    Thanks for your HELP!

    Hi Robert,.

    Thank you for your response.

    Please let us know if you need help with Windows, we will be happy to help you!

  • Error: role "RQADMIN" is required to perform this operation

    Hello:

    I'm new on Ore. Was trying to create an embedded script. When you run ore.scriptDrop (), dot the following error:

    > ore.scriptDrop ("SimpleScript1")

    Error: role "RQADMIN" is required to perform this operation

    >

    How can I activate the RQADMIN role?

    Thank you

    Mauricio

    As sysdba, grant the role RQADMIN to your Oracle Enterprise R user.  For rquser:

    $ sqlplus / as sysdba

    SQL > grant RQADMIN to rquser;

    Sherry

  • Arithmetic operation resulted in an overflow - System.Data.Odbc.OdbcDataReader.FirstResult)

    Hello

    I installed Oracle Database 11g Release 2 full Client for Microsoft Windows (x 64) of: (link)of Oracle Database 11 g Release 2 for Microsoft Windows (x 64)

    When I run an ODBC statement from a .NET (64-bit) application, I get the following error:

    Type of exception: System.OverflowException

    Exception message: arithmetic operation resulted in an overflow.

    Exception trace: at System.Data.Odbc.OdbcDataReader.FirstResult)

    I tried the same statement from another machine (same configuration), but with only the components of the ODAC 11.2 and it worked perfectly fine.

    I don't want to use 11g ODAC components because it does not support transactions responsible MTS (known bug). The full client for its works perfectly fine for this kind of scenario. I did some research online and I find that there are available patches to fix the above point. Please give me a link to download the fix or tips on how I can fix this problem.

    Concerning

    Regnier

    Hi Ben Amor,.

    You could be hitting the known, documented problem in Note below:

    Data recovery using a .NET ODBC Application may fail with: "arithmetic operation caused an overflow" (Doc ID 1181253.1)

    If you're on 11.2.0.1 Oracle client download and install the patch 11.2. 0.1 PATCH 5:9966926

    Download link:

    https://updates.Oracle.com/download/9966926.html

    This bug is fixed in 11.2.0.2.0 or a later version of the Oracle client.

    The 11.2.0.2 software can be downloaded from My Oracle support: Patch: 10098816

    https://updates.Oracle.com/download/10098816.html

    Last client version 11.2 that is 11.2.0.4, can be downloaded from My Oracle support: Patch: 13390677

    https://updates.Oracle.com/download/13390677.html

    Kind regards

    Ravi

  • adf.currentDateTime

    Hi all

    I use jdeveloper 11.1.2.3.0

    If I want a connection variable that the value of the current date + 1 hour, how do I write it?
    adf.currentDateTime.plus(1/24)
    
    adf.currentDateTime.plus(1)
    
    adf.currentDateTime.plus(3600)
    
    adf.currentDateTime + 3600
    
    ..... ??
    Thank you very much

    >
    You have an idea on how to write it in groovy or indeed if it is possible to write in groovy?
    >
    Actually no, I have no idea: (.)

    >
    because if I want to use java, I need to change a lot of things already done. So this is my last option
    >
    Why you need to do a lot of these things. What you need are:
    1. define a method in your class ViewObjectImpl

      public Timestamp getDateAfterOneHour()
      {
        Calendar cal=  Calendar.getInstance();
        cal.add(Calendar.HOUR, 1);
        Timestamp timeAfterOneHour = new Timestamp(cal.getTime());
         return timeAfterOneHour;
      }
    

    2. for the bind variable set its value Expression type and its value to getDateAfterOneHour(). and then use it in your where statement.

Maybe you are looking for

  • Scan to printer wireless HP Envy 4500 Tablet

    How can I do this? and also how do I get a logo for the printer on my tablet - that I can click on and extract the diff options - that is to say no single sided printing double sided etc (same type of logo that you normally would on your laptop) Than

  • Re: Satellite A500 - Digital Tuner DVB - T will not find channels

    Hi all I recently bought a Satellite A500-02J. Im having problems trying to receive digital television with its built-in DTT tuner.When setting up through Windows media player everything is ok and said that the tuner is fine and set up correctly. But

  • problem with sony XCL-C280

    Hello world I'm struggling to acquire images from a sony camera XCL-C280, I use a framegrabber to the NI PCIe-1430. I had to make my own camera file using the camera file generator (see attachment camera file, I had to change the extention of the CIM

  • The page master, menu and images... why the menu disappear when adding an image full screen?

    Hi allI use the widget Menu Muse on the single page Master on the site, but disappears from menu to a page where I placed an image "full screen".  Is there a 'picture-holder' that I could use and still have Visual and using the menu? (hope that makes

  • 'File' 'new' keeps freezing photoshop?

    When I try to click on 'FILE' and 'NEW' nothing happens. When I try again all my drop-downs are grayed out and I can't select anything. I have uninstalled/re-installed and same problem continues to be. Honestly, I can't imagine what has changed since