tracker issue : CF-4198421

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

QueryFilter does not remove rows as expected when consecutive target rows exist

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Dave Jones / Dave Jones ()

Created: 03/21/2017

Components: Language, Functions

Versions: 2016

Failure Type: Others

Found In Build/Fixed In Build: 2016,0,03,300466 / 2016.0.04.302324

Priority/Frequency: Normal /

Locale/System: / Win 2012 Server x64

Vote Count: 6

Listed in the version 2016.0.04.302561 Issues Fixed doc
Problem Description:
Using queryFilter() on a query having consecutive rows that should be removed based on the filter function logic results in an incorrectly filtered result. It appears that the filter action is failing to remove every other row in the set of consecutive rows.

Steps to Reproduce:
Here is a simple snippet that displays the behavior. Here, a query of names/ages is being filtered to exclude those having an age of 21. Notice that only every other row with age = 21 is removed.

	myQuery = queryNew("name,age,rn", "varchar,integer,integer", [
	{name: "Billy", age: 20, rn:1}
	, {name: "Jane", age: 22, rn:2}
	, {name: "Tommy", age: 23, rn:3}
	, {name: "Sam", age: 21, rn:4}
	, {name: "Sally", age: 21, rn:5}
	, {name: "Jane", age: 21, rn:6}
	, {name: "Jack", age: 21, rn:7}
	, {name: "Beth", age: 21, rn:8}
	, {name: "Barney", age: 21, rn:9}
	, {name: "Archie", age: 25, rn:10}

	x = queryFilter(myQuery, function (Obj, index) {
	    writedump({obj:obj, index:index});
		return obj.age != 21;


Actual Result:
The filtered query contains some rows that should be removed based on the filter function.

Expected Result:
All rows meeting the filter function criteria should be removed.

Any Workarounds:
Use query of queries.



The trycf gist, to the example above. Behaves correctly when Lucee engine is selected.
Comment by Tim B.
1041 | March 22, 2017 12:12:10 AM GMT
Not sure how this code through testing?
Vote by Adam C.
1045 | March 22, 2017 08:07:02 AM GMT
+1 with this bug it means that queryFilter should not and can not be used in any code as it doesn't.
Vote by John W.
1046 | March 22, 2017 09:02:39 AM GMT
We are evaluating a fix for this. Thanks for bringing this to our attention,
Comment by Vamseekrishna N.
1042 | March 23, 2017 03:35:07 AM GMT
+1 - Needs immediate/priority fix.
Vote by Aaron N.
1047 | March 30, 2017 07:58:04 AM GMT
Quick note. This has been fixed.
Comment by Vamseekrishna N.
1043 | March 30, 2017 09:40:39 AM GMT
Confirmed, fixed in update 4. Thanks.
Comment by Adam C.
1044 | April 28, 2017 05:42:32 PM GMT