Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Counting the number of lines?

Featured Replies

Does anyone know of a way to count the number of lines in a text field.

Thank you

Lar

Use the PatternCount function under text functions. You want to count the '

  • Author

Thanks to your response to my query Steven, you say use the pattern count function to find the carriage return character, what would happen if the lines of text do not contain any carriage returns, the field is like the contents of a letter, that the user just types into, therefore the text just flows from one line to the next - can you think of any way of doing this?

Thanks again for you help

Lar.

If "lines" are defined by formatting, they really can't be counted easily. The number of "lines" could be different for every layout and font. For proportional fonts, they would not even contain the same number of characters. If a non-proportional font (like Courier) is used, the number of lines is the size of the text field divided by the number of characters per line on the layout (assuming the user doesn't embed carriage returns).

-bd

  • 3 weeks later...

A somewhat roundabout way to count lines is to make a new blank layout and put an exact copy of your field into it. At least, the width should be exactly the same. The field height should be big enough to display the maximum number of lines that you will ever have. The layout should have a body and footer only. Size the body part so that it is exactly the same height as the field (or just a tiny bit higher). Now increase the size of the footer until a bunch of page breaks appear in the body part. Keep adjusting the footer size until the body part has as many page breaks as there are lines in the field. Set the field's sliding/printing options to slide up and shrink the enclosing part. Now, if you go to browse mode, omit all but the current record, then go to preview mode and then go to last page, the page number of the last page will be equal to the number of lines in the field.

The idea, of course, is to script it like so:

Enter Browse Mode

# Omit all but the current record

Show all records

Omit Record

Show Omitted

# Go to the layout described above

Go to Layout [TestLayout]

Enter Preview Mode

# See how many pages

Go to Record/Request/Page [Last]

Set Field [gLineCount, Status(CurrentPageNumber)]

Enter Browse mode

Go to Layout [original]

This technique, or variations of it, can be used in situations where you want to automagically select the appropriate layout (or field) depending on how the text will be displayed.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.