Skip to content

Instantly share code, notes, and snippets.

@bardware
Created August 23, 2017 17:10
Show Gist options
  • Select an option

  • Save bardware/5153f480a6fe800de7eea220ea2ef3fd to your computer and use it in GitHub Desktop.

Select an option

Save bardware/5153f480a6fe800de7eea220ea2ef3fd to your computer and use it in GitHub Desktop.
How to use Coldfusion's ListFilter in a function?
<cffunction name="fktA" returntype="string">
<cfargument name="struExcludeCols" type="struct">
<cfset local.strLst = "Listel1,Listel2,Listel3">
<cfscript>
local.columnNames = ListFilter(
strLst,
function( strCol ) {
return not StructKeyExists( Arguments.struExcludeCols, strCol );
}
);
</cfscript>
<cfreturn local.columnNames>
</cffunction>
<cfdump var="#fktA( { "Listel2" = 1 } )#">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment