Question

There was a similiar question here, but the accepted answer results in an error for me. Here is an example of the code I'm running:

<cfloop query="var_recv_num_qry">
 <cfdocument filename="#var_recv_num#.pdf" format="PDF">
....
 </cfdocument>
</cfloop>

Basically I am looping through a data set of ID's which get used to created x number pdf's which filenames are the ID's, and the file gets saved to the server. Running this code when limiting the loop to one iteration works as intended (pdf gets created on disk), but when looping through more than one iteration I run into the following error:

Routines cannot be declared more than once.
The routine localUrl has been declared twice in different templates.

I've found some mention of this issue being resolved in CF8 hotfixes, but I'm running CF9.0.1

Any help is much appreciated. Thanks.

Was it helpful?

Solution

Are you using CFINCLUDE inside of the loop anywhere? If so, does that included file define a function named "localUrl"? The loop would include that file in each iteration, causing multiple functions of the same name to be declared. ColdFusion doesn't override the previous definition of a function, it'll throw an error like that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top