tracker issue : CF-3863533

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: <cfloop> missing the maxrows attribute (tag-to-script conversion failure)

| View in Tracker

Status/Resolution/Reason: To Track//NeedMoreInfo

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 12/07/2014

Components: Language

Versions: 11.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: ALL / Platforms All

Vote Count: 0

Tag code <cfoutput query="q" maxrows="x"..> doesn't have a cfscript equivalent b/c cfloop() doesn't support maxrows.

Repro:

<cfset q = queryNew("myColumn", "varchar", [["a"],["b"],["B"],["c"],["C"]])>
<cfoutput query="q" group="myColumn" groupcasesensitive="no" startrow="2" maxrows="2">#q.myColumn#</cfoutput><!--- outputs: bc (good) --->
<cfscript>
  //fails w/ exception: It does not allow the attribute(s) MAXROWS. The valid attribute(s) are ARRAY,CHARACTERS,CHARSET,COLLECTION,CONDITION,DELIMITERS,ENDROW,FILE,FROM,GROUP,GROUPCASESENSITIVE,INDEX,ITEM,LIST,QUERY,STARTROW,STEP,TO.
  cfloop(query="q", group="myColumn", groupcasesensitive=false, startrow=2, maxrows=2) {
    writeOutput(q.myColumn);
  }
  //outputs: b (tag-to-script conversion failure, b/c endrow doesn't offer a valid workaround)
  cfloop(query="q", group="myColumn", startrow=2, endrow=2) {
    writeOutput(q.myColumn);
  }
</cfscript>

Note: While cfoutput(query="q", maxrows=2) currently works (even tho the cfscript doc says it's not supported), cfoutput() should be deprecated (once cfloop() supports maxrows) b/c cfoutput() doesn't offer a replacement for <cfoutput>foo</cfoutput>.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3863533

Reason:	BugVerified

External Customer Info:
External Company:  
External Customer Name: itisdesign
External Customer Email:

Attachments:

Comments:

Regarding "cfoutput() should be deprecated", I'm having second thoughts. Compare: writeOutput("a"); cfdump(var="a"); cfoutput("a"); cfoutput("a") is shorter, so it should be supported. But cfoutput(query=""..) should be deprecated once cfloop() gets its maxrows attribute. Thanks!, -Aaron
Comment by External U.
9640 | December 07, 2014 09:56:46 PM GMT
*Anything* to do with looping that cfoutput() or <cfoutput> does should be deprecated in favour of a properly named looping construct (like <cfloop>, for(), etc). Having <cfoutput> doing looping was always very poor language design (not Adobe's fault, I know).
Comment by External U.
9641 | December 10, 2014 03:34:57 AM GMT
Hi Adam, I totally agree. All looping stuff should be removed from cfoutput() (and <cfoutput> for that matter). By supporting cfoutput("a"), I just meant that it'd only do what writeOutput() does and nothing more. Thanks!, -Aaron
Comment by External U.
9642 | December 10, 2014 03:48:27 AM GMT
Agreed.
Comment by External U.
9643 | December 10, 2014 04:13:49 AM GMT