- CFML Reference User Guide
- ColdFusion functions
- ColdFusion functions by category
- Functions a-b
- Abs
- ACos
- AddSOAPRequestHeader
- AddSOAPResponseHeader
- AjaxLink
- AjaxOnLoad
- ApplicationStop
- ArrayAppend
- ArrayAvg
- ArrayClear
- ArrayContains
- ArrayContainsNoCase
- ArrayDelete
- ArrayDeleteAt
- ArrayDeleteNoCase
- ArrayEach
- ArrayFilter
- ArrayFind
- ArrayFindAll
- ArrayFindAllNoCase
- ArrayFindNoCase
- ArrayInsertAt
- ArrayIsDefined
- ArrayIsEmpty
- ArrayLen
- ArrayMap
- ArrayMax
- ArrayMin
- ArrayNew
- ArrayPrepend
- ArrayReduce
- ArrayResize
- ArraySet
- ArraySetMetadata
- ArraySlice
- ArraySort
- ArraySum
- ArraySwap
- ArrayToList
- Asc
- ASin
- Atn
- AuthenticatedContext
- AuthenticatedUser
- BinaryDecode
- BinaryEncode
- BitAnd
- BitMaskClear
- BitMaskRead
- BitMaskSet
- BitNot
- BitOr
- BitSHLN
- BitSHRN
- BitXor
- BooleanFormat
- Abs
- Functions-c-d
- CacheGet
- CacheGetAllIds
- CacheGetMetadata
- CacheGetProperties
- CacheGetSession
- CacheIdExists
- CachePut
- CacheRegionExists
- CacheRegionNew
- CacheRegionRemove
- CacheRemove
- CacheRemoveAll
- CacheSetProperties
- CallStackDump
- CallStackGet
- CanDeSerialize
- Canonicalize
- CanSerialize
- Ceiling
- CharsetDecode
- CharsetEncode
- Chr
- CJustify
- Compare
- CompareNoCase
- Cos
- CreateDate
- CreateDateTime
- CreateObject
- CreateObject: .NET object
- CreateObject: COM object
- CreateObject: component object
- CreateObject: CORBA object
- CreateObject: Java or EJB object
- CreateObject: web service object
- CreateODBCDate
- CreateODBCDateTime
- CreateODBCTime
- CreateSignedJWT
- CreateEncryptedJWT
- CreateTime
- CreateTimeSpan
- CreateUUID
- CSRFGenerateToken
- CSRFVerifyToken
- CSVRead
- CSVWrite
- CSVProcess
- DateAdd
- DateCompare
- DateConvert
- DateDiff
- DateFormat
- DatePart
- DateTimeFormat
- Day
- DayOfWeek
- DayOfWeekAsString
- DayOfYear
- DaysInMonth
- DaysInYear
- DE
- DecimalFormat
- DecodeForHTML
- DecodeFromURL
- DecrementValue
- Decrypt
- DecryptBinary
- DeleteClientVariable
- Deserialize
- DeserializeJSON
- DeserializeXML
- DirectoryCopy
- DirectoryCreate
- DirectoryDelete
- DirectoryExists
- DirectoryList
- DirectoryRename
- DollarFormat
- DotNetToCFType
- Duplicate
- Functions-e-g
- EncodeForCSS
- EncodeForDN
- EncodeForHTML
- EncodeForHTMLAttribute
- EncodeForJavaScript
- EncodeForLDAP
- EncodeForURL
- EncodeForXML
- EncodeForXMLAttribute
- EncodeForXpath
- Encrypt
- EncryptBinary
- EntityDelete
- EntityLoad
- EntityLoadByExample
- EntityLoadByPK
- EntityMerge
- EntityNew
- EntityReload
- EntitySave
- EntityToQuery
- Evaluate
- Exp
- ExpandPath
- FileClose
- FileCopy
- FileDelete
- FileExists
- FileGetMimeType
- FileIsEOF
- FileMove
- FileOpen
- FileRead
- FileReadBinary
- FileReadLine
- FileSeek
- FileSetAccessMode
- FileSetAttribute
- FileSetLastModified
- FileSkipBytes
- FileUpload
- FileUploadAll
- FileWrite
- FileWriteLine
- Find
- FindNoCase
- FindOneOf
- FirstDayOfMonth
- Fix
- Floor
- FormatBaseN
- GeneratePBKDFKey
- GenerateSecretKey
- GetApplicationMetadata
- GetAuthUser
- GetBaseTagData
- GetBaseTagList
- GetBaseTemplatePath
- GetClientVariablesList
- GetComponentMetaData
- GetContextRoot
- GetCPUUsage
- GetCurrentTemplatePath
- GetCSPNonce
- GetDirectoryFromPath
- GetEncoding
- GetException
- GetFileFromPath
- GetFileInfo
- GetFreeSpace
- GetFunctionCalledName
- GetFunctionList
- GetGatewayHelper
- GetHttpRequestData
- GetHttpTimeString
- GetK2ServerDocCount
- GetK2ServerDocCountLimit
- GetLocale
- GetLocaleDisplayName
- GetLocalHostIP
- GetMetaData
- GetMetricData
- GetPageContext
- GetPropertyString
- GetPropertyFile
- GetPrinterInfo
- GetPrinterList
- GetProfileSections
- GetProfileString
- GetReadableImageFormats
- GetSafeHTML
- GetSAMLAuthRequest
- GetSAMLLogoutRequest
- Generate3DesKey
- GenerateSAMLSPMetadata
- GetSOAPRequest
- GetSOAPRequestHeader
- GetSOAPResponse
- GetSOAPResponseHeader
- GetSystemFreeMemory
- GetSystemTotalMemory
- GetTempDirectory
- GetTempFile
- GetTemplatePath
- GetTickCount
- GetTimeZoneInfo
- GetToken
- GetTotalSpace
- GetUserRoles
- GetVFSMetaData
- GetWriteableImageFormats
- Functions-h-im
- Hash
- HMac
- Hour
- HQLMethods
- HTMLCodeFormat
- HTMLEditFormat
- IIf
- ImageAddBorder
- ImageBlur
- ImageClearRect
- ImageCopy
- ImageCreateCaptcha
- ImageCrop
- ImageDrawArc
- ImageDrawBeveledRect
- ImageDrawCubicCurve
- ImageDrawLine
- ImageDrawLines
- ImageDrawOval
- ImageDrawPoint
- ImageDrawQuadraticCurve
- ImageDrawRect
- ImageDrawRoundRect
- ImageDrawText
- ImageFlip
- ImageGetBlob
- ImageGetBufferedImage
- ImageGetEXIFMetadata
- ImageGetEXIFTag
- ImageGetHeight
- ImageGetIPTCMetadata
- ImageGetIPTCTag
- ImageGetMetadata
- ImageGetWidth
- ImageGrayscale
- ImageInfo
- ImageMakeColorTransparent
- ImageMakeTranslucent
- ImageNegative
- ImageNew
- ImageOverlay
- ImagePaste
- ImageRead
- ImageReadBase64
- ImageResize
- ImageRotate
- ImageRotateDrawingAxis
- ImageScaleToFit
- ImageSetAntialiasing
- ImageSetBackgroundColor
- ImageSetDrawingColor
- ImageSetDrawingStroke
- ImageSetDrawingTransparency
- ImageSharpen
- ImageShear
- ImageShearDrawingAxis
- ImageTranslate
- ImageTranslateDrawingAxis
- ImageWrite
- ImageWriteBase64
- ImageXORDrawingMode
- Functions-in-k
- IncrementValue
- InputBaseN
- Insert
- Int
- InterruptThread
- InvalidateOauthAccesstoken
- Invoke
- InitSAMLAuthRequest
- InitSAMLLogoutRequest
- InvokeCFClientFunction
- IsArray
- IsAuthenticated
- IsAuthorized
- IsBinary
- IsBoolean
- IsClosure
- IsCustomFunction
- IsDate
- IsDateObject
- IsDDX
- IsDebugMode
- IsDefined
- IsImage
- IsImageFile
- IsInstanceOf
- IsIPv6
- IsJSON
- IsK2ServerABroker
- IsK2ServerDocCountExceeded
- IsK2ServerOnline
- IsLeapYear
- IsLocalHost
- IsNull
- IsNumeric
- IsNumericDate
- IsObject
- isOnline
- IsPDFArchive
- IsPDFFile
- IsPDFObject
- IsProtected
- IsQuery
- isSamlLogoutResponse
- isSafeHTML
- IsSimpleValue
- IsSOAPRequest
- IsSpreadsheetFile
- IsSpreadsheetObject
- IsStruct
- isThreadInterrupted
- IsUserInAnyRole
- IsUserInRole
- IsUserLoggedIn
- IsValid
- IsValidOauthAccesstoken
- IsWDDX
- IsXML
- IsXmlAttribute
- IsXmlDoc
- IsXmlElem
- IsXmlNode
- IsXmlRoot
- JavaCast
- JSStringFormat
- Functions-l
- LCase
- Left
- Len
- ListAppend
- ListChangeDelims
- ListContains
- ListContainsNoCase
- ListDeleteAt
- ListEach
- ListFilter
- ListFind
- ListFindNoCase
- ListFirst
- ListGetAt
- ListGetDuplicates
- ListInsertAt
- ListLast
- ListLen
- ListMap
- ListPrepend
- ListQualify
- ListReduce
- ListRemoveDuplicates
- ListRest
- ListSetAt
- ListSort
- ListToArray
- ListValueCount
- ListValueCountNoCase
- LJustify
- Location
- Log
- Log10
- LSCurrencyFormat
- LSDateFormat
- LSDateTimeFormat
- LSEuroCurrencyFormat
- LSIsCurrency
- LSIsDate
- LSIsNumeric
- LSNumberFormat
- LSParseCurrency
- LSParseDateTime
- LSParseEuroCurrency
- LSParseNumber
- LSTimeFormat
- LTrim
- Functions-m-r
- Max
- Mid
- Min
- Minute
- Month
- MonthAsString
- Now
- NumberFormat
- ObjectEquals
- ObjectLoad
- ObjectSave
- OnWSAuthenticate
- ORMClearSession
- ORMCloseAllSessions
- ORMCloseSession
- ORMEvictCollection
- ORMEvictEntity
- ORMEvictQueries
- ORMExecuteQuery
- ORMFlush
- ORMFlushall
- ORMGetSession
- ORMGetSessionFactory
- ORMIndex
- ORMIndexPurge
- ORMReload
- ORMSearch
- ORMSearchOffline
- ParagraphFormat
- ParameterExists
- ParseDateTime
- Pi
- PrecisionEvaluate
- ProcessSAMLResponse
- ProcessSAMLLogoutRequest
- Quarter
- PreserveSingleQuotes
- QueryAddColumn
- QueryAddRow
- QueryConvertForGrid
- QueryExecute
- QueryFilter
- QueryGetResult
- QueryGetRow
- QueryKeyExists
- QueryMap
- QueryNew
- QueryReduce
- QuerySetCell
- QuotedValueList
- QueryEach
- Rand
- Randomize
- RandRange
- ReEscape
- REFind
- REFindNoCase
- ReleaseComObject
- REMatch
- REMatchNoCase
- RemoveCachedQuery
- RemoveChars
- RepeatString
- Replace
- ReplaceList
- ReplaceNoCase
- REReplace
- REReplaceNoCase
- RestDeleteApplication
- RestSetResponse
- RestInitApplication
- Reverse
- Right
- RJustify
- Round
- RTrim
- Functions-s
- Second
- SendGatewayMessage
- SendSAMLLogoutResponse
- Serialize
- SerializeJSON
- SerializeXML
- SessionInvalidate
- SessionRotate
- SessionGetMetaData
- SessionInvalidate
- SessionRotate
- SetDay
- SetEncoding
- SetHour
- SetLocale
- SetMonth
- SetProfileString
- SetPropertyString
- SetVariable
- SetYear
- Sgn
- Sin
- Sleep
- SpanExcluding
- SpanIncluding
- SpreadsheetAddAutoFilter
- SpreadsheetAddColumn
- SpreadsheetAddFreezePane
- SpreadsheetAddImage
- SpreadsheetAddInfo
- SpreadsheetAddPageBreaks
- SpreadsheetAddRow
- SpreadsheetAddRows
- SpreadsheetAddSplitPane
- SpreadsheetCreateSheet
- SpreadsheetDeleteColumn
- SpreadsheetDeleteColumns
- SpreadsheetDeleteRow
- SpreadsheetDeleteRows
- SpreadsheetFormatCell
- SpreadsheetFormatColumn
- SpreadsheetFormatCellRange
- SpreadsheetFormatColumn
- SpreadsheetFormatColumns
- SpreadsheetFormatRow
- SpreadsheetFormatRows
- SpreadsheetGetCellComment
- SpreadsheetGetCellFormula
- SpreadsheetGetCellValue
- SpreadsheetGetColumnCount
- SpreadsheetInfo
- SpreadsheetMergeCells
- SpreadsheetNew
- SpreadsheetRead
- SpreadsheetReadBinary
- SpreadsheetRemoveSheet
- SpreadsheetSetActiveSheet
- SpreadsheetSetActiveSheetNumber
- SpreadsheetSetCellComment
- SpreadsheetSetCellFormula
- SpreadsheetSetCellValue
- SpreadsheetSetColumnWidth
- SpreadsheetSetFooter
- SpreadsheetSetHeader
- SpreadsheetSetRowHeight
- SpreadsheetShiftColumns
- SpreadsheetShiftRows
- SpreadsheetWrite
- StreamingSpreadsheetNew
- StreamingSpreadsheetCleanup
- StreamingSpreadsheetRead
- StreamingSpreadsheetProcess
- SpreadsheetSetFooterImage
- SpreadsheetSetHeaderImage
- SpreadsheetSetFittoPage
- SpreadsheetUngroupColumns
- SpreadsheetGroupColumns
- SpreadsheetUngroupRows
- SpreadsheetGroupRows
- SpreadsheetRemoveColumnBreak
- SpreadsheetSetColumnBreak
- SpreadsheetRemoveRowBreak
- SpreadsheetSetRowBreak
- SpreadsheetRemovePrintGridlines
- SpreadsheetAddPrintGridlines
- SpreadsheetGetColumnWidth
- SpreadsheetSetColumnHidden
- SpreadsheetSetRowHidden
- SpreadsheetisColumnHidden
- SpreadsheetisRowHidden
- SpreadsheetisStreamingXmlFormat
- SpreadsheetisXmlFormat
- SpreadsheetisBinaryFormat
- SpreadsheetRenameSheet
- SpreadsheetRemoveSheetNumber
- SpreadsheetGetLastRowNumber
- SpreadsheetGetPrintOrientation
- Sqr
- StripCR
- StructAppend
- StructClear
- StructCopy
- StructCount
- StructDelete
- StructEach
- StructFilter
- StructFind
- StructFindKey
- StructFindValue
- StructGet
- StructGetMetadata
- StructInsert
- StructIsEmpty
- StructKeyArray
- StructKeyExists
- StructKeyList
- StructMap
- StructNew
- StructReduce
- StructSetMetadata
- StructSort
- StructToSorted
- StructUpdate
- StructValueArray
- StoreSetMetadata
- StoreGetACL
- StoreGetMetadata
- StoreAddACL
- StoreSetACL
- Functions-t-z
- Tan
- ThreadJoin
- ThreadTerminate
- Throw
- TimeFormat
- ToBase64
- ToBinary
- ToScript
- ToString
- Trace
- Transactionandconcurrency
- TransactionCommit
- TransactionRollback
- TransactionSetSavePoint
- Trim
- UCase
- URLDecode
- URLEncodedFormat
- URLSessionFormat
- Val
- ValueList
- VerifyClient
- Week
- Wrap
- WriteDump
- WriteLog
- WriteOutput
- WSGetAllChannels
- WSGetSubscribers
- WSPublish
- WSSendMessage
- XmlChildPos
- XmlElemNew
- XmlFormat
- XmlGetNodeType
- XmlNew
- XmlParse
- XmlSearch
- XmlTransform
- XmlValidate
- Year
- YesNoFormat
- ColdFusion tags
- ColdFusion tag summary
- ColdFusion tags by category
- Application framework tags
- Communications tags
- Database manipulation tags
- Data output tags
- Debugging tags
- Exception handling tags
- Extensibility tags
- File management tags
- Flow-control tags
- Forms tags
- Internet Protocol tags
- Page processing tags
- Security tags
- Variable manipulation tags
- Other tags
- Tags a-b
- Tags c
- cfcache
- cfcalendar
- cfcase
- cfcatch
- cfchart
- cfchart tag in ColdFusion
- Get started with cfchart
- Customize a chart using cfchart
- Advanced cfchart customization options
- Create an area chart in ColdFusion
- Create line charts in ColdFusion
- Create bar charts in ColdFusion
- Create floating bar charts in ColdFusion
- Create histograms in ColdFusion
- Create pie charts in ColdFusion
- Create funnel charts in ColdFusion
- Create pyramid charts in ColdFusion
- Create curve charts in ColdFusion
- Create boxplots in ColdFusion
- Create donut charts in ColdFusion
- Create bubble charts in ColdFusion
- Create scatterplots in ColdFusion
- Create radar charts in ColdFusion
- Other chart types in ColdFusion (Cone, Cylinder, Piano, and Bullet)
- Advanced customization options in cfchart
- cfchartdata
- cfchartseries
- cfchartset
- cfclient
- cfclientsettings
- cfcol
- cfcollection
- cfcomponent
- cfcontent
- cfcontinue
- cfcookie
- Tags f
- cffeed
- cffile
- cffile action = "append"
- cffile action = "copy"
- cffile action = "delete"
- cffile action = "move"
- cffile action = "read"
- cffile action = "readBinary"
- cffile action = "rename"
- cffile action = "upload"
- cffile action = "uploadAll"
- cffile action = "write"
- cffileupload
- cffinally
- cfflush
- cfform
- cfformgroup
- cfformitem
- cfftp
- cfftp: Connection: file and directory operations
- cfftp: Opening and closing FTP server connections
- cfftp : Opening and closing secure FTP server connections
- cfftp action = "listDir"
- cffunction
- Tags g-h
- Tags i
- Tags j-l
- cfjava
- cflayout
- cflayoutarea
- cfldap
- cflocation
- cflock
- cflog
- cflogin
- cfloginuser
- cflogout
- cfloop
- cfloop : conditional loop
- cfloop : index loop
- cfloop : looping over a COM collection or structure
- cfloop : looping over a date or time range
- cfloop : looping over a list, a file, or an array
- cfloop : looping over a query
- Tags m-o
- cfmail
- cfmailparam
- cfmailpart
- cfmap
- cfmapitem
- cfmediaplayer
- cfmenu
- cfmenuitem
- cfmessagebox
- cfmodule
- cfNTauthenticate
- cfoauth
- cfobject
- cfobject: .NET object
- cfobject: COM object
- cfobject: component object
- cfobject: CORBA object
- cfobject: Java or EJB object
- cfobject: web service object
- cfobjectcache
- cfoutput
- Tags p-q
- Tags r-s
- Tags t
- Tags u-z
- CFML Reference
- Reserved words and variables
- Ajax JavaScript functions
- Ajax JavaScript functions
- Function summary Ajax
- ColdFusion.Ajax.submitForm
- ColdFusion.Autosuggest.getAutosuggestObject
- ColdFusion.Layout.enableSourceBind
- ColdFusion.MessageBox.getMessageBoxObject
- ColdFusion.ProgressBar.getProgressBarObject
- ColdFusion.MessageBox.isMessageBoxDefined
- JavaScriptFunctionsinColdFusion9Update1
- ColdFusion ActionScript functions
- ColdFusion mobile functions
- Application.cfc reference
- Script functions implemented as CFCs
- ColdFusion Flash Form style reference
- Styles valid for all controls
- Styles for cfform
- Styles for cfformgroup with horizontal or vertical type attributes
- Styles for box-style cfformgroup elements
- Styles for cfformgroup with accordion type attribute
- Styles for cfformgroup with tabnavigator type attribute
- Styles for cfformitem with hrule or vrule type attributes
- Styles for cfinput with radio, checkbox, button, image, or submit type attributes
- Styles for cftextarea tag and cfinput with text, password, or hidden type attributes
- Styles for cfselect with size attribute value of 1
- Styles for cfselect with size attribute value greater than 1
- Styles for cfcalendar tag and cfinput with dateField type attribute
- Styles for the cfgrid tag
- Styles for the cftree tag
- ColdFusion Flash Form Style Reference
- ColdFusion event gateway reference
- ColdFusion Event Gateway reference
- addEvent
- CFEvent
- CFEventclass
- Constructor
- Gateway development interfaces and classes
- getStatus
- setCFCPath
- setCFCMethod
- getOriginatorID
- getLogger
- getBuddyList
- getBuddyInfo
- IM gateway message sending commands
- IM Gateway GatewayHelper class methods
- onIncomingMessage
- onIMServerMessage
- onBuddyStatus
- onAddBuddyResponse
- onAddBuddyRequest
- IM Gateway CFC incoming message methods
- IM gateway methods and commands
- CFML CFEvent structure
- warn
- info
- setOriginatorID
- data command
- submit Multi command
- submit command
- setGatewayType
- setGatewayID
- setData
- setCFCListeners
- outgoingMessage
- getStatusTimeStamp
- numberOfMessagesReceived
- numberOfMessagesSent
- removeBuddy
- removeDeny
- removePermit
- setNickName
- setPermitMode
- setStatus
- SMS Gateway CFEvent structure and commands
- SMS Gateway incoming message CFEvent structure
- getStatusAsString
- getProtocolName
- getPermitMode
- getPermitList
- getNickName
- getName
- getDenyList
- getCustomAwayMessage
- getQueueSize
- getMaxQueueSize
- getHelper
- getGatewayType
- getGatewayServices
- getGatewayID_1
- getGatewayID
- getData
- getCFCTimeout
- setCFCTimeout
- getCFCPath
- getCFCMethod
- GatewayServices class
- Gateway interface
- GatewayHelper interface
- addPermit
- addDeny
- addBuddy
- error
- debug
- Logger class
- stop
- start
- CFML event gateway SendGatewayMessage data parameter
- restart
- fatal
- SMS gateway message sending commands
- ColdFusion C++ CFX Reference
- ColdFusion Java CFX reference
- WDDX JavaScript Objects
- Cloud services
- ColdFusion and GCP Storage
- ColdFusion and GCP Firestore
- ColdFusion and GCP PubSub
- ColdFusion and Amazon S3
- ColdFusion and DynamoDB
- ColdFusion and Amazon SQS
- ColdFusion and Amazon SNS
- ColdFusion and MongoDB
- ColdFusion and Azure Blob
- ColdFusion and Azure Service Bus
- Multi-cloud storage services
- Multi-cloud RDS databases
- ColdFusion and Azure Cosmos DB
Description
Determines the index of the first list element in which a specified value occurs. Case sensitive.
Returns
Index of the first list element that contains value, with matching case. If not found, returns zero. The search is case sensitive.
History
ColdFusion (2018 release): Introduced named parameters.
Category
Function syntax
ListFind(list, value [, delimiters, includeEmptyFields ])
See also
ListContains , ListFindNoCase; Lists in Data types- Developing guide in the Developing ColdFusion Applications
Parameters
Parameter |
Description |
|---|---|
includeEmptyFields |
Optional. Set to yes to include empty values. |
list |
A list or a variable that contains one |
value |
A string, a number, or a variable that contains one. Item for which to search. The search is case sensitive. |
delimiters |
A string or a variable that contains one. Characters that separate list elements. The default value is comma . If this parameter contains more than one character, ColdFusion processes each occurrence of each character as a delimiter. |
History
ColdFusion (2018 release): Introduced named parameters.
Usage
ColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements.
Example
<cfscript>
myList="Tokyo,Bangkok,bangkok,bangKok,Jakarta,Manila,Bangalore,Shanghai";
myFind=ListFind(myList,"bangkok");
WriteOutput(myFind); // Returns 3
</cfscript>
Output
3
Real-world uses of the ListFind function
User permissions and role management
An enterprise web application manages user access through role-based permissions where each user has a comma-separated list of permission codes. The system needs to verify user permissions in real-time for secure access control to various application features, reports, and administrative functions.
How it helps:
- Real-time access control with millisecond response times
- Easy addition of new permissions without code changes
- Complete tracking of permission-based access attempts
- Seamless access to authorized features without delays
<cfscript>
// Simple Permission Checking with ListFind
// Business: Verify user access rights for secure applications
// Sample users with different permission levels
users = [
{"username": "admin.user", "role": "Administrator", "permissions": "ADMIN,USER_MGMT,REPORTS,PAYROLL"},
{"username": "hr.manager", "role": "HR Manager", "permissions": "HR_MGMT,REPORTS,USER_VIEW"},
{"username": "employee", "role": "Employee", "permissions": "PROFILE_EDIT,TIMESHEET"}
];
// Simple permission checker
function hasPermission(userPermissions, requiredPermission) {
return ListFind(userPermissions, requiredPermission) > 0;
}
</cfscript>
<cfoutput>
<h1>🔐 ListFind: Permission Checking Demo</h1>
<p><strong>Business Need:</strong> Control access to application features based on user permissions</p>
<p><strong>Challenge:</strong> Users have different permission combinations stored as comma-separated lists</p>
<p><strong>Solution:</strong> Use ListFind() to verify if specific permissions exist in user's list</p>
<hr>
<h2>Permission Testing Examples</h2>
</cfoutput>
<cfloop array="#users#" index="userData">
<cfoutput>
<h3>#userData["username"]# - #userData["role"]#</h3>
<div style="background: ##f8f9fa; padding: 15px; margin: 10px 0; border: 1px solid ##ddd;">
<p><strong>User Permissions:</strong> #userData["permissions"]#</p>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px;">
</cfoutput>
<cfscript>
// Test common permissions
testPermissions = ["ADMIN", "REPORTS", "USER_MGMT", "TIMESHEET"];
</cfscript>
<cfloop array="#testPermissions#" index="permission">
<cfscript>
hasAccess = hasPermission(userData["permissions"], permission);
position = ListFind(userData["permissions"], permission);
</cfscript>
<cfoutput>
<div style="background: #hasAccess ? '##d4edda' : '##f8d7da'#; padding: 10px; border-radius: 5px; text-align: center;">
<h5 style="margin-top: 0;">#permission#</h5>
<p><strong>Access:</strong> #hasAccess ? 'GRANTED ✅' : 'DENIED ❌'#</p>
<cfif hasAccess>
<p><strong>Position:</strong> #position#</p>
</cfif>
</div>
</cfoutput>
</cfloop>
<cfoutput>
</div>
</div>
</cfoutput>
</cfloop>
eCommerce product category and filtering
An online marketplace with 100,000+ products uses category tags and filter attributes to help customers find products efficiently. Each product has comma-separated category lists and attribute tags that power search filters, product recommendations, and inventory management across multiple sales channels.
<cfscript>
// Simple Product Category Filtering with ListFind
// Business: Filter e-commerce products by category membership
// Sample products with category lists
products = [
{"name": "Gaming Laptop", "categories": "electronics,computers,gaming", "price": 1299.99},
{"name": "Wireless Headset", "categories": "electronics,audio,gaming", "price": 149.99},
{"name": "Office Monitor", "categories": "electronics,monitors,business", "price": 329.99},
{"name": "Smartphone", "categories": "electronics,mobile,communication", "price": 899.99}
];
// Simple category filter function
function filterByCategory(productList, targetCategory) {
var matchedProducts = [];
for (productData in productList) {
if (ListFind(productData["categories"], targetCategory) > 0) {
arrayAppend(matchedProducts, productData);
}
}
return matchedProducts;
}
</cfscript>
<cfoutput>
<h1>🛒 ListFind: Product Category Demo</h1>
<p><strong>Business Need:</strong> Filter products by category for better customer experience</p>
<p><strong>Challenge:</strong> Products belong to multiple categories simultaneously</p>
<p><strong>Solution:</strong> Use ListFind() to check if products belong to specific categories</p>
<hr>
<h2>All Products</h2>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px;">
</cfoutput>
<cfloop array="#products#" index="productData">
<cfoutput>
<div style="background: ##f8f9fa; padding: 15px; border: 1px solid ##ddd; border-radius: 5px;">
<h4 style="margin-top: 0;">#productData["name"]#</h4>
<p><strong>Price:</strong> $#numberFormat(productData["price"], "0.00")#</p>
<p><strong>Categories:</strong> #productData["categories"]#</p>
</div>
</cfoutput>
</cfloop>
<cfoutput>
</div>
<h2>Category Filter Examples</h2>
</cfoutput>
<cfscript>
// Test different category filters
categoryTests = ["gaming", "electronics", "business", "audio"];
</cfscript>
<cfloop array="#categoryTests#" index="category">
<cfscript>
filteredProducts = filterByCategory(products, category);
</cfscript>
<cfoutput>
<h3>Filter: "#category#" Category</h3>
<div style="background: ##e3f2fd; padding: 15px; border-radius: 5px; margin: 10px 0;">
<p><strong>Products Found:</strong> #arrayLen(filteredProducts)# out of #arrayLen(products)#</p>
<cfif arrayLen(filteredProducts) > 0>
<h4>Matching Products:</h4>
<cfloop array="#filteredProducts#" index="product">
<div style="background: ##e8f5e8; padding: 10px; margin: 10px 0; border-radius: 5px;">
<strong>#product["name"]#</strong> - $#numberFormat(product["price"], "0.00")#<br>
<em>Categories: #product["categories"]#</em><br>
<strong>Position in list:</strong> #ListFind(product["categories"], category)#
</div>
</cfloop>
<cfelse>
<p style="color: ##666; font-style: italic;">No products found in this category.</p>
</cfif>
</div>
</cfoutput>
</cfloop>
Email marketing and management
A marketing automation platform manages subscriber lists and email campaigns for 50,000+ customers. Each subscriber belongs to multiple interest-based lists and demographic segments, requiring sophisticated list management for targeted campaigns, compliance tracking, and personalized communication strategies.
How it helps:
- Send developer-specific content only to subscribers in "development" list
- Ensure unsubscribe preferences are honored across all relevant lists
- Customize email content based on subscriber's list memberships
- Track engagement rates by subscriber list combinations
<cfscript>
// Simple Email List Management with ListFind
// Business: Target email campaigns to specific subscriber segments
// Sample subscribers with interest lists
subscribers = [
{"name": "Alex Developer", "email": "alex@tech.com", "lists": "technology,tutorials,development"},
{"name": "Sarah Business", "email": "sarah@corp.com", "lists": "business,newsletters,leadership"},
{"name": "Mike Designer", "email": "mike@creative.com", "lists": "design,tutorials,inspiration"},
{"name": "Lisa Analyst", "email": "lisa@data.com", "lists": "technology,business,data_science"}
];
// Simple campaign targeting function
function getTargetAudience(subscriberList, targetList) {
var targetedSubscribers = [];
for (subscriberData in subscriberList) {
if (ListFind(subscriberData["lists"], targetList) > 0) {
arrayAppend(targetedSubscribers, subscriberData);
}
}
return targetedSubscribers;
}
</cfscript>
<cfoutput>
<h1>📧 ListFind: Email Campaign Demo</h1>
<p><strong>Business Need:</strong> Send targeted emails to specific subscriber segments</p>
<p><strong>Challenge:</strong> Subscribers belong to multiple interest lists</p>
<p><strong>Solution:</strong> Use ListFind() to target campaigns to specific list members</p>
<hr>
<h2>All Subscribers</h2>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px;">
</cfoutput>
<cfloop array="#subscribers#" index="subscriberData">
<cfoutput>
<div style="background: ##f8f9fa; padding: 15px; border: 1px solid ##ddd; border-radius: 5px;">
<h4 style="margin-top: 0;">#subscriberData["name"]#</h4>
<p><strong>Email:</strong> #subscriberData["email"]#</p>
<p><strong>Lists:</strong> #subscriberData["lists"]#</p>
</div>
</cfoutput>
</cfloop>
<cfoutput>
</div>
<h2>Campaign Targeting Examples</h2>
</cfoutput>
<cfscript>
// Test different campaign targets
campaignTargets = [
{"list": "technology", "type": "Tech Newsletter"},
{"list": "business", "type": "Business Insights"},
{"list": "tutorials", "type": "Learning Resources"},
{"list": "design", "type": "Creative Inspiration"}
];
</cfscript>
<cfloop array="#campaignTargets#" index="campaign">
<cfscript>
targetedList = getTargetAudience(subscribers, campaign.list);
coveragePercent = (arrayLen(targetedList) / arrayLen(subscribers)) * 100;
</cfscript>
<cfoutput>
<h3>Campaign: #campaign.type# (Target: "#campaign.list#")</h3>
<div style="background: ##fff3cd; padding: 15px; border-radius: 5px; margin: 10px 0;">
<p><strong>Subscribers Targeted:</strong> #arrayLen(targetedList)# out of #arrayLen(subscribers)# (#numberFormat(coveragePercent, "0.0")#% coverage)</p>
<cfif arrayLen(targetedList) > 0>
<h4>Campaign Recipients:</h4>
<cfloop array="#targetedList#" index="recipient">
<cfscript>
position = ListFind(recipient["lists"], campaign.list);
</cfscript>
<div style="background: ##e8f5e8; padding: 10px; margin: 5px 0; border-radius: 5px;">
<strong>#recipient["name"]#</strong> (#recipient["email"]#)<br>
<em>All Lists: #recipient["lists"]#</em><br>
<strong>"#campaign.list#" Position:</strong> #position#
</div>
</cfloop>
<cfelse>
<p style="color: ##666; font-style: italic;">No subscribers found for this campaign.</p>
</cfif>
</div>
</cfoutput>
</cfloop>
Inventory management and warehouse operations
A multi-location distribution company manages inventory across 25 warehouses with complex location codes and status tracking. Each product has location lists and status codes that determine availability, shipping routes, and fulfillment strategies for efficient supply chain management.
How it helps:
- Find nearest warehouse with available inventory
- Verify products are stored in authorized locations
- Confirm inventory status before shipment approval
- Select optimal shipping warehouse based on customer location
<cfscript>
// Simple Inventory Location Management with ListFind
// Business: Find products across multiple warehouse locations
// Sample inventory with location lists
inventory = [
{"product": "Blood Pressure Monitor", "locations": "WH001,WH003,WH007", "units": 150},
{"product": "Digital Thermometer", "locations": "WH002,WH005,WH009", "units": 200},
{"product": "Hand Sanitizer", "locations": "WH001,WH004,WH006", "units": 300},
{"product": "Face Masks", "locations": "WH003,WH007,WH008", "units": 500}
];
// Warehouse information
warehouses = {
"WH001": "Main Distribution - New York",
"WH002": "West Coast Hub - Los Angeles",
"WH003": "Midwest Center - Chicago",
"WH004": "Southeast Hub - Atlanta",
"WH005": "Northwest Center - Seattle"
};
// Simple inventory finder
function findProductsAtWarehouse(inventoryList, warehouseCode) {
var productsFound = [];
for (inventoryItem in inventoryList) {
if (ListFind(inventoryItem["locations"], warehouseCode) > 0) {
arrayAppend(productsFound, inventoryItem);
}
}
return productsFound;
}
</cfscript>
<cfoutput>
<h1>🏭 ListFind: Inventory Location Demo</h1>
<p><strong>Business Need:</strong> Find which products are available at specific warehouses</p>
<p><strong>Challenge:</strong> Products are stored across multiple warehouse locations</p>
<p><strong>Solution:</strong> Use ListFind() to check product availability by location</p>
<hr>
<h2>Complete Inventory</h2>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px;">
</cfoutput>
<cfloop array="#inventory#" index="inventoryItem">
<cfoutput>
<div style="background: ##f8f9fa; padding: 15px; border: 1px solid ##ddd; border-radius: 5px;">
<h4 style="margin-top: 0;">#inventoryItem["product"]#</h4>
<p><strong>Units Available:</strong> #numberFormat(inventoryItem["units"], "0,0")#</p>
<p><strong>Locations:</strong> #inventoryItem["locations"]#</p>
</div>
</cfoutput>
</cfloop>
<cfoutput>
</div>
<h2>Warehouse Inventory Lookup</h2>
</cfoutput>
<cfscript>
// Test different warehouse locations
warehouseTests = ["WH001", "WH003", "WH005", "WH999"];
</cfscript>
<cfloop array="#warehouseTests#" index="warehouseCode">
<cfscript>
productsAtLocation = findProductsAtWarehouse(inventory, warehouseCode);
warehouseName = structKeyExists(warehouses, warehouseCode) ? warehouses[warehouseCode] : "Unknown Warehouse";
</cfscript>
<cfoutput>
<h3>Warehouse: #warehouseCode# - #warehouseName#</h3>
<div style="background: ##f0f8ff; padding: 15px; border-radius: 5px; margin: 10px 0;">
<p><strong>Products Available:</strong> #arrayLen(productsAtLocation)# products</p>
<cfif arrayLen(productsAtLocation) > 0>
<h4>Available Products:</h4>
<cfloop array="#productsAtLocation#" index="product">
<cfscript>
position = ListFind(product["locations"], warehouseCode);
</cfscript>
<div style="background: ##e8f5e8; padding: 10px; margin: 10px 0; border-radius: 5px;">
<strong>#product["product"]#</strong><br>
<strong>Units:</strong> #numberFormat(product["units"], "0,0")#<br>
<em>All Locations: #product["locations"]#</em><br>
<strong>Position in Location List:</strong> #position#
</div>
</cfloop>
<cfelse>
<p style="color: ##666; font-style: italic;">No products available at this warehouse.</p>
</cfif>
</div>
</cfoutput>
</cfloop>
