I've written an Velocity email Template. The following Number Field is displaying with a decimal place.
Incident Level: $issue.getCustomFieldValue("customfield_11513") is showing to one decimal place e.g. 4.0
How can I format this number to remove the decimal place. e.g. Just 4 instead of 4.0?
Thanks for your help in advance.
Thanks
Santosh
If you always want an integer, you can use the standard Java method for transforming any Number to its integer value:
$issue.getCustomFieldValue("customfield_11513").intValue()
Related
Glad to ask a question here again after more than 10 years (last one was about BASH scripting, now as I'm in corporate, guess what... it's about excel ;) )
here it's my question/issue:
I am importing data with powerquery for further analysis
I have discovered is that the values imported contains extradigits not present in the original table.
I have googled for this problem but I have not been able to find an explanation nor a solution ( a similar issue is this one this one , more than one year old, but with no feedback from Microsoft )
(columns are formatted as text in the screenshot but the issue is still present even if formatted as number)
The workaround I am using now, but I am not happy with that is the following:
I "increased decimal" to make sure all my digits are captured (in my source the entries do not have all the same significant digits),
saved as csv
imported impacted columns as number
convert columns as text (for future text match
I am really annoyed by this unwanted and unpredictable behaviour of excel.
I see a serious issue of data integrity, if we cannot rely on the powerquery/powerbi platform to maintain accurate queries, I wonder why would be use it
adding another screenshot to clarify that changing the source format to text does not solve the problem
another screenshot added following #David Bacci comments:
I think I wrongfully assumed my data was stored as text in the source, can you confirm?
If you are exporting and importing as text, then this will not happen. If you convert to number, you will lose precision. From the docs (my bold):
Represents a 64-bit (eight-byte) floating-point number. It's the most
common number type, and corresponds to numbers as you usually think of
them. Although designed to handle numbers with fractional values, it
also handles whole numbers. The Decimal Number type can handle
negative values from –1.79E +308 through –2.23E –308, 0, and positive
values from 2.23E –308 through 1.79E + 308. For example, numbers like
34, 34.01, and 34.000367063 are valid decimal numbers. The largest
precision that can be represented in a Decimal Number type is 15
digits long. The decimal separator can occur anywhere in the number.
The Decimal Number type corresponds to how Excel stores its numbers.
Note that a binary floating-point number can't represent all numbers
within its supported range with 100% accuracy. Thus, minor differences
in precision might occur when representing certain decimal numbers.
BTW, you should probably accept some of the good answers from your previous questions from 10 years ago.
I have a ssas tabular cube. I have a question regarding formatting here:
I have number 1,000,000,000.5
By using format: #,##0,.0
it gets displayed as: 1,000,000.5
I have 2 questions:
What's the logic? how is #,##0,.0 instructing to remove 000?
Also, i would like to get rid of the decimal, and show it like 1,000,000 How can I do it?
Commas before the decimal point that are not followed by # or 0 divide the result by 1000.
Whatever digits it shows will be rounded to that precision. If you want to drop the decimal rather than rounding, you can use TRUNC or INT in the measure definition.
If you use the following format #,### will give you the following.
There is a requirement to round the value up(always) to two decimal places. meaning, the number 8.3333333 should become 8.34. Round and format-number functions do not seem to achieve this. Does anyone have an idea on how to get the desired output using xslt transformation please?
To round up a number with precision of two decimal places:
ceiling(100*$value) div 100
If you need trailing zeros (i.e. a string, not a number) then wrap this in format number().
I'm writing a C++ program for bank to withdrawal money , in that code I used fixed and set precision to change the output for two decimal point but I don't want to do that , I want to make sure the user only need to input in decimal number I mean like only two decimal number .
I want like he/she can't able to enter more than two decimal number .00
You can't do this. At least not with standard input and CPP uses the same for taking input.
The best you can do is to take input into a value and cut off the decimal part after the second digit using setprecision(2), or truncate the value once you have it in the variable.
Hope it helped you.
I need to display the value of the axis without decimal points in a vtkChart.
eg- If I have values 2.31, 4.76, 7.39 etc.. I want to display them on the axis as 2, 5, 7. As integers and not as doubles or floats.
I tried using PRINTF_NOTATION on vtkAxis::SetNotation(int notation), but it would display a single decimal point.
Is there a way to achieve this in my chart using vtkAxis?
Any help would be appreciated. Thanks.
mululu's comment is correct. It should work with SetLabelFormat("%1.0f"),
but only with certain tick settings and notation according to the vtkAxis::SetLabelFormat documentation
Get/Set the printf-style format string used when TickLabelAlgorithm is
TICK_SIMPLE and Notation is PRINTF_NOTATION.
I tried the following and it worked for me. vtk 8.0 on windows:
axis->SetNotation( vtkAxis::PRINTF_NOTATION );
axis->SetTickLabelAlgorithm( vtkAxis::TICK_SIMPLE );
axis->SetLabelFormat("%1.0f");