« Quay về University of La Plata

Set format for double type attributes

Xem kết hợp Flat Xem Xem cây
Luồng thảo luận [ Trước | Tiếp theo ]
toggle
Set format for double type attributes
community documentation attribute type attribute facets
Câu trả lời
12:11 27/03/2014
How can I set the format to a double type attribute?
I want it with only two numbers after the dot in the GraphRep.

RE: Set format for double type attributes
graphrep layout round
Câu trả lời
11:58 06/12/2013 gửi bài phản hồi tới Cho phép người dùng chưa đăng ký.
For restricting the number of decimals of an attribute of type DOUBLE for all instances, use the statement LAYOUT in the AttributeNumericDomain facet of the respective attribute.
Example:
1LAYOUT decimals:3

If you want to display the full number of decimals in the Notebook, but only two decimals in the graphical representation, the solution would be using the function round() as described in the code snippet below (for displaying two decimals):
1GRAPHREP
2...
3AVAL myVariable: "myNumberAttribute"
4TEXT ( STR( round(myVariable*100)/100 ) )
5...

The function round(x) returns the closest integer.