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

Generating new pages based on number of lines in field 1

Status
Not open for further replies.

glyph1

Programmer
Jun 15, 2007
26
Hello,

I was wondering how to generate a new page when a certain single field value grows to the max number of lines.

In my particular example I have a database field that is multiple lines in length and I want it to overflow onto a new page when it reaches the maximum number of lines (9).

Thank you for reading
 
You can find the length of the non-blank portion of a big field using length({your.field})

What is it you're wanting? To start a new page when there is not room? Or to split the multi-line field between pages? (Right click, format field and uncheck 'Keep object together').

It helps to give your Crystal version - 8, 8.5, 9, 10, 11 or whatever. Methods sometimes change between versions, and higher versions have extra options.


[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Version: Crystal Reports for Visual Studio 2005

Basically I have a page in the details box with an OLE object (which turns into an image), that is actually a form I need displayed on each page.

I am putting my database fields on top of this image and need to stay within a certain height to keep the formatting within the lines on the image. If the number of lines exceeds the max number allowed per page I want to generate a new page keeping most of the fields on the first page and adding the remaining data from the fields that did not fit in the first page.

I would assume I can somehow do this in the form editor with splitting forms based on a newline character from the database field?



Any help would be greatly appreciated thank you!
 
Maybe I gave too much information, or it cannot be done?
 
Try placing the image in the page header section. Stretch the page header so it is page size. In the section expert, format the page header to "Underlay following sections".

Then you can format the detail section to start a new page after a certain number of records by going into the formula (x+2) area for "new page after" (still in the section expert, with details highlighted) and entering:

remainder(recordnumber,45) = 0

Adjust the 45 to whatever number of records fit within your image.

-LB
 
You definitely pointed me in the right direction, but in my report there is only one record selected at a time that in turn populates a bunch of fields from a row in a database. The particular field that i want to cause multiple pages has multiple lines. So I need to generate a new page when the maxnumber of lines in the field threshold is exceeded.

There has to be some way to do this? Thank you for your help thus far though
 
How are the returns entered? You could try a formula like the following if they are entered as chr(13):

stringvar array x := split({table.string},chr(13));
ubound(x)-1

-LB
 
Where exactly would I put this formula? I tested it and it does return the number of lines in the field.

I want it to generate a new page when 9 lines are entered so I guess it would be something like,

if (x % 9)=0 .... create new page


The main problem is I don't know how to make the new page =). Thanks for your help LB I think I'm getting somewhere, but not quite there yet.
 
Actually, what you want to do is split one detail row into two pages, and I don't think that's possible. You could copy the fields into multiple detail rows (if you want the other fields to repeat on each page), and then split the field that returns multiple lines into separate fields, using the split function as above, but only referencing components 1 to 9 in the array for detail_a, 10 to 18 for detail_b, etc. In the section expert, you would then check "new page after" for all but the last detail section.

-LB
 
I just split up the pages prior to submitting it to the database. A bit of a pain but I got it working... Thanks for your help though, you helped me realize it can't be done the way I wanted it to be done! Thank you so much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top