[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 705
  • Last Modified:

cfloop with Cfheader and Cfcontent

I'm trying to use cfloop with cfheader and cfcontent inside the loop so to that I can produce multiple excel output files with a recordset variable name.

It seems like the cfheader statement is only recognized the first time through the loop.

Do anyone have any suggestions or other tags to use.

1 Solution
You can not do this on the same page.  You can only send cfheader once per page.  That sets the header of the page.

A better way to do what you want is to have a first page that has links to each of the files.  Then each link creates ONE file.

<a href="Report.cfm?ID=1">Report 1</a>
<a href="Report.cfm?ID=2">Report 2</a>
<a href="Report.cfm?ID=3">Report 3</a>
<a href="Report.cfm?ID=4">Report 4</a>

(the above can be created dunamically with the cfloop)

Then the report page generates one report based on the ID sent in.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now