July 26, 200223 yr is there a way to find the line count in a field and then display that in a containing field? thanks paul apted
July 26, 200223 yr 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.
July 26, 200223 yr 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
July 27, 200223 yr 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.
July 27, 200223 yr It worked fine for me, but it does count excess returns at the end of the block. mb
July 28, 200223 yr 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.
July 28, 200223 yr 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.
Create an account or sign in to comment