To remove decimal places and round

hi all ,
select       (sum(case when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) <> upper('Top')) then
            (((((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD)*94)/2000)   )
             when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) = upper('Top')) then
         (   ((nvl(H.CLASS_V_CEMENT,0)*94)/2000)   ) 
        when F.ITEM_UOM =  'Pound' then
      CEIL(  ROUND((((((H.SLURRY_VOL_ACTUAL * 5.6146)/DECODE(H.SLURRY_YIELD,0,NULL,H.SLURRY_YIELD)))*94)*F.ITEM_PERCENT/100)))/2000
       end)*(j.opn_value/2))  SUM_MAT_ACT_TON ,--------transport
                   sum(case when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) <> upper('Top')) then
            ((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD)
      when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) = upper('Top')) then
            nvl(H.CLASS_V_CEMENT,0)
        when F.ITEM_UOM =  'Pound' then
            ROUND(((ROUND(((H.SLURRY_VOL_ACTUAL * 5.6146)/DECODE(H.SLURRY_YIELD,0,NULL,H.SLURRY_YIELD)))*94)*F.ITEM_PERCENT/100 )/P.ATTRIBUTE5)
   end) SUM_sload ,    ----sload
   sum(case when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) <> upper('Top')) then
            ((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD)
     -- when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) = upper('Top')) then
          --  nvl(H.CLASS_V_CEMENT,0)
        when F.ITEM_UOM =  'Pound'  and F.BLEND <> 'PH'then
            ROUND(((ROUND(((H.SLURRY_VOL_ACTUAL * 5.6146)/DECODE(H.SLURRY_YIELD,0,NULL,H.SLURRY_YIELD)))*94)*F.ITEM_PERCENT/100 )/P.ATTRIBUTE5)
   end) BLENDING
  ,e.opn_job_desc
     FROM xxnp_opn_joblog_001 E,
          XXNP_OPN_JOBLOG_EST_002   F,
          XXNP_OPN_JOBLOG_STAGE_002 G,
          XXNP_OPN_JOBLOG_SLURRY_003 H,
    XXNP_OPN_JOBLOG_RES_005 J,
     MTL_SYSTEM_ITEMS_B P
      WHERE E.OPN_JOB_DESC   = 'K/D/SP158/SA399/1338/D/0510/1' AND
        E.MANUAL='N'
   and J.opn_resource_desc='4X4  PICK-UP OR LIGHT VEHICLES'
    AND E.OPN_JOBLOG_001_ID = J.OPN_JOBLOG_001_ID
     and F.INVENTORY_ITEM_ID=P.INVENTORY_ITEM_ID
       AND p.ORGANIZATION_ID='103'
      AND E.OPN_JOBLOG_001_ID = G.OPN_JOBLOG_001_ID
        AND G.OPN_JOBLOG_006_ID = H.OPN_JOBLOG_006_ID
        AND H.OPN_JOBLOG_007_ID = F.OPN_JOBLOG_007_ID
        AND G.OPN_JOBLOG_006_ID = H.OPN_JOBLOG_006_ID
        AND H.OPN_JOBLOG_007_ID = F.OPN_JOBLOG_007_ID
                                GROUP BY E.OPN_JOB_DESC,j.opn_value
o/p  i am getting
SUM_MAT_ACT_TON      SUM_SLOAD                         BLENDING                                   OPN_JOB_DESC
11587.7954154787         1957.62401925833               1454.62401925833                       K/D/SP158/SA399/1338/D/0510/1
well can anyone guide me on  obtaining the following output (to remove decimal places and round )
SUM_MAT_ACT_TON      SUM_SLOAD                         BLENDING                                   OPN_JOB_DESC
11588                           1958                                      1455                                          K/D/SP158/SA399/1338/D/0510/1thanking in advance
Edited by: makdutakdu on May 25, 2010 12:48 PM

