• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Skipping errors and moving on

LEGEND ,
Oct 01, 2007 Oct 01, 2007

Copy link to clipboard

Copied

I have data files (.txt) supplied by a company. Sometimes the data is bad
and causes the site to crash. Is there a way to read record 1 and if it is
bad, skip it and move to number 2.

It is not imperative to have ALL the records. If a couple are not inserted,
it will not affect the project. Its mostly just filled records for a search.

I am using cfhttp to read and render the text files record into a query.

Thanks

--
Wally Kolcz
MyNextPet.org
Founder / Developer
586.871.4126


TOPICS
Advanced techniques

Views

283

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 01, 2007 Oct 01, 2007

Copy link to clipboard

Copied

cftry/cfcatch

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 01, 2007 Oct 01, 2007

Copy link to clipboard

Copied

Something like?:

<cfloop query="Property">
<cftry>
<cfquery name="loopProperty" datasource="bpopros">
Really long insert statement here..
</cfquery>
<cfcatch type="database">
Email or log the error here...
</cfcatch>
</cftry>
</cfloop>

I am not sure what type of catch type it would be. Its more an error that
would be generated from the text file (improper columns, illegal characters,
etc).

Would this step over the error and continue to loop through the document?


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 01, 2007 Oct 01, 2007

Copy link to clipboard

Copied

LATEST
Try it with some bad data and see.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation