Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Growing Post Reply Post New Topic
Author Message
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Topic: Growing
     Posted: 21 Mar 2012 at 12:44am
Hi all,

I've got a question. I am sending out letters to different clients. It is possible that these clients have only one name, but it is also possible that there are 2 names. Because of the database, I had to create a subreport to select the names.

Now I am wondering, if it is possible to have the lowest name on the same position, and if there are 2 names, just move the first name up. Kind of like 'Can grow', but if it can grow, it needs to grow to the top instead of the bottum.

Is this possible?

Thanks in advance

Gerben
IP IP Logged
rkrowland
Senior Member
Senior Member
Avatar

Joined: 20 Dec 2011
Location: England
Online Status: Offline
Posts: 259
Quote rkrowland Replybullet Posted: 21 Mar 2012 at 12:59am
You could create 2 separate formula fields, top and bottom.
 
In top put something like;
 
if isnull({table.namefield2}) = true then "" else {table.namefield1}
 
In bottom;
 
if isnull({table.namefield2}) = true then {table.namefield1} else {table.namefield2}
 
In your report place bottom where you'd like the name to display by default and place top above it.
 
bottom will display the first name if there isn't a second name, and the second name if there is.
 
top will display nothing is there isn't a second name and the first name if there is.
 
Regards,
Ryan.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 21 Mar 2012 at 3:44am
depending on what version you are using here is a different approach,
you can also insert a text box
drag the name you want listed first when it exists into the text field
insert a carriage return
drag the next name into the text field on the second row
right click onthe text object
select common
check 'suppress embedded field blank lines'
check 'can grow'
hit ok
set teh field height to only show one row height
IP IP Logged
Gurbs
Senior Member
Senior Member
Avatar

Joined: 16 Feb 2012
Location: Ireland
Online Status: Offline
Posts: 216
Quote Gurbs Replybullet Posted: 22 Mar 2012 at 12:08am
In the end, I solved it differently. In my subreport, I created 3 formula's. 1 showing the first client, and 1 showing the second client. After that, in the third formula, I created a formula based on what Ryan said, if client 2 is null then client 1, otherwise show both.

I then created a last formula, showing first the formula with the clients, and after that the address. This way, it will always put the address directly under the client, wether it is 1 or 2 clients.

Thanks for all your help guys
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