select      round( (sum(case when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3))  upper('Top')) then
            (((((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD)*94)/2000)   )
             when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) = upper('Top')) then
         (   ((nvl(H.CLASS_V_CEMENT,0)*94)/2000)   ) 
        when F.ITEM_UOM =  'Pound' then
      CEIL(  ROUND((((((H.SLURRY_VOL_ACTUAL * 5.6146)/DECODE(H.SLURRY_YIELD,0,NULL,H.SLURRY_YIELD)))*94)*F.ITEM_PERCENT/100)))/2000
       end)*(j.opn_value/2)))  SUM_MAT_ACT_TON ,--------transport
                   round(sum(case when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3))  upper('Top')) then
            ((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD)
      when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) = upper('Top')) then
            nvl(H.CLASS_V_CEMENT,0)
        when F.ITEM_UOM =  'Pound' then
            ROUND(((ROUND(((H.SLURRY_VOL_ACTUAL * 5.6146)/DECODE(H.SLURRY_YIELD,0,NULL,H.SLURRY_YIELD)))*94)*F.ITEM_PERCENT/100 )/P.ATTRIBUTE5)
   end)) SUM_sload ,    ----sload
   round(sum(case when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3))  upper('Top')) then
            ((H.SLURRY_VOL_ACTUAL * 5.6146)/H.SLURRY_YIELD)
     -- when (F.ITEM_UOM = 'Cubic Feet' and upper(substr(H.SLURRY_TYPE,1,3)) = upper('Top')) then
          --  nvl(H.CLASS_V_CEMENT,0)
        when F.ITEM_UOM =  'Pound'  and F.BLEND  'PH'then
            ROUND(((ROUND(((H.SLURRY_VOL_ACTUAL * 5.6146)/DECODE(H.SLURRY_YIELD,0,NULL,H.SLURRY_YIELD)))*94)*F.ITEM_PERCENT/100 )/P.ATTRIBUTE5)
   end)) BLENDING,
   e.opn_job_desc
     FROM xxnp_opn_joblog_001 E,
          XXNP_OPN_JOBLOG_EST_002   F,
          XXNP_OPN_JOBLOG_STAGE_002 G,
          XXNP_OPN_JOBLOG_SLURRY_003 H,
    XXNP_OPN_JOBLOG_RES_005 J,
     MTL_SYSTEM_ITEMS_B P
      WHERE E.OPN_JOB_DESC   = E.OPN_JOB_DESC  AND
        E.MANUAL='N'
   and J.opn_resource_desc='4X4  PICK-UP OR LIGHT VEHICLES'
    AND E.OPN_JOBLOG_001_ID = J.OPN_JOBLOG_001_ID
     and F.INVENTORY_ITEM_ID=P.INVENTORY_ITEM_ID
       AND p.ORGANIZATION_ID='103'
      AND E.OPN_JOBLOG_001_ID = G.OPN_JOBLOG_001_ID
        AND G.OPN_JOBLOG_006_ID = H.OPN_JOBLOG_006_ID
        AND H.OPN_JOBLOG_007_ID = F.OPN_JOBLOG_007_ID
        AND G.OPN_JOBLOG_006_ID = H.OPN_JOBLOG_006_ID
        AND H.OPN_JOBLOG_007_ID = F.OPN_JOBLOG_007_ID
                                GROUP BY E.OPN_JOB_DESC,j.opn_value

