tracker issue : CF-4126527

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

Sorted struct callback needs to receive the value as well as the key

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 03/09/2016

Components: Language

Versions: 2016

Failure Type: Unspecified

Found In Build/Fixed In Build: Alpha3_v12 /

Priority/Frequency: Normal / Unknown

Locale/System: English / Win All

Vote Count: 1

Listed in the version 2016.0.03.300466 Issues Fixed doc
The sortedStruct comparator callback only receives the keyof the struct element. It should behave like all other iteration method callbacks and receive the key, value and indeed a reference to the entire struct.

It's useless as it stands, and the feature might as well be pulled from the product unless this change is made.

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

Watson Bug ID:	4126527

External Customer Info:
External Company: Straker Interactive
External Customer Name: Adam Cameron
External Customer Email: CAMERON.ADAM@GMAIL.COM
External Test Config:

Attachments:

Comments:

Adding BUG AUDIT TRAIL ********action: updated fieldName: Priority newValue: 2 oldValue: 0 oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-16 04:59:07.0 action: updated fieldName: Severity newValue: 2 oldValue: 3 oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-16 04:59:07.0 action: updated fieldName: Reason newValue: Blank oldValue: Blank oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:23:50.0 action: updated fieldName: Status newValue: ToFix oldValue: Deferred oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:23:50.0 action: updated fieldName: Date Closed newValue: null oldValue: 22-DEC-15 03.07.47.000000000 AM oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:23:50.0 action: updated fieldName: Date Deferred newValue: null oldValue: 22-DEC-15 03.07.47.000000000 AM oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:23:50.0 action: updated fieldName: Owner newValue: mchandna oldValue: Blank oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:23:50.0 action: updated fieldName: Closed By newValue: Blank oldValue: suchsing oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:23:50.0 action: updated fieldName: State newValue: Open oldValue: Closed oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2016-02-15 06:23:50.0 action: updated fieldName: Fix By Product Milestone newValue: Alpha oldValue: Gold Master oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: Reason newValue: Blank oldValue: AsDesigned oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: State newValue: Closed oldValue: Open oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: Status newValue: Deferred oldValue: ToTest oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: Fix By Milestone newValue: Alpha oldValue: Gold Master oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: Owner newValue: Blank oldValue: suchsing oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: Closed By newValue: suchsing oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: Date Deferred newValue: 2015-12-22 03:07:47.0 oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: Date Closed newValue: 2015-12-22 03:07:47.0 oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-22 11:07:47.0 action: updated fieldName: Status newValue: ToTest oldValue: ToFix oprid: mchandna recordName: RQ_DEFECT timpestamp: 2015-12-22 11:06:27.0 action: updated fieldName: Reason newValue: AsDesigned oldValue: Blank oprid: mchandna recordName: RQ_DEFECT timpestamp: 2015-12-22 11:06:27.0 action: updated fieldName: Owner newValue: suchsing oldValue: mchandna oprid: mchandna recordName: RQ_DEFECT timpestamp: 2015-12-22 11:06:27.0 action: updated fieldName: Fix By Product Milestone newValue: Gold Master oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-11 08:36:51.0 action: updated fieldName: Fix By Milestone newValue: Gold Master oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-12-11 08:36:51.0 action: updated fieldName: Reason newValue: Blank oldValue: Blank oprid: rakshith recordName: RQ_DEFECT timpestamp: 2015-12-04 03:02:48.0 action: updated fieldName: Owner newValue: mchandna oldValue: rakshith oprid: rakshith recordName: RQ_DEFECT timpestamp: 2015-12-04 03:02:48.0 action: updated fieldName: Status newValue: ToFix oldValue: NeedsReview oprid: rakshith recordName: RQ_DEFECT timpestamp: 2015-12-04 03:02:48.0 action: updated fieldName: Dev Assigned newValue: mchandna oldValue: rukumar oprid: rukumar recordName: RQ_DEFECT timpestamp: 2015-11-18 12:10:09.0 action: updated fieldName: Status newValue: NeedsReview oldValue: Unverified oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 10:59:39.0 action: updated fieldName: Reason newValue: Blank oldValue: Blank oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 10:59:39.0 action: updated fieldName: Owner newValue: rakshith oldValue: suchsing oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 10:59:39.0 action: updated fieldName: Dev Assigned newValue: rukumar oldValue: awdhesh oprid: suchsing recordName: RQ_DEFECT timpestamp: 2015-11-18 10:59:39.0 action: updated fieldName: Owner newValue: suchsing oldValue: inoel oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-11-18 04:46:23.0 action: updated fieldName: QE Assigned newValue: suchsing oldValue: inoel oprid: vmannebo recordName: RQ_DEFECT timpestamp: 2015-11-18 04:46:23.0 action: added fieldName: Vote Type newValue: BETA oldValue: Blank oprid: prerelease recordName: AD_DEFECT_VOTE timpestamp: 2015-11-17 10:23:55.0
Comment by CFwatson U.
3852 | March 09, 2016 02:28:24 AM GMT
+1 - This should be done for both structNew("sorted", comparator) and struct.sort(comparator). Like Adam said, the comparator for both should receive the key, the value and a reference to the entire struct.
Vote by External U.
3855 | March 09, 2016 02:28:25 AM GMT
Added By: PreRelease User User Name:Aaron Neff Note Added: Reminder: It should be StructNew('Ordered') Most CF developers will be confused by the word "Linked" b/c they do not know about Java's LinkedHashMap. They will think "linked to what?" And "what is my struct linked to?" Sorted structs can then be: StructNew("Ordered", "asc|desc") StructNew("Ordered", "asc|desc", "numeric,text,textnocase") StructNew("Ordered", comparator) Thus, ordered structs either have insertion order or sorted order. They're all "ordered". Thanks!, -Aaron Date Added :2016-01-09 00:36:02.0 Added By:suchsing Note Added: We are revisiting this implementation and so sorted structs have been removed from this version of ColdFusion. We have only StructNew(’Linked’) as of now. StructNew('Linked') would create a struct that maintains insertion order. Date Added :2015-12-22 11:29:40.0 Added By: PreRelease User User Name:Aaron Neff Note Added: Also, struct.sort(udf) should return a sorted struct (not an array of key names) and thus structGetSorted() has no use. Thanks!, -Aaron Date Added :2015-11-25 12:15:32.0 Added By: PreRelease User User Name:Aaron Neff Note Added: Forgot to add this to my vote: "There's no point if the comparison can only be done on the key or value." Date Added :2015-11-17 10:25:01.0 Added By: PreRelease User User Name:Adam Cameron Note Added: Entered Bug. Date Added :2015-11-17 08:37:43.0
Comment by CFwatson U.
3853 | March 09, 2016 02:28:26 AM GMT
This has been fixed. Please check the latest docs for sorted structs.
Comment by Milan C.
3854 | September 19, 2016 01:14:24 AM GMT