paul_apted Posted July 26, 2002 Posted July 26, 2002 is there a way to find the line count in a field and then display that in a containing field? thanks paul apted
Kurt Knippel Posted July 26, 2002 Posted July 26, 2002 patterncount ( Field, "<paragraph symbol>" ) + 1 will count the number of line in a field assuming that each "line" is a distinct element, like in a list or checkboxes or something. Counting the "lines" in a paragraph is near impossible, since the "lines" are simply an effect of the size of the field, the words and the font; very nebulous at best.
BobWeaver Posted July 26, 2002 Posted July 26, 2002 I created a silly little demo that counts lines of wrapped text (with or without carriage returns) in a text field. You can find it on my download page: http://members.shaw.ca/indexel/download.htm
danjacoby Posted July 27, 2002 Posted July 27, 2002 Yup, it's silly. Especially since your 27-line field calculates to -6 lines. Haven't checked all the scripting yet, but it seems to me that something ain't right.
mborgens Posted July 27, 2002 Posted July 27, 2002 It worked fine for me, but it does count excess returns at the end of the block. mb
danjacoby Posted July 28, 2002 Posted July 28, 2002 I added two carriage returns, and it gave me a -4 result. I downloaded the Mac version; perhaps that version has the error in the programming.
mborgens Posted July 28, 2002 Posted July 28, 2002 I'm using Mac and it worked; are you using system 10?
BobWeaver Posted July 28, 2002 Posted July 28, 2002 Yeah. When I said silly I meant it. It just barely works (but apparently not always) at the limits of Filemaker's print preview accuracy. There is no difference between the Mac and Windows version other than the file compression method. In theory, you create a layout that has headers/footers so big that the body part has page breaks after every line. You place an exact copy of the field whose lines you want to count on the layout. Then you simply do the trick of going into preview mode and counting pages. When I first thought of doing this, I figured that it should be a piece of cake. Then, when I actually set it up, I found out that Filemaker seems to get very confused when you set up a layout like this, and text starts to skip pages and behave very erratically. I had to play around with it for a long time to get it to work on by computer. So, if you are using this on a different system than what I set it up on, it will require some layout tweaking, and it's possible that it may not work at all. On the other hand I have used a similar technique to automatically pick a layout that best displays certain field data. In this situation, I have several nearly identical layouts, the only difference being the width and position of the field in question. Rather than shrinking the body part to a single line, you just arrange the field so that if there are too many lines to display neatly, it will flow over to the next page. Again, you go to preview mode and see if there is more than one page. If so, then you try the next layout and repeat until you find one that fits everything onto a single page.
Recommended Posts
This topic is 8158 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 accountSign in
Already have an account? Sign in here.
Sign In Now