Rounding up a value to the nearest point

Hello, I have got alot further with my project now, but, I
want to be able to round up a result from a recordset to within two
decimal places. ie, the result displayed is 21.3456789, I would
like to get it 21.34 with a £ sign at the beginneing of it.
Here is my code.
Thanks in advance
Paul

swanside1 wrote:
> HGI and thanks for that. I put the code in, but for some
reason, I cant get it
> to work.
As has been said countless times in this forum, a basic
understanding of
code is essential to working with Dreamweaver. Without it,
you're left
going round in circles.
> $addcost is the recordset that calculates the main cost.
>
> <?php
> $addcost = $amount;
> echo '&pound;'.number_format($amount, 2);
> ?></p>
Your mistake here is the result of a common misunderstanding
of the
meaning of what the = sign is used for. Most people naturally
think back
to their school days, and think it means "is equal to". In
most
programming languages, like PHP, it means "is set to". So,
$addcost = $amount;
does not mean "$addcost and $amount" are the same, but
"$addcost is set
to $amount". To set $amount to the same value as $addcost,
you need to
do this:
$amount = $addcost;
However, even that won't solve your problem. You say that
$addcost is
the recordset. In other words, it contains lot of values.
What I gave you was a simple example of how number_format()
works. In my
example, $amount was set to 10.757999706268. Passing that
value to
number_format() in the way I showed changed its value to
10.76.
So, let's say the recordset field that you want to format
that way is
called $row_addcost['total'], you use number_format() like
this:
echo '&pound;'.number_format($row_addcost['total'], 2);
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

