Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal truncating trailing blanks

Status
Not open for further replies.

praveen224

IS-IT--Management
Nov 2, 2009
10
US
Hello,

I have a report which groups by a database field. One of the values in the table contains a space at the end. Looks like Crystal is removing the space.
For example,
If the values in the table are:
'Value1' and 'Value1 ' - they both are being treated as the same 'Value1'. Any idea why this is happening.

I am using Crytal Report 2008 with Oracle 11g.

Thanks for your help
Praveen
 
It probably is a 'feature'. The only way around it to create a formula so that each group value is unique (i.e., {field}&totext(len({field})) ) and group by that formula.
 
Hi,
Are there real data differences between those with and without a space at the end..Most databases will not distinguish those.
What database and what datatype is involved?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Characters in the field are identical except for the space and I need to separate the two (with and without space). I can distinguish them in the database - using Oracle 11g and the data type is varchar2.

Thanks
 
kray4660,

It looks like the field value is truncated by the time it gets to Crystal - length(field) is showing the truncated value (without the space).

Thanks
 
Hi,
Oracle does not pad VARCHAR2 fields but does do it with CHAR types:
[URL unfurl="true" said:
http://download.oracle.com/docs/cd/B10500_01/appdev.920/a96624/b_char.htm[/URL]]

When you assign a character value to a VARCHAR2 variable, if the value is shorter than the declared length of the variable, PL/SQL neither blank-pads the value nor strips trailing blanks

But, remember, when you assign a character value to a CHAR variable, if the value is shorter than the declared length of the variable, PL/SQL blank-pads the value to the declared length.

Does your data result in Oracle ( you say Oracle can distinguish between them) mean that a blank character was explicitly added to the end one of those values? Like:

Set That_Field = "Value1 "



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Turkbear,

Yes - data in Oracle has an explicit space at the end.

Thanks
 
Hi,
You could try using the Replace function to change the space to some other character ( like an _ ):

@GrouponThis
If Right({FieldName},1) = " " then
{Fieldname} + "_"
Else
{FieldName}


This should only affect the values witha trailing space.
(Maybe, it may depend on when Crystal truncates the value)


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Hi,
I changed my mind in the middle of my last post and switched from the Replace function to the Right function but did not edit correctly, so sorry for the mixed terms

The Replace function should work as well

Replace({FieldName}," ","_")

assuming no spaces anywhere else in the values.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top