COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => Report Studio => Topic started by: seven71d on 03 Aug 2007 12:17:03 PM

Title: Patterns - text and numeric
Post by: seven71d on 03 Aug 2007 12:17:03 PM
Hello,
I can't find any good reference on how to use the "patterns" to format a numbers/text.
I've got a cheque number with a letter appended on the end.
I would like to format it with spaces and suppress leading zeros.  example 123 456789E
I can't find specific documentation on what is valid as text or numeric patterns.
I only find date specific patterns for text and numerics.

Any help? or solutions?
thanks.
Title: Re: Patterns - text and numeric
Post by: Suraj on 03 Aug 2007 04:01:25 PM
Try using replace() function to replace 0 with empty string.
--
suraj neupane
Title: Re: Patterns - text and numeric
Post by: DSR on 05 Aug 2007 08:10:51 AM
Hi

If your check number is always having only 1 character at the end then

u better to divide into two parts and then concatenate
it by using a space in between those two  substrings.

I hope it will work for u

Thanks
Title: Re: Patterns - text and numeric
Post by: seven71d on 13 Aug 2007 10:26:37 AM
thanks - i've used a combination of trims/substrings stmt's to get the result.

But does anybody know what are valid text/numeric patterns you can use in the DATA FORMAT property option.

thanks.
Title: REPORT STUDIO USER GUIDE - Appendix H: Using Patterns to Format Data
Post by: Andrei I on 14 Aug 2007 07:13:59 AM

...
Pattern Guidelines
When you define a pattern, the number of symbols you use affects how the data will be shown.
There are different rules for text, numbers, and values that can take the form of text or numbers.
Text
You can specify whether text is produced in full or abbreviated form.
Numbers
The number of symbols you use in a pattern sets the minimum number of digits that are produced
in a report. Numbers that have fewer digits than specified are zero-padded. For example, if you
specify mm for minutes, and the database value is 6, the report will show 06.
Note: The year value is handled differently. If you specify two symbols for year, the last two digits
of the year value is produced. For example, yyyy produces 1997, and yy produces 97.
Text and Numbers
For values that can produce text or numbers, such as months, you can specify whether text or
numbers are produced, and whether words are abbreviated.
Number of symbols Meaning Example
4 or more Full text form EEEE produces Monday
Less than 4 Abbreviated form EEE produces Mon
Number of symbols Meaning Example
3 or more Text MMMM produces January
MMM produces Jan
Using Patterns to Format Data
Less than 3 Numbers MM produces 01
M produces 1

...
0 A digit that is shown even if the value is zero.
# A digit that is suppressed if the value is zero.
. A placeholder for decimal separator.
, A placeholder for thousands grouping separator.
E Separates mantissa and exponent for exponential formats.
; Separates formats for positive numbers and formats for negative numbers.
- The default negative prefix.