Double round

Hi, I use this (below) to round a double to 2 places, but I seem to remember that this will mean that my program does not start on version 4.5 and below. Does anyone have a way to complete a double in 2 places without problems of os version please?

public static final double roundDouble(double d, int places) {
        return net.rim.device.api.util.MathUtilities.round(d * net.rim.device.api.util.MathUtilities.pow(10, (double) places)) / net.rim.device.api.util.MathUtilities.pow(10,
            (double) places);
    }

Apart from the strange compilation error, I think that the above code will fail as soon as the double goes as exponential when converted to string.

I guess that one option is to multiply by 100 double, add 0.5, paste the result into a long, then double back and divide by 100.  As suggested by Dfallak below, you must make sure that the double value did not exceed the features of a long (see Long.MAX_VALUE, Long.MIN_VALUE)

Also, something like the following.

double d = 1000000000.005 d;

Double test = (d d 0.01%);
Double rounded;
If (test< 0.005="" )="">
rounding = d - test;
} else {}
rounding = d + (0.01 - test);
}

Tags: BlackBerry Developers

Similar Questions

  • Rounding to the double rounded Excel @MRound possible?

    Hello

    Essbase to round to a repeated sense that mimics Excel how MRound?

    Example 1 Excel

    MRound (.375,.25)

    MRound result:.50

    Example 2 Excel

    MRound (.374,.25)

    MRound result:.25

    In any case do that in Essbase?

    Use the function @ROUND but divide rounded front and subsequently multiply?

    @ROUND ((x / y), 0) * y

    .. where x is your entry and there is what you want to round. for example

    @ROUND ((.374 / 0.25), 0) * 0.25 = 0.25

    @ROUND ((.376 / 0.25), 0) * 0.25 = 0.5

  • Effective method to round double on 0.05

    I have a question on double rounding on 0.05

    As much as I know there is no class method that is able to do this. To reach this round, I have the following code:

    Example:

    164.67-> 164,70

    173,33 - > 173,35

    -> 0.05 0.02

     double calculatedQuantity = 0.0;
    
      // Formula to calculate the average working hours in a month
      int totalWeeksInYear = 52;
      int totalMonthsInYear = 12;
    
      calculatedQuantity = (quantity * totalWeeksInYear) / totalMonthsInYear;
    // Round the 2 decimals
      calculatedQuantity = calculatedQuantity * 100;
      calculatedQuantity = Math.round(calculatedQuantity);
    
      //The rounding has to be on 0.05 in the benefit of the employee. Use modulus to get a 0 or 5
      while(calculatedQuantity%5!=0){
      calculatedQuantity = calculatedQuantity + 1;
      }
    
    
      calculatedQuantity = calculatedQuantity/100;
    
      calculatedQuantity = calculatedQuantity/100;
    

    It works but I do not have the feeling that it is effective.

    Any suggestions would be welcome.

    Kind regards

    Hans

    Hello Hans,.

    Try to multiply by 20 and round up (java 'ceiling' I mean), then dividing by 20.

    Something like:

    calculatedQuantity= (double) Math.ceil(calculatedQuantity * 20.0 ) / 20.0;
    

    Kind regards

    Rajen

  • function round date

    cant that I round the date like that?
    or only sysdate can be rounded or if the date is stored in a variable can only be rounded

    Select double round('21-feb-1999','mon');

    Hello

    987018 wrote:
    cant that I round the date like that?
    or only sysdate can be rounded

    No, there is nothing in particular SYSDATE. Any DATE may be rounded off.

    or if the date is stored in a variable can only be rounded

    No, it does not matter if the DATE is a column, a literal, a variable, the result of a function, or any other form of expression, just as long as it's a DATE.

    Select double round('21-feb-1999','mon');

    The problem is that 21 February 1999 "is not a DATE; It's a VARCHAR2.

    TO_DATE allows to convert a DATE VARCHAR2:

    SELECT  ROUND ( TO_DATE ('21-feb-1999', 'dd-mon-yyyy')
                  , 'mon'
                  )       AS r
    FROM    dual;
    

    or use a literal DATE:

    SELECT  ROUND ( DATE  '1999-02-21'
                  , 'mon'
                  )       AS r
    FROM    dual;
    
  • OBI, rounded to 2 decimal places

    I just created a simple application with a dumy column and a single column and gave the math in this column as 23/12, 6. The returned result is 1.83. Why the result is rounded to two decimal places?

    THX.

    Hi parag.

    OBIEE inwardly rounded to 2 decimal places... for the calculation you mentioned 23/12.6 gives you great something like 16-digit number after the decimal point.

    If you want to check with Select 23/12.6 double (GOLD)
    If you want to round your favorite decimal check with this query, select double round(23/12.6,5)

    Hope this helps you.

    By,.
    KK

    Published by: KK on October 21, 2010 23:15

  • Place of current residence (Longitude/Latitude) GPS does not work on real device

    Hello

    I wrote a small test application for GPS/latidue longitude. It works fine on simulator (9630), but not on the real device (BlackBerry Tour). Am I missing something? I have to set anything on the device? I already have the data plan activated in the device. Should I have any extra service from the supplier in order to let this GPS thing work?

    Here's my test code:

    public class GPSDemoScreen extends MainScreen implements FieldChangeListener{
        private ButtonField btnGPSTest;
        private EditField edStatus;    
    
        private BBTest bbTest = null;
        private VerticalFieldManager vfManager = null;
    
          // Constants -----------------------------------------------------------------------------------------------------------------
        private static final int GRADE_INTERVAL=5;  // Seconds - represents the number of updates over which alt is calculated.
     //   private static final long ID = 0x5d459971bb15ae7aL; //com.rim.samples.device.gpsdemo.GPSDemo.ID
        private static final int CAPTURE_INTERVAL=5;    // We record a location every 5 seconds.
        private static final int SENDING_INTERVAL=30;   // The interval in seconds after which the information is sent to the server.
    
        // When running this application, select options from the menu and replace 
        // with the name of the computer which is running the GPSServer application found in
        // com.rim.samples.server, typically the local machine.  Alternatively, the _hostName variable
        // can be hard-coded below with no need to further modify the server name while running the application.
    
        private static int _interval = 1;   // Seconds - this is the period of position query.
        private static float[] _altitudes;
        private static float[] _horizontalDistances;
    
         private long _startTime;
        private float _wayHorizontalDistance;
        private float _horizontalDistance;
        private float _verticalDistance;
        private StringBuffer _messageString;
        private LocationProvider _locationProvider;
        //private ServerConnectThread _serverConnectThread;   
    
        /** Creates a new instance of GPSDemoScreen */
        public GPSDemoScreen(BBTest bbtest) {
            super(DEFAULT_MENU | DEFAULT_CLOSE);
            bbTest = bbtest;
    
            initComponent();
        }
    
        private void initComponent(){
            this.setTitle("GPS Demo");
         //   this.bbTest.setBGImage(vfManager, this);
            // Used by waypoints, represents the time since the last waypoint.
            _startTime = System.currentTimeMillis();
            _altitudes = new float[GRADE_INTERVAL];
            _horizontalDistances = new float[GRADE_INTERVAL];
            _messageString = new StringBuffer();
    
            btnGPSTest = new ButtonField("GPS Test", ButtonField.CONSUME_CLICK);
            btnGPSTest.setChangeListener(this);
            edStatus = new EditField( Field.NON_FOCUSABLE);
            edStatus.setText("retriving Longitude and Latitude.Please wait..");
            this.add(btnGPSTest);
            this.add(edStatus);
    
        }
    
         /**
         * Rounds off a given double to the provided number of decimal places.
         * @param d The double to round off.
         * @param decimal The number of decimal places to retain.
         * @return A double with the number of decimal places specified.
         */
        private static double round(double d, int decimal)
        {
            double powerOfTen = 1;
    
            while (decimal-- > 0)
            {
                powerOfTen *= 10.0;
            }
    
            double d1 = d * powerOfTen;
            int d1asint = (int)d1; // Clip the decimal portion away and cache the cast, this is a costly transformation.
            double d2 = d1 - d1asint; // Get the remainder of the double.
    
            // Is the remainder > 0.5? if so, round up, otherwise round down (lump in .5 with > case for simplicity).
            return ( d2 >= 0.5 ? (d1asint + 1)/powerOfTen : (d1asint)/powerOfTen);
        }
    
         /**
         * Invokes the Location API with the default criteria.
         *
         * @return True if the Location Provider was successfully started; false otherwise.
         */
        private boolean startLocationUpdate()
        {
            boolean retval = false;
    
            try
            {
                _locationProvider = LocationProvider.getInstance(null);
    
                if ( _locationProvider == null )
                {
                    // We would like to display a dialog box indicating that GPS isn't supported,
                    // but because the event-dispatcher thread hasn't been started yet, modal
                    // screens cannot be pushed onto the display stack.  So delay this operation
                    // until the event-dispatcher thread is running by asking it to invoke the
                    // following Runnable object as soon as it can.
                    Runnable showGpsUnsupportedDialog = new Runnable()
                    {
                        public void run() {
                            Dialog.alert("GPS is not supported on this platform, exiting...");
                            System.exit( 1 );
                        }
                    };
    
                    UiApplication.getApplication().invokeLater( showGpsUnsupportedDialog );  // Ask event-dispatcher thread to display dialog ASAP.
                }
                else
                {
                    // Only a single listener can be associated with a provider, and unsetting it
                    // involves the same call but with null, therefore, no need to cache the listener
                    // instance request an update every second.
                    _locationProvider.setLocationListener(new LocationListenerImpl(), _interval, 1, 1);
                    retval = true;
                }
            }
            catch (LocationException le)
            {
                System.err.println("Failed to instantiate the LocationProvider object, exiting...");
                System.err.println(le);
                System.exit(0);
            }
            return retval;
        }
          /**
         * Update the GUI with the data just received.
         */
        private void updateLocationScreen(final String msg)
        {
            UiApplication.getApplication().invokeLater(new Runnable()
            {
                public void run()
                {
                    System.out.println(msg.toString());
                    edStatus.setText(msg);
                    Dialog.alert(msg.toString());
                }
            });
        }
    
      public void fieldChanged(Field field, int context){
             if(field.equals(btnGPSTest)){
                startLocationUpdate();
             }
    
         }
        /** Standard Escape-key handler */
        public boolean keyChar(char key, int status, int time) {
            boolean retval = false;
            switch (key) {
                case Characters.ESCAPE:
                   // UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
                    break;
                default:
                    retval = super.keyChar(key, status, time);
            }
            return retval;
        }
    
         /**
         * Implementation of the LocationListener interface.
         */
        private class LocationListenerImpl implements LocationListener
        {
            // Members ----------------------------------------------------------------------------------------------
            private int captureCount;
            private int sendCount;
    
            // Methods ----------------------------------------------------------------------------------------------
            /**
             * @see javax.microedition.location.LocationListener#locationUpdated(LocationProvider,Location)
             */
            public void locationUpdated(LocationProvider provider, Location location)
            {
                try{
                    if(location.isValid())
                    {
                        float heading = location.getCourse();
                        double longitude = location.getQualifiedCoordinates().getLongitude();
                        double latitude = location.getQualifiedCoordinates().getLatitude();
                        float altitude = location.getQualifiedCoordinates().getAltitude();
                        float speed = location.getSpeed();                
    
                        // Horizontal distance to send to server.
                        float horizontalDistance = speed * _interval;
                        _horizontalDistance += horizontalDistance;
    
                        // Horizontal distance for this waypoint.
                        _wayHorizontalDistance += horizontalDistance;
    
                        // Distance over the current interval.
                        float totalDist = 0; 
    
                        // Moving average grade.
                        for(int i = 0; i < GRADE_INTERVAL - 1; ++i)
                        {
                            _altitudes[i] = _altitudes[i+1];
                            _horizontalDistances[i] = _horizontalDistances[i+1];
                            totalDist = totalDist + _horizontalDistances[i];
                        }
    
                        _altitudes[GRADE_INTERVAL-1] = altitude;
                        _horizontalDistances[GRADE_INTERVAL-1] = speed*_interval;
                        totalDist= totalDist + _horizontalDistances[GRADE_INTERVAL-1];
                        float grade = (totalDist==0.0F)? Float.NaN : ( (_altitudes[4] - _altitudes[0]) * 100/totalDist);
    
                        // Running total of the vertical distance gain.
                        float altGain = _altitudes[GRADE_INTERVAL-1] - _altitudes[GRADE_INTERVAL-2];
    
                        if (altGain > 0)
                        {
                            _verticalDistance = _verticalDistance + altGain;
                        }
    
                        captureCount += _interval;
    
                        // If we're mod zero then it's time to record this data.
                        captureCount %= CAPTURE_INTERVAL;
    
                        // Information to be sent to the server.
                        if ( captureCount == 0 )
                        {
                            // Minimize garbage creation by appending only character primitives, no extra String objects created that way.
                            _messageString.append(round(longitude,4));
                            _messageString.append(';');
                            _messageString.append(round(latitude,4));
                            _messageString.append(';');
                            _messageString.append(round(altitude,2));
                            _messageString.append(';');
                            _messageString.append(_horizontalDistance);
                            _messageString.append(';');
                            _messageString.append(round(speed,2));
                            _messageString.append(';');
                            _messageString.append(System.currentTimeMillis());
                            _messageString.append(':');
                            sendCount += CAPTURE_INTERVAL;
                            _horizontalDistance = 0;
                        }
    
                        // If we're mod zero then it's time to send.
                        sendCount %= SENDING_INTERVAL;
    
                        synchronized(this)
                        {
                            if (sendCount == 0 && _messageString.length() != 0)
                            {
                            //  _serverConnectThread.sendUpdate(_messageString.toString());
                                _messageString.setLength(0);
                            }
                        }
    
                        // Information to be displayed on the device.
                        StringBuffer sb = new StringBuffer();
                        sb.append("Longitude: ");
                        sb.append(longitude);
                        sb.append("\n");
                        sb.append("Latitude: ");
                        sb.append(latitude);
                        sb.append("\n");
                        sb.append("Altitude: ");
                        sb.append(altitude);
                        sb.append(" m");
                        sb.append("\n");
                        sb.append("Heading relative to true north: ");
                        sb.append(heading);
                        sb.append("\n");
                        sb.append("Speed : ");
                        sb.append(speed);
                        sb.append(" m/s");
                        sb.append("\n");
                        sb.append("Grade : ");
                        if(Float.isNaN(grade))sb.append(" Not available");
                        else sb.append(grade+" %");
                        GPSDemoScreen.this.updateLocationScreen(sb.toString());
                    }
                }catch(Exception ex){
                    System.out.println(ex.toString());
                    ex.printStackTrace();
                }
            }
    
            public void providerStateChanged(LocationProvider provider, int newState)
            {
                // Not implemented.
            }
        }
    }
    

    It works fine now, when I tried door.

  • Table of functions and direct requests for NUMBER data types database

    Hello. I call a number of functions table of our Enterprise BI server, and I chose to do this by using direct database requests (I believe you can also call functions table in the physical layer of the repository, but is not what I do). The problem is that whenever I go back any number of the table function which is not a whole number (1.23, for example), BI assigns the INTEGER data type to the field rather than the data type DOUBLE, rounded so my number to the nearest integer. Here is a short example:

    Create these 3 database objects:

    CREATE or REPLACE TYPE my_row AS OBJECT (my_num NUMBER);

    CREATE or REPLACE TYPE my_tab AS TABLE OF THE my_row;

    FUNCTION to CREATE or REPLACE my_table_function RETURN my_tab
    PIPELINED IS
    BEGIN
    PIPE ROW (my_row (1.23));
    END;
    /


    Make this your request at your request Direct to database:

    SELECT my_num FROM table (my_table_function);


    This query returns correctly '1.23' when it is called from the database. In BI, on the other hand, it returns a value of '1' (and the field of labels an INTEGER rather than data type DOUBLE). If at the request of data Direct you change column properties-> data-> decimal from 0 to 2 Format, then it displays is not surprising "1.00". I then tried to change MY_ROW. Data type of MY_NUM by explicitly specifying the precision and no luck. BI still labels this field as an INTEGER. Then I started to try to deceive BI massaging the SQL statement itself. None of the following worked:

    SELECT to_number (my_num) as my_num2 FROM table (my_table_function);
    SELECT my_num2 + 0.01 as my_num3 FROM (SELECT my_num - 0.01 AS my_num2 FROM table (my_table_function));
    SELECT to_number (to_char (my_num)) as my_num2 FROM table (my_table_function);
    SELECT to_number (substr (to_char ('x' | my_num), 2)) as my_num2 FROM table (my_table_function);

    Now, I found a solution, but I'm surprised that I have to resort to that:

    SELECT * FROM (SELECT / * + NO_MERGE * / table my_num (my_table_function));

    Is anyone out there knows a better way to do it? The above is a hack in my opinion. :)

    Thanks in advance for any input.

    -Jim

    Yes, it's really amazing.
    But I got it.

    CREATE OR REPLACE TYPE my_row AS OBJECT (my_num NUMBER(10,2));
    

    and in your SQL:

    SELECT cast(my_num as double precision) as my_num2 FROM table(my_table_function);
    

    I have the good result and I see the numbers after the decimal point.
    Very delicate!

    Published by: gerardnico on July 7, 2009 14:55 change number (10.2) in double precision... pffff

  • Operating logic

    SQL > select round(15.923,-1), round(15.923,-2), (155.923, -2) round of double;

    ROUND(15.923,-1) ROUND(15.923,-2) ROUND (155.923, 2)
    ---------------- ---------------- -----------------
    20 0 200

    Round - rounds to the left of the decimal.

    What is the logic?

    What is your question here?
    Want to know how the results came?

    ROUND (15.923, -1)--> 20
    It's something like this-> 10 * round(15.923/10)--> 10 * round (1.5923)--> 10 * 2.0--> 20

    (15.923, -2) ROUND--> 0
    100 * round(15.923/100)--> 100 * (0.15923) round--> 100 8 0--> 0

    ROUND (155.923, -2)--> 200
    100 * round(115.923/100)--> 100 * round (1.15)--> 100 * 2--> 200

    By
    VAMSi

  • Decimal rounding everything by creating a double when constant digital VI Scripting

    Hi guys,.

    First post here, so please excuse any misstep. I'm using LabVIEW Professional Development System 2013 SP1 on a Windows 7 computer; I'm kinda new to LabVIEW, but have a good background in other programming languages. I recently stumbled on VI Scripting and have been playing with it. As the title says, I had a hard time creating decimal numeric constants whose values are not rounded. It seems to me that when I pass the double (42.1) to the property node, it somehow gets cast in full. I tried to adjust the value of AdaptToEnteredData to true, but I think it doesn't affect the digital object in the newly created VI (output). It seems that the problem is how pass the numerical value for the property node in the original VI, but I don't really know how else to do in addition to the way I presented.

    Please let me know if there is any other necessary information and thank you for your help!

    Sebastian

    Property nodes run from the top down. Move the representation above the Value property property.

    Lynn

  • Round the question in Double chain

    Hi all

    I am facing a weird problem in rounded to a value of type double. I thought that LabVIEW always rounds up this rule when the digit is truncated is 5 - round to the nearest even integer number offshore

    When I round up to two points of accuracy, I get results.

    489.335-> 489.33

    489.355-> 489.36

    Can someone tell me how rounding works in the above cases? Please find the sample VI (2010) attached, if you want to play with him.

    Thank you

    Knockaert


  • Rounding to 2 decimal places Double

    Can someone tell me please how to round a double when dealing with Blackberry Java?

    Here's my double:

    Double coneTypeRFAnswer = pi * (BinRadius * BinRadius) * BinHeight;

    Normally I would just do this:

    NumberFormat formatDouble = new DecimalFormat("###,###,###,###.##");

    formatDouble (coneTypeRFAnswer);

    Thanks for the help!  This first fight with Blackberry has certainly been a challenge!

    You can use the trainer in number like that.

    String s = new trainer () .formatNumber (number, decimal numbers);

  • Rounding time - doubling output results

    I hope someone can take a look at my request and easily tell me why he multiplies the results in my DURATION_MIN_AM column. It seems to be evolving date stamps / hour that I need (rounded up to the nearest 30 minutes). Is there something easily identifiable in my application that I don't see? I've been watching him for a while now and its not obvious to me at all...

    WITH got_period_num

    AS (SELECT

    FLOOR ((stop_ts-DATE ' 2014-01-01') * 24 * 2) AS period_num,

    DURATION_MIN_AM,

    B.EXCEPTION_DS,

    c.MU_ID,

    start_ts,

    stop_ts

    Of

    LIGHTHOUSE. IEX_AGT_ACT_DETAIL HAS

    JOIN THE LIGHTHOUSE. IEX_EXCEPTION_DIM B

    ON A.EXCEPTION_KEY = B.EXCEPTION_KEY

    JOIN the left HEADLIGHT. IEX_AGT_ADHERENCE_ATTR C ON A.EMP_KEY = C.EMP_KEY - modified knuckles

    WHERE

    A.ACTIVITY_DT BETWEEN TO_DATE)

    January 24, 2014 00:00:00 ',

    "MM/DD/YYYY hh24:mi:ss")

    AND TO_DATE)

    January 24, 2014 00:00:00 ',

    "MM/DD/YYYY hh24:mi:ss") AND

    C.ACTIVITY_DT BETWEEN TO_DATE (24 JANUARY 2014 00:00:00 ',)

    "MM/DD/YYYY hh24:mi:ss")

    AND TO_DATE (24 JANUARY 2014 00:00:00 ',)

    "MM/DD/YYYY hh24:mi:ss") AND

    c.MU_ID IN

    ('220'))

    SELECT

    TO_CHAR)

    DATE ' 2014-01-01' + (period_num / (24 * 2));

    "FMMM/JJ/AAAA HH:fmMI:SS AM")

    AS start_ts,

    TO_CHAR)

    DATE ' 2014-01-01' + ((period_num + 1) / (24 * 2));

    "FMMM/JJ/AAAA HH:fmMI:SS AM")

    AS stop_ts,

    SUM (DURATION_MIN_AM) AS DURATION_MIN_AM,

    EXCEPTION_DS,

    MU_ID

    Of

    got_period_num

    GROUP BY

    period_num,

    EXCEPTION_DS,

    MU_ID

    ORDER BY

    start_ts

    CREATE TABLE LIGHTHOUSE. () IEX_ACT_DETAIL
    NUMBER OF EMP_KEY
    NUMBER OF EXCEPTION_KEY

    ACTIVITY_DT

    VARCHAR2 (5)
    START_TS VARCHAR2 (5).
    STOP_TS VARCHAR2 (5).
    NUMBER OF DURATION_MIN_AM)

    CREATE TABLE LIGHTHOUSE. () IEX_EXCEPTION_DIM
    EXCEPTION_DS VARCHAR2 (100),
    NUMBER OF EXCEPTION_KEY)

    CREATE TABLE LIGHTHOUSE. () IEX_AGT_ADHERENCE_ATTR
    NUMBER OF MU_ID
    NUMBER OF EMP_KEY)


    INSERT IN THE LIGHTHOUSE. IEX_AGT_ACT_DETAIL (EMP_KEY, EXCEPTION_KEY, ACTIVITY_DT, START_ST, STOP_TS, DURATION_MIN_AM) VALUES (886, 000, ' 03 /' 02/2014, 3/2/2014 11:24 ', ' 03/02/2014 11:30 ', 6)
    INSERT IN THE LIGHTHOUSE. IEX_AGT_ACT_DETAIL (EMP_KEY, EXCEPTION_KEY, ACTIVITY_DT, START_ST, STOP_TS, DURATION_MIN_AM) VALUES (886, 000, ' 03 /' 02/2014, 3/2/2014 11:27 ', 03/02/2014 11:31 ', 4)
    INSERT IN THE LIGHTHOUSE. IEX_AGT_ACT_DETAIL (EMP_KEY, EXCEPTION_KEY, ACTIVITY_DT, START_ST, STOP_TS, DURATION_MIN_AM) VALUES (886, 000,' 03 /' 02/2014, 3/2/2014 10:02 ', 03/02/2014 10:17 ', 15)
    INSERT IN THE LIGHTHOUSE. IEX_AGT_ACT_DETAIL (EMP_KEY, EXCEPTION_KEY, ACTIVITY_DT, START_ST, STOP_TS, DURATION_MIN_AM) VALUES (886, 001, ' 03 /' 02/2014, 3/2/2014 23:24 ', 03/02/2014 23:38 ', 4)
    INSERT IN THE LIGHTHOUSE. IEX_AGT_ACT_DETAIL (EMP_KEY, EXCEPTION_KEY, ACTIVITY_DT, START_ST, STOP_TS, DURATION_MIN_AM) VALUES (886, 001, ' 03 /' 02/2014, 3/2/2014 21:24 ', 03/02/2014 21:38 ', 14)


    INSERT IN THE LIGHTHOUSE. IEX_EXCEPTION_DIM (EXCEPTION_DS, EXCEPTION_KEY) VALUES (' 6', 000)
    INSERT IN THE LIGHTHOUSE. IEX_EXCEPTION_DIM (EXCEPTION_DS, EXCEPTION_KEY) VALUES ('OPEN', 001)


    INSERT IN THE LIGHTHOUSE. IEX_AGT_ADHERENCE_ATTR (MU_ID, EMP_KEY) VALUES (220, 886)

    START_TS STOP_DS DURATION_MIN_AM EXCEPTION_DS MU_ID
    03/02/2014 11:00 03/02/2014 11:30 10 TO THE 6 220
    03/02/2014-10:00 03/02/2014-15 10:30 6 220
    03/02/2014 23:00 03/02/2014 23:30 4 220 OPEN
    03/02/2014 21:00 03/02/2014 21:30 14 OPEN 220

    Hello

    I don't know the query you posted is relevant to this problem.

    It seems that this query is designed for a 1-to-many relationship between the lines in

    iex_agt_detail and buckets, in other words, each line blongs to exactly 1 bucket Apaprantly, in this problem, the relationship is much to may, in other words, a single line of the table may be part of several compartments.

    He gets the desired results according to the given sample data:

    WITH date_range AS

    (

    SELECT TO_DATE (3 February 2014 00:00 '-the first time to include)

    , "MM/DD/YYYY HH24.

    ) AS first_dt

    , TO_DATE (5 February 2014 00:00 '-first time to exclude)

    , "MM/DD/YYYY HH24.

    ) AS last_dt

    OF the double

    )

    all_periods AS

    (

    SELECT first_dt + ((LEVEL - 1)

    / (24 * 2)

    ) AS this_start_dt

    first_dt + (LEVEL

    / (24 * 2)

    ) AS next_start_dt

    OF date_range

    CONNECT BY LEVEL<= (last_dt="" -="" first_dt)="" *="" 24="" *="">

    )

    SELECT aaa.mu_id

    TO_CHAR (ap.this_start_dt

    , "FMMM/JJ/AAAA fmHH:MI AM.

    ) AS start_ts

    TO_CHAR (ap.next_start_dt

    , "FMMM/JJ/AAAA fmHH:MI AM.

    ) AS stop_ts

    ed.exception_ds

    , ad.duration_min_am - or SUM (...) if necessary

    * LESS (ad.stop_ts (ap.next_start_dt)

    -Most GREAT (ad.start_ts, ap.this_start_dt)

    )

    / (ad.stop_ts

    -ad.start_ts

    ) AS duartion_min_am

    Of all_periods ap

    JOIN iex_agt_detail ad WE ad.start_ts< ap.next_start_dt="">

    AND ad.stop_ts > ap.this_start_dt

    AND ad.activity_dt = TRUNC (ap.this_start_dt) - if necessary

    JOIN iex_agt_adherence_attr aaa ON aaa.emp_key = ad.emp_key - or LEFT OUTER JOIN, if necessary

    JOIN iex_exception_dim ON ed.exception_key = ad.exception_key ed

    WHERE aaa.mu_id IN (220)

    -GROUP BY--if necessary

    ORDER BY ed.exception_ds

    ;

    I guess just to many of your needs.  For example, it is unclear if you need a GROUP BY; It looks like all the ranks of the production comes from only 1 rank of iex_agt_detail (and other tables to which it is attached).  Simply GROUP IN if an output line can be 2 or more rows in the table.

    This solution starts by creating a "picture" of all possible buckets: all_periods contains 1 row for each half-hour period which can be a defined result.  (Since it is inner join to iex_agt_detail thereafter, only buckets that actually have some data are included in the final output).

  • How to auto-off rounded af:inputText liaison with the data type Double?

    Hello Experts,

    If a component af:inputText is bind with a field whose data type is Double I saw if I enter 12.0 in the text field, and then it changes automatically to 12. Another example: 12,010 turns into 12.01.

    My requirement is to maintain the value that it has been seized. But the validation client side of the field, that ADF provides by default, should be present. I mean that ADF throws the error message if I get 12a.01; as it is not a Double.

    How can I achieve this?

    Any pointer would be vary useful.

    JDeveloper version: 11.1.1.6.0

    No, what I mean is that if you keep the zeros on the right, the data type is not a Double.

    Once you save 12.010 and read it again, you will see zero residue. You would see only the zero if you or the other say the number still show for example 3 fraction digits or if you store the value as a string that will store the entry as is and use a regular expression validator to ensure that only valid numbers are entered.

    In the first case ever number has 3 digits of fraction for example 12-> 12.000 and 12.010-> 12.010

    In summary, you will need to decide which way to go. If the data type must be Double, then there is no zero leakage or you must use the minFractionDigits which will always use the zero leak until the number of spezified. If the does not like what you have to store strings.

    Timo

  • Digital indicator rounded to the nearest whole number

    I have a digital indicator for a 2D double table, and when I play with the display Format in the properties of the indicator, I can adjust to show the 3 digits of precision. However on the indicator, I find myself just get something like 1548.000. However, it did not make sense to me that this number would not have some amount of non zero decimal places, and when I probe the wire table 2d, enter the flag during the race, I can see that the number should actually be something like 1548.315... Is there a rounding adjustment when I checked that I can't find? (The indicator is set to U16) Any help would be greatly appreciated.

    Colin

    Of course I answered my own question as soon as I post. I realized that I wrote that the indicator is U16 that that was my problem, change to the dual representation to be fixed. Sorry for this pointless topic.

  • rounded values in chart

    I have a multiplot xy graph with as input a range of x values and the values y of 5.8 to 6 which are doubles.

    However, once the graphic display all values there are rounded to 6.

    I guess it must be a matter of setting somewhere that the values in the chart are not integers, but I can't find it there.

    I have already changed in the graphics settings-> format and precision-> digits of precision for 8, but I still get rounded up to 6?

    Where is the magical setting for this?

    Figure autoadjusts for the type of data connected directly on it. If connect you to a local variable, you do not get this feature for good reasons.

    Most likely, you had a whole one wired to Terminal curve at some point in the past and LabVIEW who remembered.

    The first choice should always be connect directly to the Terminal. Do not think that local variables and the 'variables' in the code of the text, they are not and should not be used as such. Local variables break the flow of data, can cause race conditions, complicate debugging and force copies of additional data in memory (can be very expensive for xy charts!), so there is a big difference. Local variables should be used if there is a very good reason.

    (See also this link and many other similar discussions)

Maybe you are looking for