Formatting Decimals

Hi there
I am having a problem with a number
I am using and int to add up some numbers but wish it to be displayed as currency ie 12345 = 123.45
I have set up a formatter using
static String pattern "���0.00";
DecimalFormat myFormat = new DecimalFormat(pattern);
When I applied it to an int 927005 using the following syntax
expectTotal = myFormat.format((double)expt/100)
The result is 9270.04 does anybody know why this happens and what is the correct way of doing this type of conversion
Thanks

I tried to format (double)927005/100 and it gives me 9270.05.
In the API for jdk1.2.2, it says for the DecimalFormat class:
The rounding is performed according to the IEEE 754 default rounding mode known as half even: Numbers are rounded toward the nearest truncated value, unless both truncated values are equidistant, in which case the value ending in an even digit is chosen.
I didn't find this description in jdk1.3.1 though, so they might have changed it. But it means if you use jdk/jre1.2.2, then if you have e.g. 9270.0499, it will be formatted to 9270.04.

Similar Messages

  • Again: Number Format, Decimals in calculated fields

    My customer wants to know how he can have calculated fields in his reports.
    I've found out that e.g. this works for the calculation:
    <?format-number:((SALARY) div (../../DEPTSAL));'#,##0.00'?>
    But there is no way that I can get a precision of two decimals. All given formats are ignored.
    Maybe this is an issue with the european decimal sign , (Comma).
    How is this to be fixed?
    The use of the translate function was recommended somewhere. I have no idea how to bring it together with my calculation formula.
    Thanks in advance,
    Kai
    Message was edited by:
    kai

    Hi kai,
    First you need to remove comma from your amount field then you can get your result.
    If you have any comma in your amount field then xml number format does not work.
    Look this forum:
    Re: How to indicate number percission in a template?
    Thanks
    Ravi
    Message was edited by:
    Ravi Tripathi

  • Need help figuring out what's wrong with my code!

    I am having a few problems with my code and can't see what I've done wrong. Here are my issues:
    #1. My program is not displaying the answers to my calculations in the table.
    #2. The program is supposed to pause after 24 lines and ask the user to hit enter to continue.
    2a. First, it works correctly for the first 24 lines, but then jumps to every 48 lines.
    2b. The line count is supposed to go 24, 48, etc...but the code is going from 24 to 74 to 124 ... that is NOT right!
    import java.text.DecimalFormat; //needed to format decimals
    import java.io.*;
    class Mortgage2
    //Define variables
    double MonthlyPayment = 0; //monthly payment
    double Principal = 200000; //principal of loan
    double YearlyInterestRate = 5.75; //yearly interest rate
    double MonthlyInterestRate = (5.75/1200); //monthly interest rate
    double MonthlyPrincipal = 0; //monthly principal
    double MonthlyInterest = 0; //monthly interest
    double Balance = 0; //balance of loan
    int TermInYears = 30; //term of loan in yearly terms
    int linecount = 0; //line count for list of results
    // Buffered input Reader
    BufferedReader myInput = new BufferedReader (new
    InputStreamReader(System.in));
    //Calculation Methods
    void calculateMonthlyPayment() //Calculates monthly mortgage
    MonthlyPayment = Principal * (MonthlyInterestRate * (Math.pow(1 + MonthlyInterestRate, 12 * TermInYears))) /
    (Math.pow(1 + MonthlyInterestRate, 12 * TermInYears) - 1);
    void calculateMonthlyInterestRate() //Calculates monthly interest
    MonthlyInterest = Balance * MonthlyInterestRate;
    void calculateMonthlyPrincipal() //Calculates monthly principal
    MonthlyPrincipal = MonthlyPayment - MonthlyInterest;
    void calculateBalance() //Calculates balance
    Balance = Principal + MonthlyInterest - MonthlyPayment;
    void Amortization() //Calculates Amortization
    DecimalFormat df = new DecimalFormat("$,###.00"); //Format decimals
    int NumberOfPayments = TermInYears * 12;
    for (int i = 1; i <= NumberOfPayments; i++)
    // If statements asking user to enter to continue
    if(linecount == 24)
    System.out.println("Press Enter to Continue.");
    linecount = 0;
    try
    System.in.read();
    catch(IOException e) {
    e.printStackTrace();
    else
    linecount++;
    System.out.println(i + "\t\t" + df.format(MonthlyPrincipal) + "\t" + df.format(MonthlyInterest) + "\t" + df.format(Balance));
    //Method to display output
    public void display ()
    DecimalFormat df = new DecimalFormat(",###.00"); //Format decimals
    System.out.println("\n\nMORTGAGE PAYMENT CALCULATOR"); //title of the program
    System.out.println("=================================="); //separator
    System.out.println("\tPrincipal Amount: $" + df.format(Principal)); //principal amount of the mortgage
    System.out.println("\tTerm:\t" + TermInYears + " years"); //number of years of the loan
    System.out.println("\tInterest Rate:\t" + YearlyInterestRate + "%"); //interest rate as a percentage
    System.out.println("\tMonthly Payment: $" + df.format(MonthlyPayment)); //calculated monthly payment
    System.out.println("\n\nAMORTIZATION TABLE"); //title of amortization table
    System.out.println("======================================================"); //separator
    System.out.println("\nPayment\tPrincipal\tInterest\t Balance");
    System.out.println(" Month\t Paid\t\t Paid\t\tRemaining");
    System.out.println("--------\t---------\t--------\t-------");
    public static void main (String rgs[]) //Start main function
    Mortgage2 Mortgage = new Mortgage2();
    Mortgage.calculateMonthlyPayment();
    Mortgage.display();
    Mortgage.Amortization();
    ANY help would be greatly appreciated!
    Edited by: Jeaneene on May 25, 2008 11:54 AM

    From [http://developers.sun.com/resources/forumsFAQ.html]:
    Post once and in the right area: Multiple postings are allowed, but they make the category lists longer and create more email traffic for developers who have placed watches on multiple categories. Because of this, duplicate posts are considered a waste of time and an annoyance to many community members, that is, the people who might help you.

  • Issue with adding up a Percent and a number

    <p>In Crystal Reports XI I have an issue where I&#39;m trying to add a percent and a number together and I don&#39;t get the desired result. </p><p>Formula = (4.6800000 + 2) </p><p> Formula =  (4.6800000 * 2) </p><p>Formula   = IF ((4.6800000 + 2)>(4.6800000 * 2)) then else <br /></p><p>Formula = IF (6.6800000 >= 5.8500000) and (6.6800000 >= ) then "FAILS" else "PASSES" </p><p> </p><p>The value of  (4.6800000 + 2)  displays <strong>6.6800000</strong> correctly on the report but if you try to say that 6.6800000 = (4.6800000 + 2) then your RESULT value shows "FAILS" on the report.<br /> </p><p>For some reason 6.6800000 does not = (4.6800000 + 2) </p><p>The Formula RESULT above should say "PASSES" but I get "FAILS" but both values show <strong>"6.6800000"</strong></p><p>I have tried Rounding, Truncating, and Formating decimals and just does not make sense. </p><p><strong>Any Ideas?  </strong></p><p><strong>Thanks  </strong>(It works in Access Reports) </p>

    The condition is wrong check
    IF (6.6800000 >= 5.8500000) ANDÂ (6.6800000 >
    = {@Get }) then "PASSES" else "FAILS"
    As you are using AND both the conditions should get satisfied ....
    Cheers
    Rahul

  • Problems implementing comboboxes and having the program work

    import java.text.DecimalFormat; //class for format decimals
    import java.awt.*;
    import javax.swing.*;
    import java.applet.Applet;
    import java.awt.event.*;
    public class MortgageCal2 extends JApplet {
    JLabel principal_Label;
    JLabel interestRate_Label;
    JLabel termYear_Label;
    JTextField principal_TF;
    JTextField interestRate_TF;
    JComboBox interestRate_CB;
    JTextField termYear_TF;
    JComboBox termYear_CB;
    JButton calculate_button;
    JButton clear_button;
    JLabel monthlyPI_Label;
    JLabel payment_Label;
    //*********************Main Program for MortgageCal2 Class***************************
    public static void main(String[] args) {
         JFrame calculator = new JFrame();
         MortgageCal2 calc = new MortgageCal2();
         calculator.getContentPane().add(calc);
         calc.init();
         calculator.pack();
         calculator.setVisible(true);               
    public void init() {
         MortgageCalLayout customLayout = new MortgageCalLayout();
         Container con1 = getContentPane();
         con1.setLayout(customLayout);
         principal_Label = new JLabel("PRINCIPAL:");//1
              con1.add(principal_Label);
         interestRate_Label = new JLabel("INTEREST RATE:");//2
              con1.add(interestRate_Label);
         termYear_Label = new JLabel("TERM YEARS:");//3
              con1.add(termYear_Label);
         principal_TF = new JTextField();//4
              con1.add(principal_TF);
              interestRate_TF = new JTextField();//5
              con1.add(interestRate_TF);
              String[] interestArray = {"5.35", "5.50", "5.75"};
              interestRate_CB = new JComboBox(interestArray);
              termYear_TF = new JTextField();//6
              con1.add(termYear_TF);
              String[] termArray = {"7", "15", "30"};
              termYear_CB = new JComboBox (termArray);
              JButton calculate_button = new JButton("CALCULATE");//7
              con1.add(calculate_button);
         monthlyPI_Label = new JLabel("MONTHLY P&I: ");//8
              con1.add(monthlyPI_Label);
         JButton clear_button = new JButton("CLEAR");//9
              con1.add(clear_button);
         payment_Label = new JLabel();
              con1.add(payment_Label);
              if (termYear_CB.getSelectedItem().equals ("7"))
                   interestRate_CB.setSelectedIndex(1);
                        else if(termYear_CB.getSelectedItem().equals ("15"))
                   interestRate_CB.setSelectedIndex(2);
                        else if(termYear_CB.getSelectedItem().equals ("30"))
                   interestRate_CB.setSelectedIndex(0);
         //********Listener for Interest Rate ComboBox***********************
         interestRate_CB.addItemListener(new ItemListener(){
              public void itemStateChanged(ItemEvent ev)
              int idx=interestRate_CB.getSelectedIndex();
              termYear_CB.setSelectedIndex(idx);
         //*********Listener for Calculate Button*****************************
         calculate_button.addActionListener(
              new ActionListener() {
    public void actionPerformed(ActionEvent h) {
    //***********************Decimal Format**************************
    java.text.DecimalFormat DF = new DecimalFormat("###,###.00");
    //***************Variables***************************************
    double principal = Double.parseDouble(principal_TF.getText());
    double interestRate = Double.parseDouble(interestRate_TF.getText());
    double monthlyInterest;
    double termYear = Double.parseDouble(termYear_TF.getText());
    double termMonthly;
    double monthlyPI;
    //*****************Calculations************************************
    monthlyInterest = interestRate / 12 / 100;
    termMonthly = termYear * 12;
    monthlyPI = (principal * monthlyInterest) / (1 - Math.pow(1 + monthlyInterest, -termMonthly));
    //*****************Displays Payment***********************************
    payment_Label.setText("$" + DF.format(monthlyPI));
    //***************Listener for Clear Button************************
    clear_button.addActionListener(
    new ActionListener() {
    public void actionPerformed(ActionEvent h) {
    principal_TF.setText("");
    interestRate_TF.setText("");
    termYear_TF.setText("");
    payment_Label.setText("");
    class MortgageCalLayout implements LayoutManager {
         //***********Constructor for the MortgageCal Layout object*************************
         public MortgageCalLayout() { }
         //********Adds a feature to the LayoutComponent attribute for the MortgageCal Layout object**********
         public void addLayoutComponent(String name, Component comp) {
         //**************Method description************************
    public void removeLayoutComponent(Component comp) {
         public Dimension preferredLayoutSize(Container parent) {
              Dimension dim = new Dimension(0, 0);
              Insets insets = parent.getInsets();
         dim.width = 250 + insets.left + insets.right;
         dim.height = 250 + insets.top + insets.bottom;
    return dim;
         public Dimension minimumLayoutSize(Container parent) {
         Dimension dim = new Dimension(0, 0);
    return dim;
         public void layoutContainer(Container parent) {
         Insets insets = parent.getInsets();
         Component c;
         c = parent.getComponent(0);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 20, insets.top + 10, 100, 25);
         c = parent.getComponent(1);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 20, insets.top + 40, 100, 25);
         c = parent.getComponent(2);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 20, insets.top + 72, 100, 25);
         c = parent.getComponent(3);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 115, insets.top + 10, 115, 25);
         c = parent.getComponent(4);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 115, insets.top + 40, 115, 25);
         c = parent.getComponent(5);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 115, insets.top + 75, 115, 25);
         c = parent.getComponent(6);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 115, insets.top + 105, 115, 25);
         c = parent.getComponent(7);
                   if (c.isVisible()) {
                        c.setBounds(insets.left + 20, insets.top + 140, 100, 25);
         c = parent.getComponent(8);
              if (c.isVisible()) {
              c.setBounds(insets.left + 115, insets.top + 200, 120, 25);
         c = parent.getComponent(9);
              if (c.isVisible()) {
              c.setBounds(insets.left + 115, insets.top + 140, 75, 25);

    import java.text.DecimalFormat; //class for format decimals
    import java.awt.*;
    import javax.swing.*;
    import java.applet.Applet;
    import java.awt.event.*;
    public class MortgageCal2 extends JApplet {
    JLabel principal_Label;
    JLabel interestRate_Label;
    JLabel termYear_Label;
    JTextField principal_TF;
    JTextField interestRate_TF;
    JComboBox interestRate_CB;
    JTextField termYear_TF;
    JComboBox termYear_CB;
    JButton calculate_button;
    JButton clear_button;
    JLabel monthlyPI_Label;
    JLabel payment_Label;
    //*********************Main Program for MortgageCal2 Class***************************
    public static void main(String[] args) {
         JFrame calculator = new JFrame();
         MortgageCal2 calc = new MortgageCal2();
         calculator.getContentPane().add(calc);
         calc.init();
         calculator.pack();
         calculator.setVisible(true);               
    public void init() {
         MortgageCalLayout customLayout = new MortgageCalLayout();
         Container con1 = getContentPane();
         con1.setLayout(customLayout);
         principal_Label = new JLabel("PRINCIPAL:");//1
              con1.add(principal_Label);
         interestRate_Label = new JLabel("INTEREST RATE:");//2
              con1.add(interestRate_Label);
         termYear_Label = new JLabel("TERM YEARS:");//3
              con1.add(termYear_Label);
         principal_TF = new JTextField();//4
              con1.add(principal_TF);
              interestRate_TF = new JTextField();//5
              con1.add(interestRate_TF);
              String[] interestArray = {"5.35", "5.50", "5.75"};
              interestRate_CB = new JComboBox(interestArray);
              termYear_TF = new JTextField();//6
              con1.add(termYear_TF);
              String[] termArray = {"7", "15", "30"};
              termYear_CB = new JComboBox (termArray);
              JButton calculate_button = new JButton("CALCULATE");//7
              con1.add(calculate_button);
         monthlyPI_Label = new JLabel("MONTHLY P&I: ");//8
              con1.add(monthlyPI_Label);
         JButton clear_button = new JButton("CLEAR");//9
              con1.add(clear_button);
         payment_Label = new JLabel();
              con1.add(payment_Label);
              if (termYear_CB.getSelectedItem().equals ("7"))
                   interestRate_CB.setSelectedIndex(1);
                        else if(termYear_CB.getSelectedItem().equals ("15"))
                   interestRate_CB.setSelectedIndex(2);
                        else if(termYear_CB.getSelectedItem().equals ("30"))
                   interestRate_CB.setSelectedIndex(0);
         //********Listener for Interest Rate ComboBox***********************
         interestRate_CB.addItemListener(new ItemListener(){
              public void itemStateChanged(ItemEvent ev)
              int idx=interestRate_CB.getSelectedIndex();
              termYear_CB.setSelectedIndex(idx);
         //*********Listener for Calculate Button*****************************
         calculate_button.addActionListener(
              new ActionListener() {
    public void actionPerformed(ActionEvent h) {
    //***********************Decimal Format**************************
    java.text.DecimalFormat DF = new DecimalFormat("###,###.00");
    //***************Variables***************************************
    double principal = Double.parseDouble(principal_TF.getText());
    double interestRate = Double.parseDouble(interestRate_CB.getText());
    double monthlyInterest;
    double termYear = Double.parseDouble(termYear_CB.getText());
    double termMonthly;
    double monthlyPI;
    //*****************Calculations************************************
    monthlyInterest = interestRate / 12 / 100;
    termMonthly = termYear * 12;
    monthlyPI = (principal * monthlyInterest) / (1 - Math.pow(1 + monthlyInterest, -termMonthly));
    //*****************Displays Payment***********************************
    payment_Label.setText("$" + DF.format(monthlyPI));
    //***************Listener for Clear Button************************
    clear_button.addActionListener(
    new ActionListener() {
    public void actionPerformed(ActionEvent h) {
    principal_TF.setText("");
    interestRate_TF.setText("");
    termYear_TF.setText("");
    payment_Label.setText("");
    class MortgageCalLayout implements LayoutManager {
         //***********Constructor for the MortgageCal Layout object*************************
         public MortgageCalLayout() { }
         //********Adds a feature to the LayoutComponent attribute for the MortgageCal Layout object**********
         public void addLayoutComponent(String name, Component comp) {
         //**************Method description************************
    public void removeLayoutComponent(Component comp) {
         public Dimension preferredLayoutSize(Container parent) {
              Dimension dim = new Dimension(0, 0);
              Insets insets = parent.getInsets();
         dim.width = 250 + insets.left + insets.right;
         dim.height = 250 + insets.top + insets.bottom;
    return dim;
         public Dimension minimumLayoutSize(Container parent) {
         Dimension dim = new Dimension(0, 0);
    return dim;
         public void layoutContainer(Container parent) {
         Insets insets = parent.getInsets();
         Component c;
         c = parent.getComponent(0);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 20, insets.top + 10, 100, 25);
         c = parent.getComponent(1);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 20, insets.top + 40, 100, 25);
         c = parent.getComponent(2);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 20, insets.top + 72, 100, 25);
         c = parent.getComponent(3);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 115, insets.top + 10, 115, 25);
         c = parent.getComponent(4);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 115, insets.top + 40, 115, 25);
         c = parent.getComponent(5);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 115, insets.top + 75, 115, 25);
         c = parent.getComponent(6);
              if (c.isVisible()) {
                        c.setBounds(insets.left + 115, insets.top + 105, 115, 25);
         c = parent.getComponent(7);
                   if (c.isVisible()) {
                        c.setBounds(insets.left + 20, insets.top + 140, 100, 25);
         c = parent.getComponent(8);
              if (c.isVisible()) {
              c.setBounds(insets.left + 115, insets.top + 200, 120, 25);
         c = parent.getComponent(9);
              if (c.isVisible()) {
              c.setBounds(insets.left + 115, insets.top + 140, 75, 25);
    MortgageCal2.java:122: cannot resolve symbol
    symbol : method getText ()
    location: class javax.swing.JComboBox
    double interestRate = Double.parseDouble(interestRate_CB.getText());
    ^
    MortgageCal2.java:124: cannot resolve symbol
    symbol : method getText ()
    location: class javax.swing.JComboBox
    double termYear = Double.parseDouble(termYear_CB.getText());
    Everything worked until I added the combo boxes. Now I get these errors.

  • Number format issue - comma (1,5) instead of period (1.5) before decimals?

    I am using an input field of data type Number. In Norway we use a comma before decimals. I can't get this to work in VC. Have tried to set Number format with 'Local format' checked but this is not helping. (even if my portal is showing Norwegian texts as supposed by the language setting)
    If I uncheck this and go to Custom formatting I get to set my own format. NSTR(@OPERATORER_N, ".2") gives me two decimals but with a period as the decimal point. NSTR(@OPERATORER_N, ",2") does not work.
    I do not want thousands separator.
    Tips?
    Henning Strand

    Hi,
    Check the se Threads i think you definitly get the idea or solution.
    But every body ask about to get dot separatot instaed of Comma Separator since this can be get easyly with Language Portal Settings
    Thousands separator
    http://help.sap.com/saphelp_nw70/helpdata/en/38/2d9b732beb4c68bba2962602a7d6bd/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/26/64fb472a144a0dbaf88f5ec75d9270/content.htm
    http://oregonstate.edu/dept/computing/warehouse/PDF/8-reports.pdf
    Re: Supressing Currency & Thousands Separator
    Re: Special Number format Mask Visual Compser
    All the best
    Govindu

  • How do I do use the custom code and format for a percentage with 2 decimals in Report Builder 3.0?

    In Report Builder 3.0, I have the following custom code entered:
      Public Function SafeDivide(Numerator as String, Denominator as String) as String
    Try
    If Numerator = “” or Denominator = “” then
    Return “-“
    End if
    If Numerator = “-“ or Denominator = “-“ then
    Return “-“
    End If
    If CDbl(Numerator) =0 or CDbl(Denominator) = 0 then
    Return “-“
    End if
    If IsNothing(Numerator) or IsNothing(Denominator) then
    Return "-"
    End if
    Return Val( ( (CDbl(Numerator) / CDbl(Denominator) )*100 ) )
    Catch
    Return "-"
    End Try
    End Function
    I call the custom code in the cell with the following equation:
      =Code.SafeDivide(sum(Fields!TY_UNITS.Value)-sum(Fields!LY_UNITS.Value),sum(Fields!LY_UNITS.Value))
    I have the format for the cell set to 0.00%, but it’s not being followed.
    I want the result to be formatted as a Percentage, but instead I get values like: 
    -78.9473684210
    80
    300
    -100
    I have the format for the cell set to 0.00%, but it’s not being followed.
    How do I do use the custom code and format for a percentage with 2 decimals?

    Hi AngP,
    After testing the issue in my local environment, I can reproduce it. Based on my research, I find this issue is caused by the type of Units_VAR_Percentage cell is string, while the type of CDbl(Parameters!Var_Threshold.Value) is double, so they cannot be
    compared.
    To fix this issue, we can add a hidden column (Textbox91) next to the Units_VAR_Percentage column, and type =(sum(Fields!TY_UNITS.Value)-sum(Fields!LY_UNITS.Value)) /sum(Fields!LY_UNITS.Value) as the expression. Then use the expression below to control the
    BackgroundColor:
    =iif(iif(reportitems!Units_VAR_Percentage.Value=CStr(format(reportitems!Textbox91.Value,"0.00%")),reportitems!Textbox91.Value,0)>CDbl(Parameters!Var_Threshold.Value),"Yellow","PaleTurquoise")
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Require a Number Format Mask to show leading zeros on decimals

    Hi,
    My users are complaining about the decimal point not being very clear when fractional numbers are shown. I need a format mask to show a leading zero for numbers between 0 and 1 (eg. 0.5) but not have a trailing point after whole integers.
    by example:
    10 should show "10"
    .5 should show "0.5"
    I have tried the following
    FM99990D99 which displays as
    10 as "10."
    .5 as "0.5"
    The whole integer of 10 then gets a trailing decimal point. Very ugly as the decimal is the exception to the rule which is why I need to highlight it.
    The user do not want a forced decimal place either as follows:
    FM999990D09
    10 as "10.0"
    0.5 as "0.5"
    The trailing decimal place is not a practical solution because 99% of numbers are whole numbers and the decimal just pollutes the screen with more zeros, making the numbers harder to read, resulting in more errors.
    I am looking for a format mask that shows:
    10 as "10"
    .5 as "0.5"
    I am using Oracle Forms which means I cannot set_item_instance_property for the records which have decimals. I need a single format mask for all options...
    Any help would be appreciated.
    Thanks,
    Tim.

    Thanks Francois.
    Looks like there is not a simple solution using a format mask alone.
    I have implemented a very similar solution to your suggestion. I have a character, non-base table field which I populate and dynamically set a format mask if the value is between -1 and 1 (and not zero).
    i.e.
    if :purchase.qty > -1 and
    :purchase.qty < 1 and
    :purchase.qty != 0
    then
    :purchase.qty__dsp := to_char(:purchase.qty,'FM999999990D99');
    else
    :purchase.qty__dsp := to_char(:purchase.qty);
    end if;
    Thanks,
    Tim.

  • Formatting the output (currency with decimals)

    hi all,
          i want to format the output of the currency field. Right now it displays the exact value like say 23 or 43.5 etc. But my requirement is i need it to display in a standard format as 23.00 , 43.50 , 565.00 etc. i,e if there is no decimals then it should be filled with zero's.
    I have gone through some of the threads which speaks of formatting the output if it is a value node. But here i have directly bounded the table to a model node.
    Domian level datatype of the field is Currency in R/3. After model import in dictionary it is showing as decimal.
    How can i achieve this?I Appreciate if someone can help me on this.
    Regards,
    G Nid

    hi,
    Go thru this link it might helps you.
    column heading -refer to the webdynpro tutorial 34
    Change the currency data type char and specify the length.
    Thanks,
    Lohi.

  • Formatting a number element with commas and decimals.

    I have a dataset with numbers.  I already set the column type to "number".
    I want to format the number data with commas and decimals.  I found a way to add decimals, but I'm still very confused how to do commas and to combine that with the decimal formatting.
    Also, how do I apply that to a repeat region in my spry region?
    Any help would be appreciated.  Thank you very much.

    I found this on one of the forum questions.
    Excel dont preserve the trailing zeros.
    try opening the xcel and type 5.0000 and tab out, it wont preserve the trailing zeros after decimal.
    try finding out how to disable the option in excel. if you do that, you will see what you send out from the report.
    But you can try to convert the number into a text by trying to append a space at the beginning. See if that would work.
    Thanks
    Swarna

  • Function to format a number to certain decimals?

    what is the function to format a number to certain decimals?

    Hi there
    There is no built in function as such, but the Math object
    provides the methods you need to build your own. Basically if you
    want 2 places you
    *multiply by 100
    *round it
    *divide by 100
    for 3 places you use 1000 etc. I include one of mine for you
    - hope it helps:
    var myNumber:Number=12.987654321;
    function
    roundThatNumber(theNumber:Number,thePlaces:Number):Number
    var theKey:Number=Math.pow(10,thePlaces);
    //trace(theKey);
    theNumber*=theKey;
    //trace(theNumber);
    theNumber=Math.round(theNumber);
    theNumber/=theKey
    return theNumber;
    trace(roundThatNumber(myNumber,2));
    trace(roundThatNumber(myNumber,3));
    trace(roundThatNumber(myNumber,4));

  • Changing cell formatting ! - adjusting decimals and format

    Do you guys know how to change the formatting of a cell in numbers so that the number appears in scientific notation instead of a huge number with a ton of decimals? Also, how can you adjust the number of decimals you want the cell to show instead of the whole number with many decimals?
    Thank you!

    Hi Jess'D,
    Look here:
    If the screenshot doesn't show:
    Format sidebar>Cell>Data Format>Scientific
    quinn

  • Simple question - number decimals formatting

    Hi guys,
    Currently, I have to set formatting in Answers manually. Even if a number has decimals, then it still shows an integer. It's usually not a big deal, however, during testing, some numbers like ratios , etc. (<1) always show as 0 - and it leads to confusion. Is there an easy way to control that output? (i.e.< double always show 2 decimals). Also, I wonder if there's an east way to pre-format percentages. Thanks
    P.S. I know how to change column properties. What I really would like to know is how to pre-format? some xml file?
    Message was edited by:
    wildmight

    Hi wildmight,
    We have an option in answers to achieve your requirement.go to answers ->advanced->here go to"Request XML" select the column on which you want to show only integer values
    <saw:text>Percent</saw:text></saw:caption></saw:columnHeading>
    <saw:showAs type="percentOfAxis" axis="column">
    <saw:displayFormat>
    <saw:dataFormat xsi:type="saw:percent" minDigits="1" maxDigits="1" scale="2"/></saw:displayFormat
    the above XML minDigits="1" maxDigits="0".here give minDigits="0" maxDigits="0"
    after modifying this press SET XML button and save the request.
    Then you can ba able to get only integer values.

  • Number conversion to decimals format

    Hi
    create table tab1
    (col1 number);
    insert into tab1 (10);
    insert into tab2 (10.1);
    insert into tab3 (10.11);
    commit;
    I would like to extract col1 into flat file and which will be loaded into another number type column. I am using a pl/sql block to make the extract, in order to incorporate other validation. The extract should have : 10.00,10.10,10.11.
    I have a million rows in the table.. which is a preferred option..
    converting to char and then to number..
    or using format mask
    or any other option..?
    Thanks,
    Kumar

    refer this thread...
    Re: show zeros after the decimal point

  • When opening firefox to my Yahoo homepage, all of the formatting is screwed up. If I open it under explorer, it's fine. Any suggestions as to why firefox is messing up the yahoo formatting?

    The whole yahoo homepage is pushed to the left side and listed in a columnar format. None of the picture graphics appear as well. It's seems like yahoo isn't compatible. The whole page is setup in almost an outline format with numbers for each topic. (for example, Mail is showing as #1 with a small box with a decimal underneath. #2 is Autos with a box with a decimal underneath..and so on. The links are just boxes and there are decimals throughout. At the top left of the page, displayed over the Yahoo title is "YAI". If I close out and open yahoo under explorer, the site is perfectly normal so this tells me it has something to do with the firefox formatting. Using windows vista 2007.

    I do not want to download another virus program.. I do not believe it is a virus. I am running the full version of Norton 360 and it is doing a daily scan. I have Windows 7, 64 bit OS.
    This is very irritating !! If I wanted Yahoo I would ask for it !

Maybe you are looking for

  • Where can I buy a certain Macbook A1278 case?

    I recently picked up a mid-2010 Macbook Pro, 13.3 inches. It's an A1278 model, and I'm wanting to buy a good case for it. I've seen on multiple occasions people with matte black cases which will cause the apple to change color, and I'd prefer somethi

  • Odd Camera Shifting Behavior

    I have the iPhone 5. I notce an odd behavior with Apple's Camera app. When I start off taking pictures, the app behaves fine. But later on when I frame the image that I would like to take a photo of, just as I press the shutter button, the Camera app

  • IM box will not open for one person

    I have updated my skype but this has been happen to me alot on my desktop PC one person if they send me txt or call me I can't open there IM window, but when I use Skype on my Sony smartphone it works. Can some tell me how to fix this please

  • My z 10 gets switched off when battery levels went below 20%

    10.2.1.2102 my version

  • J'ai le wifi mais safari ne s'ouvre pas?

    J'ai le wifi mais quand je veux ouvrir safari on me met " the operation couldn't de completed.Cannot allocate memmory