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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

page break based on formula value

Status
Not open for further replies.
Aug 27, 2003
428
US
Hi,

I am using Crystal Reports with VB Dot Net. I would like to add a confition to page break the report when the value for the formula @AddressInformation is different.

For example if the formula is as below: When any of the values of Address1, Address2, Address3 and Country are different, I need to show the report detail data in a separate page rather than showing all in the same page.

As an illustration if the address for all Titles is the same as below

123 Main Street
New York, NY
United States


ID Name Title
1 John ABC
2 Frank XYZ
3 Josh ABC

As an illustration if the address for a Title is different as below, then the page should break.

For Title ABC below address

123 Main Street
New York, NY
United States

For Title 123 below address

123 Canada St
London,
United Kingdom

Page 1

ID Name Title
1 John ABC
3 Josh ABC

Page 2

ID Name Title
2 Frank XYZ




Dim result as String

if ISNULL({Detail.Address1}) = False and {Detail.Address1} <> "" then
result = result + {Detail.Address1} + chr(13)
end if

if ISNULL({Detail.Address2}) = False and {Detail.Address2} <> "" then
result = result + {Detail.Address2} + chr(13)
end if

if ISNULL({Detail.Address3}) = False and {Detail.Address3} <> "" then
result = result + {Detail.Address3} + chr(13)
end if

if ISNULL({Detail.Country}) = False and {Detail.Country} <> "" then
result = result + {Detail.Country} + chr(13)
end if

formula = result

Thanks in advance for your help

junction123
 
Insert a group on your formula and then add a condition to the group footer->new page after->x+2:

not onlastrecord

-LB
 
I want to do the page break only when the address is diferent for different title. If the address is same for the different tittle values, I do not want to page break. Will your solution work? I will try and test.

Thanks
junction123
 
LB,

I just tested it. Report appears fine. When address changes the data appears on different pages.

Just curious, how does it know to page break on an address change? Does the grouping on the formula AddressInformation solve it?

I was assuming we might need to individually check for change of address for each of the columns, Address1, Address1, Address3 and Country.

Thanks again for your help!
junction123
 
My suggestion really was just to create a page break on different addresses--regardless of title. The entire address would have to be the same to be included in the group based on your formula, so it is in fact checking each element for inclusion in the group.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top