Welcome!

ColdFusion Authors: Yakov Fain, Maureen O'Gara, Nancy Y. Nee, Tad Anderson, Daniel Kaar

Related Topics: ColdFusion

ColdFusion: Article

Ask the Training Staff

Ask the Training Staff

Greetings. I hope all of you who attended the DevCon last month enjoyed it, and came away with some great tips and tricks.

This month's column is short, but hopefully addresses some problems that you've encountered recently. Keep those questions coming!

Q: I have an application that allows users to upload newsletter articles into a database memo field (I'm using MS Access for my database). My problem is this: when I query the articles from the database and output them using CFOUTPUT, some of the really long articles are getting truncated. I've double-checked, and all of the text is in the database, so CF is cutting it off either in the query or during output. Any ideas?

A: Yes! The problem is not with your database or with your output. The problem is actually with the way you have your datasource set up in the CF Administrator. To improve the perfor-mance of your queries, CF only retrieves the first 65,000 characters from long text fields by default. If your articles are over 65,000 characters, they will be truncated. What you need to do is modify a setting in your datasource. In the datasource editor, select your datasource, then click the "CF Settings" button. Check the "Enable retrieval of long text" box and then click "Update". Your queries will now retrieve all the text from your memo fields. You may want to create a second datasource for this purpose if this is the only place you need to retrieve long text from this datasource. Use your primary datasource for all of your other queries and use the "long text" datasource only where you really need it.

Q: I have a page (monthlyupdates.cfm) that forces the execution of a scheduled task using the CFSCHEDULE tag: <CFSCHEDULE ACTION="Run" TASK="CreateInvoices">. What bothers me is that my update page has to wait until the CreateInvoices page completes before running any more of the code below it. I want it to launch the scheduler and keep going without having to wait for the scheduled task to complete. Is there a way to do this?

A: I can really sympathize with you on this one! However, there is a very easy work-around! What I do to get around it is this: create a second page that has only the CFSCHEDULE tag in it (let's call it "LaunchScheduler.cfm"). Then, where you were calling the CFSCHEDULE tag in your MonthlyUpdates.cfm page, replace it with a CFHTTP call to the new LaunchScheduler.cfm page. The trick is to set a short time-out setting on your CFHTTP tag so it doesn't wait for the response. See Listing 1 for an example. The process is simple. Instead of calling the CFSCHEDULE tag that waits for completion before moving on, you now call a CFHTTP tag that waits only two seconds before moving on. The result is the same, but the wait is much less.

Please send your questions about ColdFusion (CFML, CF Server, or CF Studio) to [email protected]. Please visit our archive site at www.NetsiteDynamics.com/AskCFDJ.

More Stories By Bruce Van Horn

Bruce Van Horn is president of Netsite Dynamics, LLC, a certified ColdFusion developer/instructor, and a member of the CFDJ International Advisory Board.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.