Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Coldfusion MX7-  how to truncate output data?

Posted on 2007-11-14
4
Medium Priority
?
1,641 Views
Last Modified: 2010-04-21
I have a results/detail page set and on my results page I have a field called remarks which is typically very lengthy 500 characters or more, I want to be able to show a preview of the remarks on my results page, limiting the ouput to 100 characters. How can this be accomplished?

Many Thanks!
0
Comment
Question by:Bang-O-Matic
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
erikTsomik earned 1200 total points
ID: 20286060
try something like this


<cfoutput>#left(Comment,100)#</cfoutput>

Open in new window

0
 
LVL 52

Expert Comment

by:_agx_
ID: 20286069
You might also be interested in one of the functions at cflib.org: FullLeft().  It won't chop off the text in the middle of a word.
http://cflib.org/udf.cfm?id=329&enable=1
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 800 total points
ID: 20286095
Another good function is:  

FormatTeaser()
http://cflib.org/udf.cfm?ID=832
..  display n number of characters from a string with out cutting of in the middle of the word. The function will display a link at the end of the string if it is longer than the number of characters desired ..
0
 

Author Closing Comment

by:Bang-O-Matic
ID: 31409276
Thanks for the help!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question