Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Specifying Character Length for a Parameter Field Post Reply Post New Topic
Author Message
gitanjali1027
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 25
Quote gitanjali1027 Replybullet Topic: Specifying Character Length for a Parameter Field
     Posted: 14 Apr 2010 at 9:58am
I have 2 parameters in the header section of my report.  I'd like to make it so that only 15 characters can be populated in one of the parameters.  However, the data coming in may be more characters than that...but I am not sure how to specify just the parameter to contain 15 characters and NOT truncate the data programmatically.

Anybody have any ideas?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 14 Apr 2010 at 10:28am

can you explain the reason for this requirement as there may be a differenet approach to what you are tryig to do and are you making this a dynamic parameter?

IP IP Logged
gitanjali1027
Newbie
Newbie
Avatar

Joined: 01 Apr 2010
Online Status: Offline
Posts: 25
Quote gitanjali1027 Replybullet Posted: 15 Apr 2010 at 4:25am
ok so i have a parameter named ?Sorting.  I want to make it so that this field is ONLY populated with 15 characters maximum.  The data that feeds into this report may sometimes have strings that are longer.  All i need to know is how to write a formula to truncate the string and make it so that only the first 15 chars show up.

I tried doing the max length in formatting the parameter but it tends to cut characters off in the middle of the letter.  I tried a formula like this:

{DataTable1.Table} = (left{DataTable1.Table}, 15)

but it doesn't work for param fields--only report fields.  Is there an equivalent for parameters?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Apr 2010 at 4:49am
Well it sounds like you are using a dynamic parameter. You have to truncate the field before it gets into crystal for this to work.
Depending on your source and what rights you have you could do this in a Stored proc or a sql view. If you have to do it all in crystal you can use a crystal command. You would need to write the command to pull the 2 fields of data, one for joining to your regular table and the other as the truncated field that you can use as the source for your dynamic parameter.
An example:
 
select employerid, left(employername,15) as ShortName
from employers
 
Join this back to the original 'employers' table on the employerid
use the new ShortName field as your paramter source
IP IP Logged
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