Similar Messages

  • Is there a way to obtain the text item's value when the mouse pointer at?

    Hi,
    Is there a way to obtain the text item's value when the mouse pointer at? Mouse pointer may be located somewhere out of current record and even out of current block.

    There is a when-mouse-over trigger and that works fine in client-server mode for Forms 5/6/6i, but that is less indicated when deployed using Application Server.
    In that trigger you may write whatever code is necessary, restricted package procedures.
    Still, I think, for your case, if you do not have to deal with a multi-record block, you should use the HINT property for that item and set_item_property with the HINT argument for that item in order to set the hint to the item's value - this should set_item_property should be called on the when-new-record-instance .

  • Any std funtion(s) for Zero-padded, 2 decimal value, without the deci point

    Hi,
    We want Zero-padded, two decimal value, without the decimal point. For example if it is 14.31, we need 001431.
    I have done "multiply" with 100 and "formatNumber" as '000000'
    SFIeld --> multiply * 100 --> formatNumber (000000) --> TField
    It works good for values with decimal like above 14.31, does it work for everything else too? I mean for 12 it is populating as 001200. Is this best approach? Is there any other std funtions or UDF sample available?
    Regards,
    N@v!n

    >
    N@v!n Kumar wrote:
    > Hi,
    >
    > We want Zero-padded, two decimal value, without the decimal point. For example if it is 14.31, we need 001431.
    > I have done "multiply" with 100 and "formatNumber" as '000000'
    >
    > SFIeld --> multiply * 100 --> formatNumber (000000) --> TField
    >
    > It works good for values with decimal like above 14.31, does it work for everything else too? I mean for 12 it is populating as 001200. Is this best approach? Is there any other std funtions or UDF sample available?
    >
    > Regards,
    > N@v!n
    public void convert_number(String[] FieldValue,ResultList result,Container container){
    FieldValue = FieldValue * 100;
    result.addValue(FieldValue);

  • Can you flip ruler values around the zero point in CS5?

    I prefer the zero point to be in the bottom left corner, but when I set the zero point at that location in CS5 all the Y values on the page are negitive.  Is there a way to flip the vertical ruler values so that the positive values fall on the document I am working on?  In CS 3 I don't have this problem, the values on the page remain positve when the point is at the top or bottom left.
    Thanks!

    Movement on a 2D plane (I'm assuming your robot is rolling around on the ground) takes three parameters to specify location and orientation, X, Y, and Heading.  Most mice are designed to give you X and Y, assuming that you maintain a constant heading.  I just tried turning my Logitech mouse, and noticed X and Y moved a lot -- that's because the sensor is eccentric in the mouse, so the rotation got "mapped" into X and Y, but not heading.
    You can solve this by using two mice and "doing the math" (may take some experimentation to get the proper constants) to map rotation into mice outputs.  Note that choosing the origin of your robot coordinate system (relative to the "origins" of the mice) is also important.
    Finally, the plot you want to make is probably not a "moving cursor" (since I don't know an easy way to make a cursor rotate) but a simple representation of your robot moving around on the screen.  Christian Altenbach recently answered a "math problem" Jeff Bohrer posted where he created such a display (maybe a week ago) -- give him credit for the design if you "borrow" it.
    Bob Schor

  • Rounding of a value to 2 decimal points.

    Hi all,
    I need to round off a value to 2 decimals.
    For example:
    A value 13.6789 should be rounded of to 13.67 and not 13.68

    Hi,
    Thats Truncation not rounding, for data types P and F we cannot have sub field access,
    so we cannot use offset, it leads to error results
    and if we use
    data : var type p decimals 2     they will be rounded hence  
    So, pass it to   a character variable
    and use write satement edition
    example
    data : var(7) type p decimals 4  value '13.6789 ' .
    write /  var.
    data : var1(8) type c.
    move var to var1.
    write /(5)  var1.
    regards
    prasanth

  • How to truncate the value to the nearest Integer

    Hi friends,
    am using
    select months_between(:to_date,:from_date) from dual which returns like
    12.8387096774194
    when I pass these parameters in to_date and from_date
    10/5/2011 15/4/2010
    now I want this value to be rounded off to 13
    and if the difference is like 0.2322
    it should give me 1
    if the difference is like 1.6 it should give me 2
    pls suggest a solution

    Looks like you want CEIL:
    SQL> with t as (
      2   select 12.838 n from dual union all
      3   select 0.2322 n from dual union all
      4   select 1.6 n from dual
      5  )
      6  --
      7  --
      8  select n, ceil(n) n_ceiled from t
      9  /
                  N        N_CEILED
             12.838              13
              .2322               1
                1.6               2

  • Record the coordinate point of the max y value on chart

    I am trying to figure out how to get labVIEW to record the x and y values at the coordinate point of the location of the max y value.  In other words, at the max y value, record the x and y values at that point.  I though of using the max and min fn under signal processing but it only records the maximum value on one axis.  I am using labVIEW 8.6.  Any suggestions?  Also I am very new to LabVIEW so I appologize if this is a really simple problem.

    What do you mean by : "My max/min array does not seem to store the max/min values."
    An array is a serie of numbers, so unless they are all the same there has to be a minimum and a maximum. 
    What do you mean by : "...return to zero within a second or two..."
    Does your vi hang for a second or two or what? 
    What do you mean by : '...to stay at the max value until I exceed it?"
    Exceed what? A loop that acquire data continuously or what?  
    The solution provided by smercurio is ok for a static array but I start thinking that you acquire data and want to find the maximum value over different blocks of data.
    Is that it?
    If yes then you need a shift register that retain the maximum of passed blocks. With each new block compare the maximum of that block with the shift register value. If it's larger keep this one as a new maximum. If it isn't larger keep the original value.
    Message Edited by Alain S on 07-03-2009 07:17 PM

  • Rounding a float value

    totalamount = totalamount + Float.parseFloat(amount1);
    From the above code I am getting totalamount which is of float datatype. The value has more than two decimals like 123.23232 I need to round it to 123.23. How could this be done ? Any help is appreciated.

    You can do the following to round to two figures after the decimal point, rounding to the nearest neighbor, if they are equidistant, round up:
    totalamount = totalamount + Float.parseFloat(amount1);
    BigDecimal bigDecimal =new BigDecimal(totalamount ).setScale(2,bigDecimal.ROUND_HALF_UP);
    I hope this helps,
    Val.

  • How to find nearest point on polyline

    Hi,
    I have to find the nearest point to my standing point on a polyline. I have Oracle Locator installed, but my data is not in a locator format. Is it possible to do this by using Locator's functionality by for example puting the polyline and standing point coordinate values into a spatial type variable and calling some locator functionality?
    Or I have to coordinate data into a "spatial enabled" table, create spatial index etc and then call some Locator procedure.
    Tamas

    Luc,
    Thanks for the reference.
    When the data is converted, finding the nearest vertex in an sdo_geometry object could be done this way (of, of course, many):
    select f.vertex_id,f.dist,f.min_dist,f.a_vertex
      from (select p.vertex_id,
                   sdo_geom.sdo_distance(p.the_point,p.a_vertex,0.005) as dist,
                   min(sdo_geom.sdo_distance(p.the_point,p.a_vertex,0.005)) over (order by sdo_geom.sdo_distance(p.the_point,p.a_vertex,0.005) asc) as min_dist,
                   p.the_point,
                   p.a_vertex
              from (select t.id as vertex_id,
                           mdsys.sdo_geometry(2001,NULL,mdsys.sdo_point_type(358615,5407047,null),null,null) as the_point,
                           mdsys.sdo_geometry(2001,NULL,mdsys.sdo_point_type(t.x,t.y,t.z),null,null) as a_vertex
                      from table(sdo_util.getVertices(
                                MDSYS.SDO_GEOMETRY(2002,null,null,MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(362253.9,5409676.63,355608.12,5407615.16,358063.37,5407673.48,355276.53,5407361.08,360471.08,5408880.79,362483.4,5406024.69,362359.16,5408840.11,354570.21,5406219.18,360204.62,5405849.14,359214.51,5408283.5,358761.06,5406683.88,356739.05,5405590.46,358615.79,5407047.29,355978.02,5407326.33,356240.87,5409898.7,363159.35,5405510.46,358588.81,5406536.54,354822.42,5408643.75,357690.2,5408872.57,359839.29,5407253.86,355236.29,5409711.53,355342.54,5407448.87,360290.53,5405111.51,354677.02,5407916.83,361651.27,5409178.26,361730.18,5407553.5,357402.33,5409065.5,361546.51,5407278.41,361915.65,5408942.57,361974.74,5405464.91,357794.3,5406979.33,356106.58,5405481.32,357604.96,5407407.72,360718.31,5406765.8,359745.49,5406568.16,363005.29,5407557.46,355844.01,5407095.47,362749.66,5405041.82,359714.13,5408898.69,354509.69,5406113.6,360041.59,5406204.24,360380.17,5408751.21,356621.4,5409603.06,355156.27,5405401.98,354441.35,5409090.68,356376.45,5407472.81,363877.1,5405582.72,361883.83,5409696.17,356363.41,5406434.53,362078.96,5406617.37,362714.59,5409800.2,362703.49,5408513.33,358317.64,5408170.64,359294.27,5409197.53,360240.93,5406333.84))
                                )) t
                    ) p
            ) f
      where f.dist = f.min_dist;Hope this helps.
    Simon

  • Rounding net book value - Depreciation calculated even 0%

    Dear all,
    I'm becoming crazy with ERP6.
    We are upgrading our SAP from 4.7 to ERP6, EA-FIN is active.
    Now if I look the asset explorer or whatever FI-AA reporting with the planned depreciation, I have a difference on the depreciation values, but only for lands ( Depreciation key 0000) - We have set "round net book value at the end of the year", but It seems that now, the system rounds the net book value, even if the depreciation key is 0% . (not the case in 4.7)
    please advice
    Thanks
    nat

    Hi,
    This has nothing to do with the depreciation key.
    If you have flagged in tr. OAYO the following rounding specifications:
    Ind: Round net book value
    This indicator specifies that the net book value of an asset should be rounded to whole units of currency at the end of the fiscal year.
    You specify the type of rounding in the same screen. ...."
    .....the system makes this rounding.
    But this was also the same in former releases.
    regards Bernhard

  • SQL for rounding to the nearest value

    Hi All,
    My Oracle DB version is 10g Release2 and also 11gR1
    I have data like below, I need to write a SQL for the below requirement.
    ID   RANGE_LOW                RANGE_HIGH
    1      50                    55             
    2      55                    60
    3      60                    63 
    4      63                    77 
    5      77                    84   The requirement is like I need to check a value between the above range low and high then round it to the nearest value.
    Say, for example if I have 68 then the value is rounded to 63 else if 74 then 77 else if its in the middle of two values (70) then rounded to the highest value, here its 77.
    Please advice.

    Ashu_Neo wrote:
    hi Purvesh,
    I think , you didn't check it properly with requirement of posting. Your query needs to be changed a bit. Please verify againYes, I probably missed or overlooked the last line.
    Here is the updated solution then:
    with data as
      select 1 id, 50 low, 55 high from dual union all
      select 2, 55, 60 from dual union all
      select 3, 60, 63 from dual union all
      select 4, 63, 77 from dual union all
      select 5, 77, 84 from dual 
    chk_val as
      select &val val from dual
    select id, low, high,
           val input_value,
           case
            when val < (low + high)/2
              then low
            else
              high
           end round_value
      from data, chk_val
    where val between low and high;
    ID                     LOW                    HIGH                   INPUT_VALUE            ROUND_VALUE           
    4                      63                     77                     70                     77

  • Problem getting parameter  values at the service end point

    I am having problem getting parameter values at the service end point. I created service end point and this method is having 35 parameters and then i created test client file using Sun One Studio 5. but when i run this test client and make a call to service it sends wrong value to first three parameters to the service end point. I tried all the way round but it gave me same sort of problem. I change the order of parameters change the names of parameters but it didn�t work. And then i started chopping of parameter from the left side. And my problem is solved when my parameter list reached to 12 from 35. So is it a bug or some problem with my configuration or some thing else.
    I am using sun one studio 5 with sun one app 7. My service end point does very simple thing. It only takes out put of the parameter to the server log file. And my wsdl file seems all right. There is no conflict with the count and data type of the parameter information it contains.
    �     Service End Point Definition (in EJB)
    public java.lang.String setNewAddress(java.lang.String propertyName, java.lang.String status, java.lang.String PMSCode, java.lang.String streetNumPrefix, int streetStartNum, java.lang.String streetStartNumSuffix, int streetEndNum, java.lang.String streetEndNumSuffix, java.lang.String streetName, java.lang.String streetType, java.lang.String streetSuffix, java.lang.String localityPrefix,java.lang.String localityName, java.lang.String postcode, java.lang.String stateCode, java.lang.String countryCode, java.lang.String description, java.lang.String coordinateAccuracy, int longitude, int latitude, java.lang.String planNumber, java.lang.String lotPrefix, int lotNumber, int siteID, java.lang.String countryName, java.lang.String parishName, java.lang.String section, int portionNum, int crownAllotNum, int titleVol, java.lang.String folio, java.lang.String esa, int aliasID, int aliasTagID,String ID) {
    System.out.println(propertyName);
    System.out.println(PMSCode);
    System.out.println(streetNumPrefix);
    ........ taking printout of all the paramters
    �     This is my WSDL file
    <?xml version="1.0" encoding="UTF-8"?>
    <definitions name="NMService" targetNamespace="urn:NMService/wsdl" xmlns:tns="urn:NMService/wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
    <types/>
    <message name="NMServiceServantInterface_setNewAddress">
    <part name="String_1" type="xsd:string"/>
    <part name="String_2" type="xsd:string"/>
    <part name="String_3" type="xsd:string"/>
    <part name="String_4" type="xsd:string"/>
    <part name="int_5" type="xsd:int"/>
    <part name="String_6" type="xsd:string"/>
    <part name="int_7" type="xsd:int"/>
    <part name="String_8" type="xsd:string"/>
    <part name="String_9" type="xsd:string"/>
    <part name="String_10" type="xsd:string"/>
    <part name="String_11" type="xsd:string"/>
    <part name="String_12" type="xsd:string"/>
    <part name="String_13" type="xsd:string"/>
    <part name="String_14" type="xsd:string"/>
    <part name="String_15" type="xsd:string"/>
    <part name="String_16" type="xsd:string"/>
    <part name="String_17" type="xsd:string"/>
    <part name="String_18" type="xsd:string"/>
    <part name="int_19" type="xsd:int"/>
    <part name="int_20" type="xsd:int"/>
    <part name="String_21" type="xsd:string"/>
    <part name="String_22" type="xsd:string"/>
    <part name="int_23" type="xsd:int"/>
    <part name="int_24" type="xsd:int"/>
    <part name="String_25" type="xsd:string"/>
    <part name="String_26" type="xsd:string"/>
    <part name="String_27" type="xsd:string"/>
    <part name="int_28" type="xsd:int"/>
    <part name="int_29" type="xsd:int"/>
    <part name="int_30" type="xsd:int"/>
    <part name="String_31" type="xsd:string"/>
    <part name="String_32" type="xsd:string"/>
    <part name="int_33" type="xsd:int"/>
    <part name="int_34" type="xsd:int"/>
    <part name="String_35" type="xsd:string"/></message>
    <message name="NMServiceServantInterface_setNewAddressResponse">
    <part name="result" type="xsd:string"/></message>
    <portType name="NMServiceServantInterface">
    <operation name="setNewAddress" parameterOrder="String_1 String_2 String_3 String_4 int_5 String_6 int_7 String_8 String_9 String_10 String_11 String_12 String_13 String_14 String_15 String_16 String_17 String_18 int_19 int_20 String_21 String_22 int_23 int_24 String_25 String_26 String_27 int_28 int_29 int_30 String_31 String_32 int_33 int_34 String_35">
    <input message="tns:NMServiceServantInterface_setNewAddress"/>
    <output message="tns:NMServiceServantInterface_setNewAddressResponse"/></operation></portType>
    <binding name="NMServiceServantInterfaceBinding" type="tns:NMServiceServantInterface">
    <operation name="setNewAddress">
    <input>
    <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="urn:NMService/wsdl"/></input>
    <output>
    <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded" namespace="urn:NMService/wsdl"/></output>
    <soap:operation soapAction=""/></operation>
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/></binding>
    <service name="NMService">
    <port name="NMServiceServantInterfacePort" binding="tns:NMServiceServantInterfaceBinding">
    <soap:address location="http://localhost:80/NMService/NMService"/></port></service></definitions>
    �     I followed steps given this example. http://developers.sun.com/prodtech/javatools/jsstandard/reference/docs/s1s5/stockapp.html.
    If some one know what is wrong. Is it me or some thing wrong with the method I followed. But I am sure that I followed exactly the same method as it given in examples. So if some one can guide me
    Thanks

    I just found that there is a bug with Sun One Studio 5. It creates faulty JSP file to test the client for the web services. With above problem I tested my web services using different developing environment such as Jdeveloper 10g. I created client stub using wsdl file generated by sun one studio. And made call to my web service and all the parameter reached perfectly at service end point. And then I used stub class created by sun one studio for the client and made the same call. And it also went well. So the problem is with the test application (JSP File) sun one creates for my web service.
    This is the majore problem i faced during the development. But still there is many problem along with this which is not seriouse enough but requires attension. I would like sun developers to make sun one studio IDE simpler and handy .

  • Rounding of Qty to the nearest whole no in PO

    Hi All,
    We have material whose base unit of measure is say centimetres. and it has purchase unit as metres.
    Our requirment for procurement is generated through MRP run which creates the Purchase requistion and in PR the UOM considered is the base unit of measure  ie centimetres.
    When this Purchase req is converted to Purchase Orders we get qty sometimes in decimals  for ex: if in Pur req the qty is 150 centimetres , in PO it is shown as 1.5 metres.
    Is there a way for rounding of 1.5 to 2.0 metres in PO (means to the nearest whole no) automatically.
    Thanks,
    Vengal

    in MRP view of material master you have two fields to care about rounding. rounding profile and rounding value
    http://help.sap.com/saphelp_46c/helpdata/en/f4/7d28c844af11d182b40000e829fbfe/content.htm

  • Rounding up to the nearest 0.05

    Hi guys i am trying to round a value up to the nearest 0.05. e.g. the value 94.63 would be rounded up as 94.65
    I have used big decimal with the round half up and round up modes but it still outputs 94.63
    How can I get arround this ?
    Cheers

          * Returns the value rounded up to the nearest 0.05
          * @param  double  value to be rounded
          * @return double  rounded up value
         private static double roundOff(double value)
              return Math.ceil(value / ROUNDUP_FACTOR) * ROUNDUP_FACTOR;
         }Where ROUNDUP_FACTOR = 0.05
    Edited by: fatjack on Dec 20, 2007 6:05 AM

  • Formulae - rounding down to the nearest five

    I am new to JAVA programming and not (yet) a brilliant mathematician. Can anybody tell me an algebra formula for rounding down to the nearest 5 (in 100)? Thanks in advance [email protected]

    Your question is not very clear.
    Still I think this would help
    //begin
    int remainder = number % 5 ;
    //We get the remainder
    number = number - remainder;
    //Trim down to the lower value
    if (remainder >= 3){
    number = number + 5 ;
    //If the remainder is 3 or more we should round to the higher value
    //End of block
    Hope this helps
    Shubhrajit

Maybe you are looking for