Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Displaying **** for truncated data Post Reply Post New Topic
Page  of 2 Next >>
Author Message
gitanjali1027
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 25
Quote gitanjali1027 Replybullet Topic: Displaying **** for truncated data
     Posted: 23 Apr 2010 at 3:42am
Hello!

I was wondering if there was a way in Crystal to do the following:


If a field has a character limit of 10 characters...and the data fed in has 11 characters, instead of showing truncated data, i'd like it to show **** .  Excel has a function like this where if a column is too narrow for a field to show completely, it shows ###### instead of the data.

Is there a way to do this for numeric fields and string fields?


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Apr 2010 at 4:39am
It should do that for numeric already.
For strings you would need to write a formula
if length(field)<11 then feild else '****'
IP IP Logged
gitanjali1027
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 25
Quote gitanjali1027 Replybullet Posted: 23 Apr 2010 at 5:26am
Would i have to create a new formula field?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Apr 2010 at 8:35am
Yes create a formula field using the above formula then use it for display on the report canvas
IP IP Logged
gitanjali1027
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 25
Quote gitanjali1027 Replybullet Posted: 23 Apr 2010 at 8:42am
I tried this:

if length{DataTable1.Name} < 4 then {DataTable1.Name} else '*****'

it kept highlighting the first {DataTable1.Name} and saying "the keyword then is missing'


Edited by gitanjali1027 - 23 Apr 2010 at 8:42am
IP IP Logged
gitanjali1027
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 25
Quote gitanjali1027 Replybullet Posted: 23 Apr 2010 at 8:47am
Also--just to mention this, i found that even numeric values on my report DO NOT get the ### if the column is too narrow.  instead, it truncates the numbers.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Apr 2010 at 10:38am
if length({DataTable1.Name}) < 5 then {DataTable1.Name} else '*****'
 
I think there is s setting in the numeric field as to display as #### or truncated if the does not fit but I am not at a location to check this right now.
Can anyone else give specific direction on the ####?
 
If you cannot find it then you can switch it to a string
if {table.numberfield} >9999 then '####' else totext({table.numberfield},0,'')
 
this last part strips out decimals and any ',' formatting.


Edited by DBlank - 23 Apr 2010 at 10:39am
IP IP Logged
gitanjali1027
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 25
Quote gitanjali1027 Replybullet Posted: 26 Apr 2010 at 3:42am
i'm trying this--except when i did this, it displayed all asterisks.  for example...for my # of investments field, the max limit of characters is 6 characters.  should the db feed anymore characters in asterisks should appear.

i tried the formula and have this:
If {DataTable1.No of Investments}>6 then '****' else totext({DataTable1.No of Investments},0,"")


Now every single row's # of Investments field is an asterisk when the db is NOT feeding in more than 6 characters worth of data.

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Apr 2010 at 3:47am
If {DataTable1.No of Investments}>6 is not the number of characters, it is the actual number 6. So if the field value is 7 to infiniti then it will display the *****. It would only display the numbers 0  through 6.
try:
If {DataTable1.No of Investments}>99999 then '****' else totext({DataTable1.No of Investments},0,"")


Edited by DBlank - 26 Apr 2010 at 3:48am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 26 Apr 2010 at 3:54am
Note:
in a numeric field,
right click,
select Format Field,
select Numbers tab,
Selct Customized
Select Number tab
the 'Allow Field Clipping' option toggles the use of teh '###' or partial number showing if the field on the report canvas is too small to display tha actual value.
 
I still think you want to use the formula function because you want a specific maximum value rather than space on the canvas but wanted to explain this just in case.


Edited by DBlank - 26 Apr 2010 at 4:00am
IP IP Logged
Page  of 2 Next >>
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum