How to set bracket to negative value but '-' should not be visible in birt report? - styles

I am using birt 4.4.1, and designing in eclipse. I am in a situation where i need to show a number enclosed by bracket if it is negative and also the "-" sign should not be shown(as we can do in microsoft excel). Is this possible in birt report?

Select your data item -> properties -> Format number -> custom
In "Format code" field enter two patterns separated by a semi-colon. The first pattern is for positive numbers, the second one for negative. For instance this pattern is a percent format, with brackets surrounding negative values.
0.0%;(0.0%)

Related

Why when I use text to column Excel changes my numbers

For example I have this line right here:
-2.7769,-5.6967,5.9179,0.37671,1
When I convert text to column using as delimiter comma in preview I see the result just right:
-2.7769 -5.6967 5.9179 0.37671 1
But when I press confirm I get this:
-27.769 -56.967 59.179 0.37671 1
How can I stop it from doing that and get the desired outcome?
I tried to make a line separated with commas into columns using the text to column feature from excel but I didn't get the result I was hoping for.
I don't know the entire solution, but I clearly see that you are mixing up decimal delimiter and thousand delimiter:
I guess that you mean "-2.7769" meaning "minus two, followed by a decimal separator, followed by .7769 (a number between zero and one)", but what your computer understand is: "minus twenty-seven thousand, seven hundred and sixty-nine, but the user has put the thousand separator at the wrong place. I will correct this."
In order to check whether or not your Excel is using a thousand separator, you can ask a random cell's formatting (right-click, choose "Format cells"): the "Use 1000 Separator (,)" checkbox in the "Number" chapter should be unchecked, as in this screenshot:

excel power query transforming data from text to decimal

Howto transform a colum with postive and negative values, which is loaded as text into a column with decial values without errors. the minus sign seems to make the error:
I use a german version of excel 365 on windows 10
Finally solve the problem: It was q quircky minus-sign, which had to be replaced by a standard minus sign before changing type to decimal. Unfortunatley at first sign this quirky decimals looked like nomral ones

Cognos 11.1.7 asterisk appearing in a calculated field. How do I tell Cognos not to show the asterisk?

I have a calculated field in a crosstab formatted as a percent with 1 decimal place
The calculation works fine
The results however show an asterisk (after the percent sign) even when exported to Excel
What I have found on some web searches is Cognos shows an asterisk when the unit of measure is unknown. Not sure if this applies to what I am doing with Cognos
The calculation is B divided by A
I solved the (annoying) issue (in a crosstab column) by:
Define content of the Crosstab intersection: yes
Unlock report
Drag and drop in the cell a Text Box
Change the textbox Source Type to Report Expression
Insert the calculation as a Report Expression instead of a query calculation
I found an answer, set the format to custom and enter the data pattern
For example,
##0.0%

Why do Excel values in parentheses become negative values?

A colleague and I encountered a behavior in Excel which isn't clear to us.
Background:
We have a tool which converts an Excel sheet into a table format. The tool calculates the formulas which are in excel and replaces variables inside it with specific values.
The excel tool is used by one of our customers who use values like (8) or (247).
These Value are automatically translated by excel to -8 or -247.
Question:
I saw that many people want to display negative numbers in parentheses. But why would Excel change values in parentheses to a negative number?
I know that I could simply change the cell config to text and this would solve the problem but I wonder if there is a reason for the behavior, since there seems to be no mathematical reason for this.
Its simply the different format of cells you are bringing the "values from" and "pasting to". ..... numbers with parentheses are in cells with "accounting" format and negatives are stored in general or standard number formated cells. To resolve you can change the format of destination cells to accounting using cell formatting as number>accounting.
To answer the why, it's because accountants put negative numbers in brackets for readability
Unfortunately, this is one of the excel feature/bugs that helps some folks and frustrates others. When opening a file or pasting content, excel will immediately and always try to parse any values into formats it deems appropriate, which can mess up data like:
Zip Codes / Tel. # → Numeric: 05401 → 5401
Fractions → Dates: 11/20 → Nov, 20th YYYY
Std. Errors → Negative Numbers: (0.1) → -0.1
For some workarounds , see Stop Excel from automatically converting certain text values to dates
Once the file is open/pasted, the damage is already done. At that point, your best bet is:
Updating the field and displaying as text (appending with ') to prevent re-casting
Formatting the field if the operation wasn't lossy and is just presenting the info differently
Running a clean if/else to pad or other convert your data based on the identified errors
Specific to displaying values back in parens, if excel is converting them and treating them like negative numbers (which may or may not be the appropriate way to actually store the data), you can apply a different format to positive and negative numbers to wrap back in parens.
It is standard practice to write negative values as numbers in parentheses, especially in accounting. This makes negative values stand out much more than a simple negative hyphen; compare -1 and (1).
Excel is a tool very commonly used by accountants and supports accountant-style spreadsheets. Therefore, entering (100) means having a value of -100, even if there is no minus hyphen!
Here is a fun fact, if you enter (-10), Excel will treat it as normal text.

Specific number FORMAT mask like #,###,##0.0### that would force Excel GENERAL NUMBER format?

What custom format mask will display 3.0 as 3 and 3.10 as 3.1?
I am trying to support a Cognos report that uses custom SQL that selects from an Oracle column that is defined as NUMBER(11, 4). if I do not apply any formatting to the.1 column on the report, the resulting Excel column has "Number " category formatting applied with 4 decimals.
As a result, I see the following sample formatted values displayed:
a) 4,123.3400
b) 4.0123
c) 4.0100
d) 3
e) 0.10000
I would prefer to see only significant zeros afer the decimal point displayed. For example, 4.0100 should be 4.01 but otherwise the formatting is fine. When the number is a whole number, I prefer not to display a decimal point at all. For example, 3 is preferable to 3.0 for values with no fractional part.
I tried experimenting with custom formats and the closest that I can come to what I am looking or is this format
#,###,##0.0###
which produces:
a) 4,123.34
b) 4.0123
c) 4.01
d) 3.0
e) 0.1
There are two differences between using no format, the first example and my custom format:
Whole numbers are displayed with one zero after the decicimal (d)
Trailing insignificant zeros after the decimal are suppressed. (a)
What I woold like to see is the following, the difference with the opreceding example is that whole numbers are displayed without any decimal (d):
a) 4,123.34
b) 4.0123
c) 4.01
d) 3
e) 0.1
Excel acheives this by default with its "General" format, however, the trick is trying to get Cognos to produce that setting using custom SQL that selects from a NUMBER(11, 4) column. As mentioned above, going with the default format results in Excel output that uses the General format but has 4 decimal places, so I get 4 decimals of precision if there is any faction part. The csolution appears to be to use a custom format.
Can my format
#,###,##0.0###
be tweeked to work like Excel's General format for numbers?
The answer is no, you can't get all the formatting you want with one single format.
You should know that even Excel's General does not get everything you want, because that doesn't provide thousands separators.
You'll have to pick something to give up. If you can give up the commas, then why not just use General?
Also note that you have superfluous # marks. Your formatting is equivalent to #,##0.0###.
See this related question for potential further ideas.

Resources