Skip to Content
author's profile photo Former Member
Former Member

How to display deciaml place in Table column

Hi all.

In my webDynpro ESS application.

I have a contextNode-Amount, which type is BigDecimal with scale = 2.

There is 2 rows, one is 12, another is 13.1

Now I bind this contextNode-Amount to one Table Column.

In Table, it display

12

13.1

But I want the Table display as

12.00

13.10

How to make the table to display it ? Can I setup some number format ?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 02, 2006 at 08:08 AM

    Hi,

    you can create a calculated context attribute in your node which formats the value using java number format mechanism.

    Regards

    Sebastian

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      here is some sample code:

      x1 is your value attribute which contains the data from the backend.

      x2 is the calculated value attribute (in the properties of this attribute set "calculated = true", "readonly = true" and "type = string")

      In the automatically created getter method place the following code:

      public java.lang.String getDatenX2(IPrivate<YOUR_VIEW>.I<YOUR_NODE>Element element) {
      
      	double number = element.getX1();
      	NumberFormat nf = NumberFormat.getNumberInstance();
      	nf.setMinimumFractionDigits(2);
      	    
      	return nf.format(number);
      
      }
      

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.