Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8491 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Here's what I have done in the past to count the number of lines in a field as formatted by filemaker:

1. Set up a special "Test" layout that is completely blank except as follows.

2. Copy the text field in question from your original layout and paste it into this new layout. That way, you know that the field is exactly the same width and the font, style and font size are identical to the original field on the original layout.

3. Create a really big header that is the size of your printed page less one line. If you have the "show page breaks" option selected, you will see that you get a whole bunch of page breaks spaced one line apart throughout your body part of the layout.

4. Place the text field so that its text baselines line up with the page breaks. You will likely have to tweak your header size to get these to line up. Set the sliding/printing options for the field to slide up, and reduce enclosing part.

5. Create a global variable called gLineCount and a number field called LineCount.

6. Create the following script:

Show all records

Omit Record

Show Omitted

Go to Layout [TestLayout]

Enter Preview Mode

Go to Record/Request/Page [Last]

Set Field [gLineCount, Status(CurrentPageNumber)]

Enter Browse Mode

Set Field [LineCount, gLineCount]

Go to Layout [original layout]

Here's what happens. With the layout set up as described, you will get a new page for each line in the field based on how filemaker decides to line-wrap the field. Therefore, the total number of pages is equal to the total number of lines in the field. The script sets the global field and then the LineCount field to this value, so after you run the script, LineCount will be equal to the number of lines in the field.

The disadvantage is that you have to run this script once for each record, and it can be kind of slow. So, I suggest making it part of a validation routine that you run whenever a record is created or edited.

Posted

Bob: Thanks for your suggestion, but in this case it won't do me any good.

What I didn't mention is that I have other fields on the layout that I can't move in any way (no sliding/printing) as these are repetitions, etc.

This is data that resides on one record and does have some hard returns in it. So what I have is a mixture that I need to count.

I don't mind repeating the other fields on subsequent pages, but sliding seems to me to be a very crude approach with rather ugly looking results. Surely someone must have solved this problem by now?:

[ August 28, 2001: Message edited by: Steveinvegas ]

Posted

I'm using FM5 on Win98. I've got a text field on a layout that is used to collect notes and will extend over a page or more. Making the layout long enough to hold the maximum (if I even knew it, which I don't) and then sliding and printing leaves me with a very ugly output.

I tried counting CRs, but the only ones in the field are the ones I put in after the user has entered his note. His note is entered through a Troi dialog without any CRs...just one long string. I then append and date stamp the latest note to all the previous ones.

What I really want to do is count both hard and soft carriage returns. Filemaker obviously knows how to break a string up and it fits as many words as it can within the constaints of the field width. I tried figuring out how many characters can fit on one line, but this is imperfect because different characters use different amounts of space (a line of 'i's versus a line of 'w's for example).

Utimately, I'd like to count lines, pull off and print as many as will fit,

go back and do it again. Does anyone have any suggestions?

Posted

If you know that there is a hard return between each user note (you probably don't want to cut it off in the middle of a note), you can lop off the bottom one this way:

AllExceptLast = Left(TextField,Position(TextField,"

This topic is 8491 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.