Similar Messages

  • Limit a float value to single decimal place after round off

    41.231445 is float value . How can I limit this to a single decimal place after round off?
    ie; 41.2
    Any help in this regard will be well appreciated with dukes.
    Regards,
    Anees

    Also read this: [http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html]

  • Rounding off float to 2 decimal places and returning the float

    I tried doing bigdecimal but it doesnt work. :
    BigDecimal bd = new BigDecimal(5 * 0.0394);
              retval = bd.floatValue();
              System.out.printf(" th %f\n",retval);
    I see 0.197000. I know that there are 6 places since I didnt do %.2f. However its not the printf thats important . The float I want to return must be rounded off to two decimal places.
    Thanks in advance for the help,
    sb

    Use BigDecimal.round( MathContext mc ), where the MathContext object is set to a precision value of 3;
    BigDecimal roundedBigD = myOriginalBigD.round( new MathContext( 3 ) );� {�                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problems with decimal places and formatting

    Hi , we are having problems with an add on running on different localization companies. Decimal places separatd by "," differ from other localizations. We dont know if this is a SQL collation setting or somethng related to code or requirements to run add ons on different servers and languages.
    Any ideas??
    Thanks

    Hello
    Follow up with this thread:
    [Re: How to get the numeric value of DocTotal from UI API]
    Regards,
    J.

  • Removing Decimal Places from Graph labels

    One axis on my graph is showing decimal places despiting formatting the report field to show 0 places - the graph is reading decimal places directly from the database underneath the report .  Other than editing each axis label manual (or editing the original database field) does anyone know of another way I can elimate the decimal places from the graph?

    That solution only works for the x-axis but not the y-axis (or the other way round, depending on whether the chart is horizontal or vertical).
    The values of the y-Axis are formatted according to the default Number Formatting. If you can afford this, change the default number formatting to 0 decimal places.
    Another workaround would be to create a formula. Let's say amount was your database field. Then the formula would be
    ToText({AMOUNT},0)
    Put that in your chart instead of the original database field.
    Cheers,
    Florian

  • Double value truncated to two decimal places without rounding the value.

    I want to truncate double value to two decimal places without doing the rounding of the value.
    Is there any method which can directly do the truncation.

    There's many ways to achieve this such as using
    BigDecimal's setScale method or type-casting. This is
    the way I like to do it:double d = -5.239;
    d = d > 0 ? Math.floor(d * 100) / 100.0 : Math.ceil(d
    * 100) / 100.0;
    Your division by 100 may cause an rounding error, because there are numbers which no finite binary representation. That's splitting hairs! I know ;-)

  • Remove decimal places

    I am using Report Builder 9i. I have an horizontal bar with the values being displayed next to the bars.
    The first value is 1.000, second value 58.00, third value is 533.0. How can I change the format so no decimal places are displayed.
    Thanks
    Brendon

    But it is not working dear..... Check ma XML code
    See this coding I have to remoce the decimals from this...how can i do that...plz help me....
    &lt;rw:graph id="CT_1" src="G_COMP_CODE" groups="DEPTCODE" dataValues="Department"&gt;
    &lt;!--
    &lt;?xml version="1.0" ?&gt;
    &lt;Graph version="2.5.0.5" depthAngle="0" pieDepth="0" pieTilt="0"&gt;
    &lt;DataviewFootnote foreground="#0" background="#ffffff"/&gt;
    &lt;DataviewSubtitle foreground="#0" background="#ffffff"/&gt;
    &lt;DataviewTitle foreground="#0" background="#ffffff"/&gt;
    &lt;MarkerText visible="true"/&gt;
    &lt;O1Axis lineWidth="1"/&gt;
    &lt;O1MajorTick visible="false" lineWidth="1"/&gt;
    &lt;O1Title textRotation="TR_HORIZ_ROTATE_90"/&gt;
    &lt;PieFrame fillTransparent="false"/&gt;
    &lt;SeriesItems&gt;
    &lt;Series id="0" color="#99ccff"/&gt;
    &lt;/SeriesItems&gt;
    &lt;X1Axis lineWidth="1"/&gt;
    &lt;Y1Axis lineWidth="1" axisMinAutoScaled="false" axisMinValue="0.0" axisMaxAutoScaled="false" axisMaxValue="400.0" majorTickStepAutomatic="false" majorTickStep="50.0"/&gt;
    &lt;Y1MajorTick visible="false" lineWidth="1"/&gt;
    &lt;Y1Title visible="true"/&gt;
    &lt;Y2Axis lineWidth="1"/&gt;
    &lt;Y2MajorTick visible="false" lineWidth="1"/&gt;
    &lt;/Graph&gt;
    --&gt;
    &lt;/rw:graph&gt;
    -----

  • Formatting amount to 2 decimal places without rounding the value

    Hi 
    My requirement is to format the amount field, when I am using the simple type and setting the format as ###,##0.00 then it is rounding off the value.  Foe example say the amount is 3,567.236 in this case it rounds it off to 3,567.24 which I do not want we want the value to display as 3,567.23.  Does anyone have any idea how this can be achieved.
    Thank you
    Regards,
    Preet

    Use the following :
    BigDecimal bigDecimalh = new  BigDecimal("22.335642");
              bigDecimalh = bigDecimalh.setScale(2, BigDecimal.ROUND_DOWN);
    Regards,
    Himanshu

  • Decimal definition and rounding

    Hello
    My customer is not allowed to have decimals on his marketing documents unless it's a USD or JPY currency. For those 2 currencies he need 2 decimals.
    On General settings >> Display he set the following:
    Amount: 0
    Price: 6
    On Currency definition he set JPY+USD to 2 digits and no rounding.
    He wants to sell a USD customer and item which its price is 10.2240 USD. He cannot type such price even though his price settings are set to 6, since the price currency is USD which is set to 2.....
    If he sets the USD currency to 4 decimals, his document total will show 4 decimals and not 2...
    He can set the layout to show 2 decimals but then the JE will show different amount than the layout....
    Does anyone have any idea how to define such requirement?
    Thanks
    Revital

    Hello Revital,
    There are no options to meet all your customer's needs. They have to decide which way to go. Either 2 decimals or more decimals. Currency setting will always override other settings.
    Thanks,
    Gordon

  • Formatting currencies and decimal places

    I'm currently using NumberFormat.getCurrencyInstance() to format numbers as currency. However, one problem I'm having is that I'd like values with no cents to be formatted with no decimal places, and any values with cents to be formatted with the usual 2 decimal places. For example:
    17 would be formatted as $17
    17.45 would be formatted as $17.45
    17.4 would be formatted as $17.40
    The last one is the tricky part--I've tried formatter.setMinimumFractionDigits(0), and this works great for the first two cases. But for the last case, the number gets formatted as $17.4.
    Basically my problem is I want a number to be formatted with zero or two decimal places and nothing in between. Is there an easy way to do this?
    Thanks in advance.

    Otherwise you are likely to find that you are getting .00 due to errors from previous calculations. You are right. Adjusted it to Locale aware
    import java.text.FieldPosition;
    import java.text.NumberFormat;
    import java.text.ParseException;
    import java.text.ParsePosition;
    import java.util.Locale;
    public class SpecialCurrencyFormat extends NumberFormat {
        private static final long serialVersionUID = 1L;
        private final NumberFormat noDecimals;
        private final NumberFormat decimals;
        private final double maxDifference;
        private final double factor;
        public SpecialCurrencyFormat() {
         this(Locale.getDefault());
        public SpecialCurrencyFormat(Locale locale) {
         decimals = NumberFormat.getCurrencyInstance(locale);
         noDecimals = NumberFormat.getCurrencyInstance(locale);
         noDecimals.setMaximumFractionDigits(0);
         maxDifference = Math.pow(10, -decimals.getMaximumFractionDigits()) * .5;
         factor = Math.pow(10, decimals.getMaximumFractionDigits());
        @Override
        public StringBuffer format(double number, StringBuffer toAppendTo,
             FieldPosition pos) {
         double adjustedValue = (Math.round(number * factor)) / factor;
         if ((Math.abs(number - Math.round(number)) < maxDifference)) {
             return noDecimals.format(adjustedValue, toAppendTo, pos);
         } else {
             return decimals.format(adjustedValue, toAppendTo, pos);
        @Override
        public StringBuffer format(long number, StringBuffer toAppendTo,
             FieldPosition pos) {
         return noDecimals.format(number, toAppendTo, pos);
        @Override
        public Number parse(String source, ParsePosition parsePosition) {
         return decimals.parse(source, parsePosition);
        public static void main(String[] args) {
         NumberFormat nf = new SpecialCurrencyFormat(Locale.US);
         double[] values = { 10000, 1000, 100, 10, 1, 10.1, 10.01, 10.001,
              10.002, 10.003, 10.004, 10.005, 10.006, 10.007, 10.008, 10.009,
              10.010 };
         for (double value : values) {
             print(nf, value);
        private static void print(NumberFormat nf, double number) {
         String formatted = nf.format(number);
         try {
             System.out.println(number + "\tas " + formatted + "\tand back "
                  + nf.parse(formatted));
         } catch (ParseException e) {
             e.printStackTrace();
    }The value adjustedValue is needed since NumberFormat doesn't seem to round the value. It just breaks.
    Piet

  • Rounding to 1 decimal place.

    Hello again.
    I have a method called "findTheAverage" which takes in an array of integers as a parameter and then calculates and returns the average as a float.
    What I want to do now though is create another method called "roundTheAverage" which takes in the float average variable from the previous method, rounds it to one decimal place, and then returns it as a float called roundedAverage.
    Could anybody help me in achieving this?
    Thanks.

    I'm fairly new to Java, hi.
    Oh I know all about you.
    I'm trying to write a method which takes in a float
    called "number" and then returns this float to two
    one decimal places called "roundedNumber".
    This is not the way this works. You have to write your own code.
    >
    Could you type me the code that I'd need to do this
    perhaps?
    Nope.
    It's a pretty simple problem I think, and it's
    wasting an enormous amount of time figuring it out.
    You are right on both counts. It is very simple and you are wasting alot of everyones time.
    >
    thanksAPI Application Programming Interface
    Javadoc API
    In context for this site means the documentation for the basic packages that make up the core Java API.
    I provided a link earlier to the Javadocs for java.text.DecimalFormat
    If you can't figure it out you need to HIRE A TUTOR.

  • FM to Round decimal place

    Hi Gurus,
    I want to reduce the number of decimal place by rounding off 2 decimal place.
    I am using 'HR_NZ_ROUNDING_DECIMALS' function module but its not working,
    kindly do the needful.
    Regards,
    Maithili

    Hi,
    Use Type cast method instead of finding FM.
    DATA : i type p decimals 4 VALUE '57846.5379'.
    DATA : j type p decimals 2.
    j = i.
    Write : / i.
    Write : / j.
    Regards,
    Velmurugan B

  • Decimal places in Smartforms

    Hi All,
    In smartforms, to control the number of decimal points in a field we can use the formatting option
    &symbol(.N)&
    for e.g.
    The EKPO-MENGE field contains the value 1234.56. The Dictionary definition specifies 3 decimal places and an output length of 17.
    &EKPO-MENGE(.1) -> 1,234.6
    &EKPO-MENGE&(.4) -> 1,234.5600
    &EKPO-MENGE&(.0) -> 1,235
    Can we use a variable instead to giving the number directly ?
    like
    data length type i .
      length = '1'.
    &EKPO-MENGE(.length) -> 1,234.6
    Will this approach work.
    Thanks,
    Mandeep

    Hi,
    remove quotes.
    length = 1.
    try it now.

  • Decimal places in database

    Hi all,
    Please can you make B1 do all calculations and store all data in the database to the maximum number of decimal places, and then let users pick to how many decimal places to view on screen?
    At the moment, if I only pick 2 decimal places, the database saves and calculates values to 2 decimal places, so in long marketing documents causes mis-pricing of things like tax/VAT.
    Current option is to set everything to 6 decimal places, and use round(xxx,2) in PLD, but this makes the user's B1 screen in marketing docs etc very very ugly
    Thanks
    Rajiv

    Hi there,
    Firstly, thank you for looking into this, it is appreciated. VAT is at 17.5%:
    Invoice contains:
    Item A x1
    Price 2.22
    VAT 0.3885 (4dp)
    VAT 0.39 (2dp)
    Item B x1, Item C x1, and Item D x1 - all like Item A
    In this scenario, VAT on Items A,B,C, and D.
    With 4 dp - 0.3885 x4 = 1.554 -> 1.55
    With 2 dp - 0.39 x 4 = 1.56 -> 1.56
    So there is a difference of one penny in this mock scenario.
    Hence, all calculations should be done and stored to the full 6dp within the database, however, the end user should be able to choose how many dp to view "on screen" as it were.
    Does this make things clearer?
    Rajiv

  • Decimal places for unit of measure

    Dear All ,
    If i change the Decimal Places for rounding in Customizing for Unit of measure ( CUNI tcode) for KG as 6 from 3 whether it will calculate with the 6 decimal places like 0.004756 ( earlier with 3 decimal places it will calculate any multiplication with 0.004 now i want the same with 0.004756 Kg )
    whether it will work ?
    and where it will impact

    Hi
    No it will not work like that. And it depend on the transaction where you enter that. In case of Purchase order quntity field it will be always with 2 decimal places because field MENGE has 2 decimal places only. If your system is already live then it is not advisible to do such changes.
    Regards
    Antony

Maybe you are looking for

  • ICal not syncing to iphone

    I'm creating notes in my iCal on my iMac. The changes show fine on my calendar in my .mac account. But the changes won't show ont the calendar on my iphone, even though I've selected to show the .mac calendars. Help!

  • Oracle Management Server could not be started while installing 12c

    Hello All, I'm trying to installing the Oracle 12cR2 on OEL6 32 bit over Oracle Virtual Box. The installation went smooth but at 79% of the installation, it throws me error as the OMS server is down and it could not be started. I tried to started the

  • White Screen of Death on iPhone 3GS

    My iPhone is stuck on white screen and i can't get rid of it. My power button is broken so I can't fix it that way and when i try to restore it back to factory settings it works for a few seconds and then goes back to white screen of death.

  • I'm getting this error: Service "iPod Service" could not be stopped

    Verify that you have sufficient privileges to stop system services." Does anyone know what that means? Dell   Windows 2000  

  • Mac OSX problems

    I can run the drJava tool to edit java files, but when i try to run the file get the error message: java.lang.NoSuchMethodany help is apreciated thank you