satone Posted January 30, 2011 Posted January 30, 2011 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!!! :)
Vaughan Posted January 30, 2011 Posted January 30, 2011 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 )
satone Posted January 30, 2011 Author Posted January 30, 2011 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. :)
Vaughan Posted January 30, 2011 Posted January 30, 2011 Create a new cal field in the related table and display this in the portal instead of the main field.
bcooney Posted January 30, 2011 Posted January 30, 2011 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.
David Jondreau Posted January 31, 2011 Posted January 31, 2011 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.
Raybaudi Posted January 31, 2011 Posted January 31, 2011 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.
David Jondreau Posted January 31, 2011 Posted January 31, 2011 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.
Raybaudi Posted January 31, 2011 Posted January 31, 2011 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.
satone Posted February 1, 2011 Author Posted February 1, 2011 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.
comment Posted February 1, 2011 Posted February 1, 2011 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.
satone Posted February 1, 2011 Author Posted February 1, 2011 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?
comment Posted February 1, 2011 Posted February 1, 2011 Destination table: SUMMARY Related table: QUESTION TO SOLUTION I have no idea what you mean by that. Does this work for you? TruncateText.zip
David Jondreau Posted February 1, 2011 Posted February 1, 2011 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
satone Posted February 1, 2011 Author Posted February 1, 2011 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 ) Pls help!
Lee Smith Posted February 1, 2011 Posted February 1, 2011 but I can't figure out how to do the cool quote thing. (Newbie to message boards as well as FileMaker ) Pls help! Use the Reply button that is just below the Post, not the Add Reply under the post.
satone Posted February 2, 2011 Author Posted February 2, 2011 Use the Reply button that is just below the Post, not the Add Reply under the post. Thx!!
satone Posted February 2, 2011 Author Posted February 2, 2011 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.
satone Posted February 2, 2011 Author Posted February 2, 2011 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?)
comment Posted February 2, 2011 Posted February 2, 2011 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.
satone Posted February 2, 2011 Author Posted February 2, 2011 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?
comment Posted February 2, 2011 Posted February 2, 2011 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.
Recommended Posts
This topic is 5043 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