Solved

Coldfusion MX7-  how to truncate output data?

Posted on 2007-11-14
4
1,623 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
erikTsomik earned 300 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 200 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
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 …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

756 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