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.

Featured Replies

I am trying to write a calculation that adds a carriage return so that lines of text will not exceed a fixed number of characters.

I got a calculation to start with from the Nightwing website (thank you Nightwing!)

But the calculation (below) does not seem to recognize when there already is a carriage return in the field being parsed. So, for example, what happens is:

LineBreakBefore (the global to set number of characters) = 20

Original Field:

Jane Johnson(carriage return)

10 University Plaza Park Northwest(carriage return)

Should Become:

Jane Johnson(original carriage return)

10 University Plaza(new carriage return)

Park Northwest(original carriage return)

But instead becomes:

Jane Johnson

10

University Plaza Park Northwest

Calculations are definitely my weak point, especially understanding how someone else's calculation already works. Hopefully this isn't totally obvious!

One potentially meaningful thing to know is that the field this calculation is processing ("Mailing Label") is itself already a calculation. Could this be a causing a problem?

Thanks for your help! I can't even put into words how grateful I am for this forum. Usually even my most complicated questions have already been answered and all I have to do is read past posts!

Here's the calculation from Nightwing:

Middle(Mailing Label, 1, Position(Middle(Mailing Label, 1, LineBreakBefore), " ", 1, PatternCount(Middle(Mailing Label, 1, LineBreakBefore), " ")) - 1) & "

I'm not sure what Ray was going for with his calculation, but this seems to work nicely.

Left( Mailing Label, Position( Mailing Label, " ", Position( Mailing Label, "

  • Author

Thank you so much!! That works great. The only problem is that it is including in the count if there is a final space at the end of each line. So sometimes it is making an extra line when there isn't actually any text there. Would sticking Trim in the calculation somewhere fix that?

Can you give me an example address where this is a problem?

  • Author

Sure. This is with LineBeforeBreak =46

Calculation:

Wellesley College

Center for Research on Women

128 Highland St.

W. Newton, MA 02465

Original:

Wellesley College

Center for Research on Women

128 Highland St.

W. Newton, MA 02465

  • Author

Now that I look at it some more I think it actually isn't counting the number of characters on each line, but still counting the overall number of characters and breaking when it hits the set number. I could be getting confused though. At first I thought it was working right...

That one has four lines, which the calculation doesn't take into account. I think a repeating calc might work better for this. I'll work on it after lunch.

  • Author

Oh, I'm sorry. I'm never sure how detailed to be...Thank you so much for helping me with this!

Okay, here's a sample that will split each line into two, if necessary, and then combine the parts back together for the label. This requires the LineBreakBefore to be a number, not a global, and the common global index to store rep numbers, as well as a lookup to copy the global index into a repeating number field that can be indexed, so that a value list can be created from the repeating calculation, sorted by the index number, forcing the split parts to be combined in the same order as the original label.

Note that this calculation assumes a single line should need to be split only once. If you have need for two possible splits per line, the calc will need to be tweaked for the additional possibility.

If you need more help, I should be around later tonight sometime.

Pittelman.zip

  • Author

Wow. Thank you Queue!!! This is exactly what I needed. Wish there were a way to send a virtual beer over to you to say thanks for all the time you spent on this!

Thank you, but that's not necessary. It was boring at work on Friday. This gave me a challenge to keep me from passing out. So I should be sending you a beer, too. wink.gif

  • Author

Then a toast with our virtual beers: Cheers! grin.gif

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.