Invalid tag nesting configuration in ColdFusion 10? -
how around coldfusion error? i'm following this coldfusion tutorial. when tried implement code in coldfusion 10 got following error:
invalid tag nesting configuration. query driven queryloop tag nested inside queryloop tag has query attribute. not allowed. nesting these tags implies want use grouped processing. however, top-level tag can specify query drives processing.
the error occurred in line 76
74 : </cfloop>
75 : </tr>
76 : <cfoutput query="data" startrow="2">
77 : <tr>
78 : <cfloop index="c" list="#collist
here code:
<cfset showform = true> <cfif structkeyexists(form, "xlsfile") , len(form.xlsfile)> <!--- destination outside of web root ---> <cfset dest = gettempdirectory()> <cffile action="upload" destination="#dest#" filefield="xlsfile" result="upload" nameconflict="makeunique"> <cfif upload.filewassaved> <cfset thefile = upload.serverdirectory & "/" & upload.serverfile> <cfif isspreadsheetfile(thefile)> <cfspreadsheet action="read" src="#thefile#" query="data" headerrow="1"> <cffile action="delete" file="#thefile#"> <cfset showform = false> <cfelse> <cfset errors = "the file not excel file."> <cffile action="delete" file="#thefile#"> </cfif> <cfelse> <cfset errors = "the file not uploaded."> </cfif> </cfif> <cfif showform> <cfif structkeyexists(variables, "errors")> <cfoutput> <p> <b>error: #variables.errors#</b> </p> </cfoutput> </cfif> <form action="test.cfm" enctype="multipart/form-data" method="post"> <input type="file" name="xlsfile" required> <input type="submit" value="upload xls file"> </form> <cfelse> <style> .sstable { width: 100%; border-style:solid; border-width:thin; } .ssheader { background-color: #ffff00; } .sstable td, .sstable th { padding: 10px; border-style:solid; border-width:thin; } </style> <p> here data in excel sheet (assuming first row headers): </p> <cfset metadata = getmetadata(data)> <cfset collist = ""> <cfloop index="col" array="#metadata#"> <cfset collist = listappend(collist, col.name)> </cfloop> <cfif data.recordcount 1> <p> spreadsheet appeared have no data. </p> <cfelse> <table class="sstable"> <tr class="ssheader"> <cfloop index="c" list="#collist#"> <cfoutput><th>#c#</th></cfoutput> </cfloop> </tr> <cfoutput query="data" startrow="2"> <tr> <cfloop index="c" list="#collist#"> <td>#data[c][currentrow]#</td> </cfloop> </tr> </cfoutput> </table> </cfif> </cfif>
try this:
<cfoutput> <cfloop query="data" startrow="2"> <tr> <cfloop index="c" list="#collist#"> <td>#data[c][currentrow]#</td> </cfloop> </tr> </cfloop> </cfoutput>
Comments
Post a Comment