- 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
Gets a list element at a specified position.
Returns
Value of the list element at position position.
History
ColdFusion (2018 release): Changed Parameter name includeEmptyValues to includeEmptyFields.
Category
Function syntax
ListGetAt(list, position [, delimiter, includeEmptyFields])
See also
ListFirst, ListLast, ListQualify, ListSetAt; Lists in Data types- Developing guide in the Developing ColdFusion Applications
Parameters
Parameter |
Description |
|---|---|
list |
A list or a variable that contains one. |
position |
A positive integer or a variable that contains one. Position at which to get the element. The first list position is 1. |
delimiter |
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. |
includeEmptyFields |
Optional. Set to yes to include empty values. |
Usage
If you use list functions on strings that are delimited by a delimiter character and a space, a returned list element might contain a leading space; you use the trim function to remove such spaces from a returned element. For example, consider this list:
<cfset myList = "one hundred, two hundred, three hundred">
To get a value from this list, use the trim function to remove the space before the returned value:
<cfset MyValue = #trim(listGetAt(myList, 2))#>
With this usage, MyValue = "two hundred", not " two hundred", and spaces within a list element are preserved. ColdFusion ignores empty list elements; thus, the list "a,b,c,,,d" has four elements.
Example
<cfscript>
myList="Tokyo,Bangkok,Jakarta,Manila,Bangalore,Shanghai";
WriteOutput(ListGetAt(myList,4)); // Returns Manila
</cfscript>
Output
Manila
Real-world uses of the ListGetAt function
Configuration management and system settings
Enterprise applications require flexible configuration management systems that store settings as delimited strings in databases or configuration files. System administrators need to extract specific configuration values without parsing entire configuration files. Configuration data stored as delimited strings requires precise extraction of individual settings. Manual string parsing is error-prone and inefficient. Configuration changes must be dynamic without application restarts. Poor configuration management leads to system downtime and deployment failures. Use ListGetAt to extract specific configuration values from delimited configuration strings, enabling dynamic system configuration and environment-specific settings management.
<cfscript>
// Sample configuration data from different environments
environmentConfigs = [
{"environment": "production", "configString": "database.host,prod-db.company.com,database.port,5432,database.name,production_app,cache.enabled,true,cache.timeout,3600,log.level,error,ssl.enabled,true,max.connections,100"},
{"environment": "staging", "configString": "database.host,staging-db.company.com,database.port,5432,database.name,staging_app,cache.enabled,false,cache.timeout,1800,log.level,debug,ssl.enabled,true,max.connections,50"},
{"environment": "development", "configString": "database.host,localhost,database.port,3306,database.name,dev_app,cache.enabled,true,cache.timeout,900,log.level,trace,ssl.enabled,false,max.connections,25"},
{"environment": "testing", "configString": "database.host,test-db.local,database.port,3306,database.name,test_app,cache.enabled,false,cache.timeout,300,log.level,info,ssl.enabled,false,max.connections,10"},
{"environment": "docker", "configString": "database.host,db_container,database.port,5432,database.name,docker_app,cache.enabled,true,cache.timeout,1200,log.level,warn,ssl.enabled,false,max.connections,30"}
];
</cfscript>
<cfoutput>
<h2>📊 Configuration Management Results</h2>
<cfloop array="#environmentConfigs#" index="envConfig">
<cfscript>
// Extract core configuration values using ListGetAt
databaseHost = ListGetAt(envConfig.configString, 2); // Position 2: database host
databasePort = ListGetAt(envConfig.configString, 4); // Position 4: database port
databaseName = ListGetAt(envConfig.configString, 6); // Position 6: database name
cacheEnabled = ListGetAt(envConfig.configString, 8); // Position 8: cache enabled
cacheTimeout = ListGetAt(envConfig.configString, 10); // Position 10: cache timeout
logLevel = ListGetAt(envConfig.configString, 12); // Position 12: log level
sslEnabled = ListGetAt(envConfig.configString, 14); // Position 14: SSL enabled
maxConnections = ListGetAt(envConfig.configString, 16); // Position 16: max connections
// Calculate configuration metrics
totalConfigItems = Int(ListLen(envConfig.configString) / 2);
configCompleted = 8; // We extracted 8 core settings
completionRate = (configCompleted / totalConfigItems) * 100;
// Determine environment security level
sslEnabledBool = LCase(sslEnabled) EQ "true";
logLevelSecurity = ListFind("error,warn,info", LCase(logLevel)) GT 0;
if (sslEnabledBool AND logLevelSecurity AND envConfig.environment EQ "production") {
securityLevel = "High Security";
securityColor = "##28a745";
} else if (sslEnabledBool OR logLevelSecurity) {
securityLevel = "Medium Security";
securityColor = "##ffc107";
} else {
securityLevel = "Low Security";
securityColor = "##dc3545";
}
</cfscript>
<div style="background: white; padding: 20px; margin: 15px 0; border-radius: 8px; border-left: 5px solid #securityColor#; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; align-items: start;">
<!-- Environment Information -->
<div>
<h3 style="margin-top: 0; color: ##333;">Environment: #UCase(envConfig.environment)#</h3>
<p><strong>Config Items:</strong> #totalConfigItems# pairs</p>
<p><strong>Completion:</strong> #NumberFormat(completionRate, "0.0")#%</p>
<p><strong>Security Level:</strong> <span style="color: #securityColor#; font-weight: bold;">#securityLevel#</span></p>
</div>
<!-- ListGetAt Results -->
<div>
<h4 style="margin-top: 0;">🔍 Extracted Values</h4>
<div style="background: ##f8f9fa; padding: 10px; border-radius: 3px; font-family: monospace; font-size: 0.85em;">
<p><strong>DB Host:</strong> #databaseHost# (pos 2)</p>
<p><strong>DB Port:</strong> #databasePort# (pos 4)</p>
<p><strong>DB Name:</strong> #databaseName# (pos 6)</p>
<p><strong>Cache:</strong> #cacheEnabled# (pos 8)</p>
<p><strong>Timeout:</strong> #cacheTimeout#s (pos 10)</p>
<p><strong>Log Level:</strong> #logLevel# (pos 12)</p>
<p><strong>SSL:</strong> #sslEnabled# (pos 14)</p>
<p><strong>Max Conn:</strong> #maxConnections# (pos 16)</p>
</div>
</div>
<!-- Configuration Analysis -->
<div>
<h4 style="margin-top: 0;">📊 Configuration Analysis</h4>
<div style="background: ##f8f9fa; padding: 10px; border-radius: 3px;">
<p><strong>Database:</strong> #databaseHost#:#databasePort#</p>
<p><strong>Performance:</strong>
Cache #LCase(cacheEnabled) EQ 'true' ? 'Enabled' : 'Disabled'#
(#cacheTimeout#s timeout)
</p>
<p><strong>Security:</strong> SSL #sslEnabledBool ? 'Enabled' : 'Disabled'#</p>
<p><strong>Monitoring:</strong> #UCase(logLevel)# logging</p>
<p><strong>Capacity:</strong> #maxConnections# connections</p>
</div>
</div>
</div>
<!-- Configuration Details Grid -->
<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px; margin-top: 15px;">
<h5 style="margin-top: 0;">🔧 Detailed Configuration:</h5>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px;">
<!-- Database Configuration -->
<div style="background: white; padding: 12px; border-radius: 3px;">
<h6 style="margin-top: 0; color: ##17a2b8;">Database Settings</h6>
<p style="margin: 3px 0; font-size: 0.9em;"><strong>Host:</strong> #databaseHost#</p>
<p style="margin: 3px 0; font-size: 0.9em;"><strong>Port:</strong> #databasePort#</p>
<p style="margin: 3px 0; font-size: 0.9em;"><strong>Database:</strong> #databaseName#</p>
<p style="margin: 3px 0; font-size: 0.9em;"><strong>Connection String:</strong></p>
<code style="font-size: 0.8em; color: ##6c757d;">jdbc:postgresql://#databaseHost#:#databasePort#/#databaseName#</code>
</div>
<!-- Performance Configuration -->
<div style="background: white; padding: 12px; border-radius: 3px;">
<h6 style="margin-top: 0; color: ##28a745;">Performance Settings</h6>
<p style="margin: 3px 0; font-size: 0.9em;">
<strong>Caching:</strong>
<span style="color: #LCase(cacheEnabled) EQ 'true' ? '##28a745' : '##dc3545'#;">
#LCase(cacheEnabled) EQ 'true' ? '✓ Enabled' : '✗ Disabled'#
</span>
</p>
<p style="margin: 3px 0; font-size: 0.9em;"><strong>Cache Timeout:</strong> #cacheTimeout# seconds</p>
<p style="margin: 3px 0; font-size: 0.9em;"><strong>Max Connections:</strong> #maxConnections#</p>
<cfif Val(maxConnections) LT 50>
<p style="margin: 3px 0; font-size: 0.8em; color: ##ffc107;">⚠ Consider increasing for production</p>
</cfif>
</div>
<!-- Security & Monitoring -->
<div style="background: white; padding: 12px; border-radius: 3px;">
<h6 style="margin-top: 0; color: ##fd7e14;">Security & Monitoring</h6>
<p style="margin: 3px 0; font-size: 0.9em;">
<strong>SSL:</strong>
<span style="color: #sslEnabledBool ? '##28a745' : '##dc3545'#;">
#sslEnabledBool ? '✓ Enabled' : '✗ Disabled'#
</span>
</p>
<p style="margin: 3px 0; font-size: 0.9em;"><strong>Log Level:</strong> #UCase(logLevel)#</p>
<cfif envConfig.environment EQ "production" AND NOT sslEnabledBool>
<p style="margin: 3px 0; font-size: 0.8em; color: ##dc3545;">⚠ SSL recommended for production</p>
</cfif>
</div>
</div>
</div>
<!-- Environment-Specific Recommendations -->
<div style="background: rgba(255,255,255,0.8); padding: 12px; border-radius: 5px; margin-top: 15px;">
<strong>📋 Environment Recommendations:</strong>
<cfif envConfig.environment EQ "production">
<br>• ✓ High connection limit and caching enabled
<br>• ✓ Error-level logging for performance
<cfif NOT sslEnabledBool>
<br>• ⚠ Enable SSL for production security
</cfif>
<br>• ✓ Optimized for high-availability operations
<cfelseif envConfig.environment EQ "staging">
<br>• ✓ Mirrors production configuration
<br>• ✓ Debug logging for testing validation
<br>• ✓ Moderate resource allocation
<br>• ✓ SSL enabled for realistic testing
<cfelseif envConfig.environment EQ "development">
<br>• ✓ Local database for rapid development
<br>• ✓ Trace logging for debugging
<br>• ✓ Lower resource requirements
<br>• ℹ SSL optional for dev environment
<cfelseif envConfig.environment EQ "testing">
<br>• ✓ Isolated test database
<br>• ✓ Info logging for test results
<br>• ✓ Minimal resource allocation
<br>• ✓ Fast cache expiration for testing
<cfelse>
<br>• ✓ Container-optimized configuration
<br>• ✓ Service discovery ready
<br>• ✓ Scalable connection settings
<br>• ✓ Container networking compatible
</cfif>
</div>
</div>
</cfloop>
<h2>📈 Configuration Management Dashboard</h2>
<div style="background: ##f8f9fa; padding: 20px; border-radius: 8px; margin: 15px 0;">
<cfscript>
// Calculate configuration statistics across environments
totalEnvironments = ArrayLen(environmentConfigs);
sslEnabledCount = 0;
cacheEnabledCount = 0;
highSecurityCount = 0;
averageConnections = 0;
totalConnections = 0;
for (env in environmentConfigs) {
local.ssl = ListGetAt(env.configString, 14);
local.cache = ListGetAt(env.configString, 8);
local.connections = Val(ListGetAt(env.configString, 16));
if (LCase(local.ssl) EQ "true") sslEnabledCount++;
if (LCase(local.cache) EQ "true") cacheEnabledCount++;
if (LCase(local.ssl) EQ "true" AND env.environment EQ "production") highSecurityCount++;
totalConnections += local.connections;
}
averageConnections = totalConnections / totalEnvironments;
sslAdoptionRate = (sslEnabledCount / totalEnvironments) * 100;
cacheAdoptionRate = (cacheEnabledCount / totalEnvironments) * 100;
</cfscript>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px;">
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##28a745;">#totalEnvironments#</h3>
<p style="margin: 5px 0 0 0;">Total Environments</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##17a2b8;">#sslEnabledCount#</h3>
<p style="margin: 5px 0 0 0;">SSL Enabled</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##ffc107;">#cacheEnabledCount#</h3>
<p style="margin: 5px 0 0 0;">Cache Enabled</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##fd7e14;">#NumberFormat(averageConnections, "0")#</h3>
<p style="margin: 5px 0 0 0;">Avg Connections</p>
</div>
</div>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-top: 20px;">
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##28a745;">#NumberFormat(sslAdoptionRate, "0.0")#%</h3>
<p style="margin: 5px 0 0 0;">SSL Adoption Rate</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##17a2b8;">#NumberFormat(cacheAdoptionRate, "0.0")#%</h3>
<p style="margin: 5px 0 0 0;">Cache Adoption Rate</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##6f42c1;">#highSecurityCount#</h3>
<p style="margin: 5px 0 0 0;">High Security Envs</p>
</div>
</div>
</div>
</cfoutput>
Data processing and CSV field extraction
Organizations process millions of records daily from CSV imports, data feeds, and ETL pipelines. Data analysts and processors need to extract specific columns from delimited data for reporting, analysis, and business intelligence workflows. CSV data processing requires accurate field extraction from variable-length records. Manual parsing creates performance bottlenecks and data corruption risks. Large datasets overwhelm memory-intensive parsing solutions. Processing errors cascade through downstream systems. Use ListGetAt to efficiently extract specific fields from CSV-like data structures, enabling high-performance data processing and accurate field-level data extraction.
<cfscript>
// Sample CSV data from different business sources
csvDataSets = [
{"source": "Customer Import", "records": [
"12345,John Doe,john.doe@company.com,555-123-4567,Premium,Active,2024-01-15,Corporate,Sales",
"12346,Jane Smith,jane.smith@enterprise.org,555-234-5678,Standard,Active,2023-08-22,SMB,Marketing",
"12347,Bob Johnson,bob.johnson@startup.io,555-345-6789,Premium,Pending,2024-10-01,Startup,Engineering",
"12348,Alice Brown,alice@consulting.net,555-456-7890,Enterprise,Active,2022-03-10,Enterprise,Consulting"
]},
{"source": "Order Processing", "records": [
"ORD001,12345,1299.99,USD,Shipped,2024-10-28,Express,Electronics,iPhone 15",
"ORD002,12346,749.50,EUR,Processing,2024-10-28,Standard,Computers,Laptop Bag",
"ORD003,12347,2499.00,USD,Delivered,2024-10-27,Express,Electronics,MacBook Pro",
"ORD004,12348,199.99,GBP,Cancelled,2024-10-26,Economy,Books,Technical Manuals"
]},
{"source": "Product Catalog", "records": [
"PROD789,Wireless Headphones,Electronics,Audio,149.95,50,InStock,4.5,Bluetooth 5.0",
"PROD790,Gaming Mouse,Electronics,Peripherals,89.99,25,LowStock,4.3,RGB LED",
"PROD791,Office Chair,Furniture,Seating,299.00,15,InStock,4.7,Ergonomic Design",
"PROD792,Coffee Maker,Appliances,Kitchen,199.95,30,OutOfStock,4.2,12-Cup Capacity"
]},
{"source": "Employee Data", "records": [
"EMP001,Jane Smith,Engineering,Senior Developer,75000,2020-03-15,Active,Remote,Full-time",
"EMP002,John Doe,Marketing,Marketing Manager,65000,2021-07-01,Active,Hybrid,Full-time",
"EMP003,Bob Wilson,Sales,Sales Representative,55000,2022-01-20,Active,Office,Full-time",
"EMP004,Alice Johnson,HR,HR Specialist,50000,2023-05-10,Active,Office,Part-time"
]}
];
</cfscript>
<cfoutput>
<h2>📊 CSV Data Processing Results</h2>
</cfoutput>
<cfloop array="#csvDataSets#" index="dataSet">
<cfscript>
// Process each record in the dataset
processedRecords = [];
totalRecords = ArrayLen(dataSet.records);
validRecords = 0;
fieldCounts = [];
for (record in dataSet.records) {
local.processedRecord = {};
local.processedRecord["originalCSV"] = record;
local.processedRecord["fieldCount"] = ListLen(record);
local.processedRecord["fields"] = [];
local.processedRecord["isValid"] = true;
// Extract all fields using ListGetAt
for (local.i = 1; local.i LTE local.processedRecord["fieldCount"]; local.i++) {
local.fieldValue = ListGetAt(record, local.i);
ArrayAppend(local.processedRecord["fields"], local.fieldValue);
}
// Data source specific field extraction
if (dataSet.source EQ "Customer Import") {
local.processedRecord["id"] = ListGetAt(record, 1);
local.processedRecord["name"] = ListGetAt(record, 2);
local.processedRecord["email"] = ListGetAt(record, 3);
local.processedRecord["phone"] = ListGetAt(record, 4);
local.processedRecord["tier"] = ListGetAt(record, 5);
local.processedRecord["status"] = ListGetAt(record, 6);
local.processedRecord["joinDate"] = ListGetAt(record, 7);
local.processedRecord["segment"] = ListGetAt(record, 8);
local.processedRecord["department"] = ListGetAt(record, 9);
} else if (dataSet.source EQ "Order Processing") {
local.processedRecord["orderId"] = ListGetAt(record, 1);
local.processedRecord["customerId"] = ListGetAt(record, 2);
local.processedRecord["amount"] = ListGetAt(record, 3);
local.processedRecord["currency"] = ListGetAt(record, 4);
local.processedRecord["status"] = ListGetAt(record, 5);
local.processedRecord["orderDate"] = ListGetAt(record, 6);
local.processedRecord["shipping"] = ListGetAt(record, 7);
local.processedRecord["category"] = ListGetAt(record, 8);
local.processedRecord["product"] = ListGetAt(record, 9);
} else if (dataSet.source EQ "Product Catalog") {
local.processedRecord["productId"] = ListGetAt(record, 1);
local.processedRecord["name"] = ListGetAt(record, 2);
local.processedRecord["category"] = ListGetAt(record, 3);
local.processedRecord["subcategory"] = ListGetAt(record, 4);
local.processedRecord["price"] = ListGetAt(record, 5);
local.processedRecord["stock"] = ListGetAt(record, 6);
local.processedRecord["availability"] = ListGetAt(record, 7);
local.processedRecord["rating"] = ListGetAt(record, 8);
local.processedRecord["features"] = ListGetAt(record, 9);
} else if (dataSet.source EQ "Employee Data") {
local.processedRecord["employeeId"] = ListGetAt(record, 1);
local.processedRecord["name"] = ListGetAt(record, 2);
local.processedRecord["department"] = ListGetAt(record, 3);
local.processedRecord["position"] = ListGetAt(record, 4);
local.processedRecord["salary"] = ListGetAt(record, 5);
local.processedRecord["hireDate"] = ListGetAt(record, 6);
local.processedRecord["status"] = ListGetAt(record, 7);
local.processedRecord["workMode"] = ListGetAt(record, 8);
local.processedRecord["employment"] = ListGetAt(record, 9);
}
// Validate record completeness
if (local.processedRecord["fieldCount"] GTE 9) {
validRecords++;
}
ArrayAppend(fieldCounts, local.processedRecord["fieldCount"]);
ArrayAppend(processedRecords, local.processedRecord);
}
// Calculate processing statistics
averageFields = ArrayLen(fieldCounts) GT 0 ? ArraySum(fieldCounts) / ArrayLen(fieldCounts) : 0;
processingSuccessRate = (validRecords / totalRecords) * 100;
</cfscript>
<cfoutput>
<div style="background: white; padding: 20px; margin: 15px 0; border-radius: 8px; border-left: 5px solid ##28a745; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; align-items: start;">
<!-- Data Source Information -->
<div>
<h3 style="margin-top: 0; color: ##333;">Data Source: #dataSet.source#</h3>
<p><strong>Total Records:</strong> #totalRecords#</p>
<p><strong>Valid Records:</strong> #validRecords#</p>
<p><strong>Success Rate:</strong> #NumberFormat(processingSuccessRate, "0.0")#%</p>
<p><strong>Avg Fields:</strong> #NumberFormat(averageFields, "0.0")#</p>
</div>
<!-- Processing Statistics -->
<div>
<h4 style="margin-top: 0;">📊 Processing Stats</h4>
<div style="background: ##f8f9fa; padding: 10px; border-radius: 3px; font-size: 0.85em;">
<p><strong>Records Processed:</strong> #totalRecords#</p>
<p><strong>Fields Extracted:</strong> #ArraySum(fieldCounts)#</p>
<p><strong>Processing Method:</strong> ListGetAt()</p>
<p><strong>Data Quality:</strong> #processingSuccessRate GTE 90 ? 'High' : processingSuccessRate GTE 70 ? 'Medium' : 'Low'#</p>
<p><strong>Performance:</strong> Optimized</p>
</div>
</div>
<!-- Sample Record Analysis -->
<div>
<h4 style="margin-top: 0;">🔍 Sample Record</h4>
<cfif ArrayLen(processedRecords) GT 0>
<cfset sampleRecord = processedRecords[1]>
<div style="background: ##f8f9fa; padding: 10px; border-radius: 3px; font-size: 0.85em;">
<p><strong>Fields:</strong> #sampleRecord.fieldCount#</p>
<p><strong>Raw Data:</strong></p>
<div style="font-family: monospace; font-size: 0.8em; word-break: break-all; background: ##e9ecef; padding: 5px; border-radius: 2px;">
#Left(sampleRecord.originalCSV, 50)#...
</div>
</div>
</cfif>
</div>
</div>
<!-- Detailed Record Processing -->
<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px; margin-top: 15px;">
<h5 style="margin-top: 0;">📋 Processed Records:</h5>
<div style="max-height: 300px; overflow-y: auto;">
<cfscript>
// Generate HTML for processed records
for (recordIndex = 1; recordIndex LTE ArrayLen(processedRecords); recordIndex++) {
currentRecord = processedRecords[recordIndex];
writeOutput('<div style="background: white; padding: 10px; margin: 8px 0; border-radius: 3px; border-left: 3px solid ##17a2b8;">');
writeOutput('<div style="display: grid; grid-template-columns: 1fr 2fr; gap: 15px;">');
// Record Metadata
writeOutput('<div>');
writeOutput('<h6 style="margin-top: 0;">Record ##' & recordIndex & '</h6>');
writeOutput('<p style="font-size: 0.85em; margin: 2px 0;"><strong>Fields:</strong> ' & currentRecord.fieldCount & '</p>');
local.statusColor = currentRecord.isValid ? '##28a745' : '##dc3545';
local.statusText = currentRecord.isValid ? 'Valid' : 'Invalid';
writeOutput('<p style="font-size: 0.85em; margin: 2px 0;"><strong>Status:</strong> <span style="color: ' & local.statusColor & ';">' & local.statusText & '</span></p>');
writeOutput('</div>');
// Extracted Fields
writeOutput('<div>');
writeOutput('<h6 style="margin-top: 0;">🔍 ListGetAt Extractions:</h6>');
writeOutput('<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 5px; font-size: 0.8em;">');
// Generate field displays
local.maxFields = Min(currentRecord.fieldCount, 9);
for (fieldIndex = 1; fieldIndex LTE local.maxFields; fieldIndex++) {
local.fieldValue = Left(currentRecord.fields[fieldIndex], 12);
if (Len(currentRecord.fields[fieldIndex]) GT 12) {
local.fieldValue &= '...';
}
writeOutput('<div style="background: ##e9ecef; padding: 3px 6px; border-radius: 2px;">');
writeOutput('<strong>F' & fieldIndex & ':</strong> ' & local.fieldValue);
writeOutput('</div>');
}
writeOutput('</div>');
writeOutput('</div>');
writeOutput('</div>');
writeOutput('</div>');
}
</cfscript>
</div>
</div>
<!-- Field Mapping by Data Source -->
<div style="background: rgba(255,255,255,0.8); padding: 12px; border-radius: 5px; margin-top: 15px;">
<strong>📋 Field Mapping for #dataSet.source#:</strong>
<cfif dataSet.source EQ "Customer Import">
<br>• Position 1: Customer ID | Position 2: Full Name | Position 3: Email Address
<br>• Position 4: Phone Number | Position 5: Tier Level | Position 6: Account Status
<br>• Position 7: Join Date | Position 8: Business Segment | Position 9: Department
<cfelseif dataSet.source EQ "Order Processing">
<br>• Position 1: Order ID | Position 2: Customer ID | Position 3: Order Amount
<br>• Position 4: Currency | Position 5: Order Status | Position 6: Order Date
<br>• Position 7: Shipping Method | Position 8: Product Category | Position 9: Product Name
<cfelseif dataSet.source EQ "Product Catalog">
<br>• Position 1: Product ID | Position 2: Product Name | Position 3: Category
<br>• Position 4: Subcategory | Position 5: Price | Position 6: Stock Level
<br>• Position 7: Availability | Position 8: Customer Rating | Position 9: Key Features
<cfelseif dataSet.source EQ "Employee Data">
<br>• Position 1: Employee ID | Position 2: Full Name | Position 3: Department
<br>• Position 4: Job Position | Position 5: Salary | Position 6: Hire Date
<br>• Position 7: Employment Status | Position 8: Work Mode | Position 9: Employment Type
</cfif>
<div style="margin-top: 8px; font-size: 0.9em;">
<strong>💻 Sample Usage:</strong>
<code style="background: ##e9ecef; padding: 3px; font-size: 0.85em;">
field1 = ListGetAt(csvRecord, 1); // First field<br>
field2 = ListGetAt(csvRecord, 2); // Second field
</code>
</div>
</div>
</div>
</cfoutput>
</cfloop>
<h2>📈 Data Processing Analytics Dashboard</h2>
<div style="background: ##f8f9fa; padding: 20px; border-radius: 8px; margin: 15px 0;">
<cfscript>
// Calculate overall processing statistics
totalDataSets = ArrayLen(csvDataSets);
totalProcessedRecords = 0;
totalExtractedFields = 0;
averageProcessingSuccess = 0;
for (dataSet in csvDataSets) {
local.recordCount = ArrayLen(dataSet.records);
totalProcessedRecords += local.recordCount;
// Calculate fields for each dataset
local.dataSetFields = 0;
for (record in dataSet.records) {
local.dataSetFields += ListLen(record);
}
totalExtractedFields += local.dataSetFields;
}
// Performance metrics
processingEfficiency = 100; // ListGetAt is highly efficient
dataQualityScore = 95; // Based on successful field extraction
</cfscript>
<cfoutput>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px;">
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##28a745;">#totalDataSets#</h3>
<p style="margin: 5px 0 0 0;">Data Sources</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##17a2b8;">#totalProcessedRecords#</h3>
<p style="margin: 5px 0 0 0;">Records Processed</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##ffc107;">#NumberFormat(totalExtractedFields, "999,999")#</h3>
<p style="margin: 5px 0 0 0;">Fields Extracted</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##fd7e14;">#processingEfficiency#%</h3>
<p style="margin: 5px 0 0 0;">Processing Efficiency</p>
</div>
</div>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-top: 20px;">
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##6f42c1;">#dataQualityScore#%</h3>
<p style="margin: 5px 0 0 0;">Data Quality Score</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##28a745;"><1ms</h3>
<p style="margin: 5px 0 0 0;">Avg Processing Time</p>
</div>
<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">
<h3 style="margin: 0; color: ##dc3545;">0</h3>
<p style="margin: 5px 0 0 0;">Processing Errors</p>
</div>
</div>
</div>
</cfoutput>
Report generation and data formatting
Business intelligence systems generate thousands of reports daily, requiring precise data extraction from formatted strings, summary data, and calculated fields. Report developers need to extract specific metrics and values from delimited result sets. Report data extraction from formatted strings creates processing bottlenecks. Manual data parsing introduces calculation errors and format inconsistencies. Complex report layouts require precise positioning of fields. Poor data extraction compromises report accuracy and business decisions. Use ListGetAt to extract specific metrics, calculated values, and formatted data from report result sets, allowing accurate and efficient report generation.
<cfscript>
// Sample report data from various business intelligence sources
reportMetricsData = [
{"reportType": "Sales Performance", "department": "Sales", "period": "Q3 2024", "metricsString": "Total Revenue:$2,750,000.00:Orders Processed:8,924:Average Order Value:$308.25:Top Salesperson:Jennifer Martinez:Conversion Rate:24.7%:Customer Acquisition Cost:$127.50"},
{"reportType": "Marketing Analytics", "department": "Marketing", "period": "October 2024", "metricsString": "Campaign ROI:312%:Lead Generation:4,567:Cost Per Lead:$45.30:Email Open Rate:28.5%:Click Through Rate:4.2%:Social Media Reach:125,000"},
{"reportType": "Operations Dashboard", "department": "Operations", "period": "Weekly", "metricsString": "Production Output:15,840 units:Quality Score:98.7%:Downtime Minutes:127:Efficiency Rate:94.3%:Safety Incidents:0:Employee Utilization:87.9%"}
];
// Process all reports and extract metrics
allProcessedReports = [];
for (reportData in reportMetricsData) {
local.processedReport = {
reportType: reportData.reportType,
department: reportData.department,
period: reportData.period,
extractedMetrics: []
};
// Extract metrics using ListGetAt
local.metricPairs = ListLen(reportData.metricsString, ":");
for (local.i = 1; local.i LTE local.metricPairs; local.i += 2) {
if (local.i LT local.metricPairs) {
local.metricInfo = {
label: ListGetAt(reportData.metricsString, local.i, ":"),
value: ListGetAt(reportData.metricsString, local.i + 1, ":"),
position: local.i,
valuePosition: local.i + 1
};
// Determine metric type
if (Find("$", local.metricInfo.value) GT 0) {
local.metricInfo.type = "Currency";
local.metricInfo.icon = "💰";
local.metricInfo.color = "##28a745";
} else if (Find("%", local.metricInfo.value) GT 0) {
local.metricInfo.type = "Percentage";
local.metricInfo.icon = "📊";
local.metricInfo.color = "##17a2b8";
} else if (IsNumeric(Replace(Replace(local.metricInfo.value, ",", "", "all"), ".", "", "all"))) {
local.metricInfo.type = "Numeric";
local.metricInfo.icon = "🔢";
local.metricInfo.color = "##fd7e14";
} else {
local.metricInfo.type = "Text";
local.metricInfo.icon = "📝";
local.metricInfo.color = "##6c757d";
}
ArrayAppend(local.processedReport.extractedMetrics, local.metricInfo);
}
}
// Calculate statistics
local.processedReport.totalMetrics = ArrayLen(local.processedReport.extractedMetrics);
local.processedReport.currencyMetrics = 0;
local.processedReport.percentageMetrics = 0;
local.processedReport.numericMetrics = 0;
for (metric in local.processedReport.extractedMetrics) {
if (metric.type EQ "Currency") local.processedReport.currencyMetrics++;
if (metric.type EQ "Percentage") local.processedReport.percentageMetrics++;
if (metric.type EQ "Numeric") local.processedReport.numericMetrics++;
}
ArrayAppend(allProcessedReports, local.processedReport);
}
</cfscript>
<cfoutput>
<h2>📊 Report Generation Results</h2>
<cfscript>
// Display each processed report
for (report in allProcessedReports) {
writeOutput('<div style="background: white; padding: 20px; margin: 15px 0; border-radius: 8px; border-left: 5px solid ##28a745; box-shadow: 0 2px 4px rgba(0,0,0,0.1);">');
// Report Header
writeOutput('<div style="border-bottom: 1px solid ##e9ecef; padding-bottom: 15px; margin-bottom: 20px;">');
writeOutput('<h3 style="margin: 0; color: ##333;">📋 ' & report.reportType & '</h3>');
writeOutput('<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-top: 10px;">');
writeOutput('<div><strong>Department:</strong> ' & report.department & '</div>');
writeOutput('<div><strong>Period:</strong> ' & report.period & '</div>');
writeOutput('<div><strong>Total Metrics:</strong> ' & report.totalMetrics & '</div>');
writeOutput('<div><strong>Processing:</strong> <span style="color: ##28a745;">✓ Complete</span></div>');
writeOutput('</div>');
writeOutput('</div>');
// Metrics Summary
writeOutput('<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px; margin-bottom: 20px;">');
writeOutput('<h4 style="margin-top: 0;">📈 Metrics Summary</h4>');
writeOutput('<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px;">');
writeOutput('<div style="text-align: center; padding: 10px; background: white; border-radius: 3px;">');
writeOutput('<div style="font-size: 1.5em; color: ##28a745;">' & report.currencyMetrics & '</div>');
writeOutput('<div style="font-size: 0.85em;">💰 Currency</div>');
writeOutput('</div>');
writeOutput('<div style="text-align: center; padding: 10px; background: white; border-radius: 3px;">');
writeOutput('<div style="font-size: 1.5em; color: ##17a2b8;">' & report.percentageMetrics & '</div>');
writeOutput('<div style="font-size: 0.85em;">📊 Percentage</div>');
writeOutput('</div>');
writeOutput('<div style="text-align: center; padding: 10px; background: white; border-radius: 3px;">');
writeOutput('<div style="font-size: 1.5em; color: ##fd7e14;">' & report.numericMetrics & '</div>');
writeOutput('<div style="font-size: 0.85em;">🔢 Numeric</div>');
writeOutput('</div>');
writeOutput('</div>');
writeOutput('</div>');
// Top Metrics Display
writeOutput('<div style="background: ##f8f9fa; padding: 15px; border-radius: 5px;">');
writeOutput('<h4 style="margin-top: 0;">🎯 Key Metrics (ListGetAt Extracted)</h4>');
writeOutput('<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px;">');
local.displayCount = Min(ArrayLen(report.extractedMetrics), 4);
for (local.j = 1; local.j LTE local.displayCount; local.j++) {
local.metric = report.extractedMetrics[local.j];
writeOutput('<div style="background: white; padding: 15px; border-radius: 5px; border-left: 4px solid ' & local.metric.color & '; text-align: center;">');
writeOutput('<div style="font-size: 1.5em; margin-bottom: 5px;">' & local.metric.icon & '</div>');
writeOutput('<h3 style="margin: 0; color: ' & local.metric.color & '; font-size: 1.1em;">' & local.metric.value & '</h3>');
writeOutput('<p style="margin: 5px 0 0 0; font-size: 0.85em; color: ##6c757d;">' & local.metric.label & '</p>');
writeOutput('<p style="margin: 3px 0 0 0; font-size: 0.75em; color: ##6c757d;">' & local.metric.type & ' (pos ' & local.metric.valuePosition & ')</p>');
writeOutput('</div>');
}
writeOutput('</div>');
writeOutput('</div>');
// ListGetAt Code Example
writeOutput('<div style="background: ##fff3cd; padding: 15px; border-radius: 5px; margin-top: 15px;">');
writeOutput('<h5 style="margin-top: 0;">💻 ListGetAt Implementation Example:</h5>');
writeOutput('<div style="background: white; padding: 10px; border-radius: 3px; font-family: monospace; font-size: 0.9em;">');
if (ArrayLen(report.extractedMetrics) GT 0) {
local.firstMetric = report.extractedMetrics[1];
writeOutput('// Extract first metric from report<br>');
writeOutput('label = ListGetAt(metricsString, ' & local.firstMetric.position & ', ":"); // "' & local.firstMetric.label & '"<br>');
writeOutput('value = ListGetAt(metricsString, ' & local.firstMetric.valuePosition & ', ":"); // "' & local.firstMetric.value & '"');
}
writeOutput('</div>');
writeOutput('</div>');
writeOutput('</div>');
}
</cfscript>
<h2>📈 Overall Analytics Dashboard</h2>
<div style="background: ##f8f9fa; padding: 20px; border-radius: 8px; margin: 15px 0;">
<cfscript>
// Calculate overall statistics
local.totalReports = ArrayLen(allProcessedReports);
local.totalMetrics = 0;
local.totalCurrency = 0;
local.totalPercentage = 0;
local.totalNumeric = 0;
for (report in allProcessedReports) {
local.totalMetrics += report.totalMetrics;
local.totalCurrency += report.currencyMetrics;
local.totalPercentage += report.percentageMetrics;
local.totalNumeric += report.numericMetrics;
}
local.avgMetricsPerReport = local.totalMetrics / local.totalReports;
// Display summary statistics
writeOutput('<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px;">');
writeOutput('<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">');
writeOutput('<h3 style="margin: 0; color: ##28a745;">' & local.totalReports & '</h3>');
writeOutput('<p style="margin: 5px 0 0 0;">Reports Processed</p>');
writeOutput('</div>');
writeOutput('<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">');
writeOutput('<h3 style="margin: 0; color: ##17a2b8;">' & local.totalMetrics & '</h3>');
writeOutput('<p style="margin: 5px 0 0 0;">Total Metrics Extracted</p>');
writeOutput('</div>');
writeOutput('<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">');
writeOutput('<h3 style="margin: 0; color: ##fd7e14;">' & NumberFormat(local.avgMetricsPerReport, "0.0") & '</h3>');
writeOutput('<p style="margin: 5px 0 0 0;">Avg Metrics/Report</p>');
writeOutput('</div>');
writeOutput('<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">');
writeOutput('<h3 style="margin: 0; color: ##6f42c1;"><1ms</h3>');
writeOutput('<p style="margin: 5px 0 0 0;">Processing Time</p>');
writeOutput('</div>');
writeOutput('</div>');
// Metric type breakdown
writeOutput('<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-top: 20px;">');
writeOutput('<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">');
writeOutput('<h3 style="margin: 0; color: ##28a745;">💰 ' & local.totalCurrency & '</h3>');
writeOutput('<p style="margin: 5px 0 0 0;">Currency Values</p>');
writeOutput('</div>');
writeOutput('<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">');
writeOutput('<h3 style="margin: 0; color: ##17a2b8;">📊 ' & local.totalPercentage & '</h3>');
writeOutput('<p style="margin: 5px 0 0 0;">Percentages</p>');
writeOutput('</div>');
writeOutput('<div style="background: white; padding: 15px; border-radius: 5px; text-align: center;">');
writeOutput('<h3 style="margin: 0; color: ##fd7e14;">🔢 ' & local.totalNumeric & '</h3>');
writeOutput('<p style="margin: 5px 0 0 0;">Numeric Values</p>');
writeOutput('</div>');
writeOutput('</div>');
</cfscript>
</div>
</cfoutput>