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.

Crop Text w/ Ellipsis?

Featured Replies

Hi, I have text that exceeds the portal size. I'd like to crop the text, but include an ellipsis to indicate that there's more to read. Any thoughts on how to do this?

Thanks!!! :)

Because most display fonts are now proportional there is no easy method to get the amount of the text that will fit into a given space. All that we can work with is the actual character count which is returned by the Length() function.

So, create a calculation field that truncates the text after a number of characters and adds the ellipsis.

Case( Length( text ) > XX ; Left( text ; XX ) & "..." ; text )

  • Author

Thanks very much! One quick newbie question tho... where do I put this calculation?

Btw I created a portal for this info in Layout View of the destination table... therefore, I cannot actually see this particular field in the Manage Databases view. Will gladly undo that if needed. :)

Create a new cal field in the related table and display this in the portal instead of the main field.

Also, you may wish to add a tooltip to this field which displays the stored field (not the abbrev. calc). So the user can hover over the field and see all the text.

I don't see a need for a new calc field.

In your portal, just make the field a little shorter than you normally would. Add a text box with the ellipsis and conditional formatting to make it appear based on the Length() of the child field.

I don't see a need for a new calc field.

I see the need for that calc field, otherwise he needs to use a monospaced font for his field.

Why does the solution using a conditionally formatted text box require a monospaced font while the one using a calculation field does not?

The text is going to get cut off anyway, there's no need for a calculated field to do it for you.

You don't even need conditional formatting if the text is always larger than the field. It's unclear if the text is ever shorter than the box size.

Look at this examle:

The field contains: "conditionally formatted" in one row and "require a monospaced font" in another row, but we need to dispay only 16 chars

conditionally fo

require a monosp

where do you put the ellipsis ?

On the contrary the calculted field could solve easily the problem.

  • Author

OK so I tried the new calc field. I must have done something wrong b/c it's not truncating...

Here's what I want to do:

Goal: In the Destination table, look at the NOTES field from the Related table. Copy the text, truncate at 52 characters, and add an ellipsis.

Here's what I did:

1: Create a new Calc field in the Related table called NOTES TRUNCATED:

Case( Length( NOTES ) > 52 ; Left( NOTES ; 52 ) & "..." ; NOTES )

2: Reroute NOTES portal in the Destination table to look at the new field NOTES TRUNCATED in the related table.

Here's what is happening...

The NOTES field on the Destination table is, in fact, displaying the NOTES field from the Related table. So something must be going right.....

But it is def not truncating. :/

Any thoughts?

DJ -- the Notes field does not always exceed 52 characters... in fact it's often empty.

Your description is somewhat confusing. Assuming you have a portal into the Related table placed on a layout of Destinations, all you need to do is to place the calculation field in the portal instead of the Notes field.

  • Author

Hmmmm....

Tried that, but still not truncating.

Destination table: SUMMARY

Related table: QUESTION TO SOLUTION

In the NOTES field of SUMMARY:

Case( Length( question to solution::Notes ) > 52 ; Left( question to solution::Notes ; 52 ) & "..." ; question to solution::Notes )

Is there some other setting I have to change or something?

Destination table: SUMMARY

Related table: QUESTION TO SOLUTION

I have no idea what you mean by that. Does this work for you?

TruncateText.zip

Destination table: SUMMARY

Related table: QUESTION TO SOLUTION

In the NOTES field of SUMMARY:

Case( Length( question to solution::Notes ) > 52 ; Left( question to solution::Notes ; 52 ) & "..." ; question to solution::Notes )

Your new field should be in QUESTION TO SOLUTION not in SUMMARY.

Or you could do it this way:

mysandbox.fp7.zip

  • Author

Thanks for all your help!!

comment and DJ, thanks for the examples. They helped me figure out exactly what I was doing wrong.

I'd like to reply directly to some of your comments, but I can't figure out how to do the cool quote thing. (Newbie to message boards as well as FileMaker :unsure: ) Pls help!

but I can't figure out how to do the cool quote thing. (Newbie to message boards as well as FileMaker :unsure: ) Pls help!

Use the Reply button that is just below the Post, not the Add Reply under the post.

  • Author

Use the Reply button that is just below the Post, not the Add Reply under the post.

Thx!!

  • Author

Your new field should be in QUESTION TO SOLUTION not in SUMMARY.

Or you could do it this way:

Thanks DJ, your solution was interesting b/c I can edit the NOTES field in the SUMMARY layout. With a Calc field in the SUMMARY layout, I don't seem to be able to edit the notes, just read them.

It does seem strange that you can't truncate exactly. I get that it's easier with a monospaced font. But even with a variable width font, it would seem not that hard. I mean, the program already knows how wide each letter is. Is there a way to just tell it what font you're going to use, and say, "truncate at 10 cm" or whatever? That way, if you type "lol" it know how much space to use and if you type "www" it knows how much space to use.

Just a thought.

  • Author

Your description is somewhat confusing. Assuming you have a portal into the Related table placed on a layout of Destinations, all you need to do is to place the calculation field in the portal instead of the Notes field.

Yeah, I get it now... thanks to your example.

The problem was, back before I had discovered the magic of portals, I tried using a regular old lookup field. Then, when I went back to try to implement the calc field as you guys suggested, I accidentally rerouted that to look at the truncated notes calc, rather than the active portal.

Anyway, thanks for your help!!!

Quick question to make sure I'm using the terms right....

Destination table: the place where you want the text displayed (also called a child table?)

Related table: the table that's storing the text (also called a parent table?)

the program already knows how wide each letter is.

Actually, it doesn't. Al least not at the data level, where the calculation must take place.The rendering of the layout is done "on-the-fly" and depends on a lot of external parameters (OS and font). For example, you could get different spacing just by replacing your Helvetica font with a third party Helvetica font.

Destination table: the place where you want the text displayed (also called a child table?)

Related table: the table that's storing the text (also called a parent table?)

I think you have it backwards: a portal shows records from the child (many) table. The portal sits on a layout of the parent (one) table.

  • Author

Actually, it doesn't. Al least not at the data level, where the calculation must take place.The rendering of the layout is done "on-the-fly" and depends on a lot of external parameters (OS and font). For example, you could get different spacing just by replacing your Helvetica font with a third party Helvetica font.

I think you have it backwards: a portal shows records from the child (many) table. The portal sits on a layout of the parent (one) table.

Oh I see. That makes sense.

So Destination table = parent table and Related table = child table?

So Destination table = parent table and Related table = child table?

LOL, I don't know - those terms mean nothing to me. A child is related to parent and parent is related to child. I suggest you name your tables by what a record represents, e.g. Customers, Invoices, Questions, Answers, etc. Then when you say 'one customer has many invoices' or 'a question can have many answers' the relationship becomes clear.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.