Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Displaying records on Detail section Post Reply Post New Topic
Author Message
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet Topic: Displaying records on Detail section
     Posted: 07 Mar 2014 at 12:55am

I am doing a report and have come up with the following problem.

 

If you use the criteria to select one record then all the details are displayed correctly. If you select the criteria for more than one record then the records are selected but the record is not displayed on the screen unless I increase the detail section in size.

 

Displayed for 1 record

1 High Street

 

Displayed for more than 1 record (I have to increase  detail section to display)

1 high Street

 

The problem seems to be if there is no {@address2}.

 

An example is as follows, basically the report can display 2 addresses. These addresses are in one formula field. In the formula field, called @Addresses I have the following formula.

 

 

Local NumberVar nOtherAddress := len({@Address2})

 

….some if statement but where I have the problem is here

{@Address1} +

iif(nOtherAddress > 0, {@Address2} , “”,

 

 

I have tried trim etc but no luck. In the format field of @Addresses, the following is ticked

Can grow, keep object together, close border on page break. Apart from that nothing else is changed.

 

There must be something I have missed out or doing wrong. Basically I am stumped????

IP IP Logged
hello
Groupie
Groupie
Avatar

Joined: 05 Feb 2014
Online Status: Offline
Posts: 85
Quote hello Replybullet Posted: 07 Mar 2014 at 3:44am
Maybe @Address2 has spaces in the field and len is counting the spaces and calculating a number > 0...so it displays spaces on the report.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Mar 2014 at 4:13am
just to be clear, the @Addresses formula file is always returning the correct results but is is not growing (height of text box expanding) when there is a line return in it?
@Addresses uses two other formula results in it ({@Address1} and {@Address2}) and both of these formuals work fine independently if placed on side by side on the same detail row.

Is that an an accurate description?
 
Or are you expecting it to grow horizontally and not vertically?


Edited by DBlank - 07 Mar 2014 at 4:15am
IP IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet Posted: 07 Mar 2014 at 4:28am

At first I thought that there was no records but when I increased the detail section, the values where there with no blank lines. I have tried to put the formula into a text box and suppress the blank lines, trimed the @address, @address1 & @address2 but still the same results.

If I have 2 addresses say 1 High Street, 2 Main Street. If the criteria only returns 1 address say 1 Main Street, I would expect 1 Main Street to be displayed and that what happens but for some strange reason if I do multi records only when I increase the detail section does 1 Main Street appear.
 
I am really confused and sorry if I have not been clear. Hope this helps.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Mar 2014 at 4:48am

Are these two addresses from the same table?

When you place the seperate address1 and address2 formulas onto the report side by side do they 'work correctly'?
 
how many rows of data are there per 'person' that the addressess are associated to?
IP IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet Posted: 07 Mar 2014 at 5:11am
Yes.
 
If for example a person has a house in Main Street and also High Street then it will be displayed as
 
High Street
Main Street
 
They may only have a house in say High Street so the output would be
 
High Street
 
I check to see the length of @Address2 as below
 
local numbervar nOtherAddress := @Address2
 
@Address1 + iif(nOtherAddress > 0, @Address2, "")
 
I have checked to make sure nOtherAddress returns a value and it does either 0.00 or > 0 value is returned.
 
Thanks again for helping.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 07 Mar 2014 at 5:34am
what exactly is the code for each of the @Address1 and @Address2 formulas?
IP IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet Posted: 11 Mar 2014 at 2:24am
Sorry for the delay but I was out of the office until today then I remembered still got this problem.
I think the problem maybe with the other fields. I think I will look at redoing these fields and hope this fixes the problem. It is I just do not understand that when I view only 1 record, it works but more than 1 and it does not and I have to increase the detail section.
 
I will let you know how I get on.
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 11 Mar 2014 at 4:59am
perhaps I'm confused.

Sounds like there are embedded carriage returns, though one would think that Can Grow would take care of that.

What does this do?
local numbervar nOtherAddress := @Address2

@Address1 + iif(nOtherAddress > 0, @Address2, "")

if @address2 is a street address, does it convert to a numeric. VB was odd that way, and I guess it would...

I'm with DBlank in wanting to see the logic of code.
IP IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet Posted: 13 Mar 2014 at 5:25am

Basically, I started from the beginning, amending formulas etc and it now works. Not got a clue why it did what it did but is now working as I want it. It still baffles me why it did that and by only increasing the detail section did it work.

 
When I have time I will re-investiagte the problem and keep both of you informed of my results.
 
Thanks again for all your advice.
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