CFLib.org – Common Function Library Project

DataManipulationLib

Last updated June 23, 2014 / 175 Released UDF(s)
Array

This functions helps to quickly build arrays, both simple and complex. | Requires: CF5

arrayAppend2D

Appends two values to a 2D array. | Requires: CF5

ArrayAppendUnique

Appends a value to an array if the value does not already exist within the array. | Requires: CF5

ArrayCartesianProduct

Returns a cartesian product (a join) of arbitrary number of arrays. | Requires: CF9

arrayCollectionToQuery

Converts a Flex ArrayCollection object to a ColdFusion Query object | Requires: CF7

arrayCompact

Used to remove missing positions from an array. | Requires: CF6

arrayCompare

Recursive functions to compare arrays and nested structures. | Requires: CF5

ArrayConcat

Concatenates two arrays. | Requires: CF5

ArrayContains

Returns the index of the first item in an array that contains a specified substring. | Requires: CF5

ArrayContainsNoCase

Returns the index of the first item in an array that contains a specified substring. | Requires: CF5

ArrayDefinedAt

Returns true if a specified array position is defined. | Requires: CF6

arrayDeleteArray

Remove elements from one array which exist in another array. | Requires: CF6

ArrayDeleteAtList

Deletes an elements list from an array. | Requires: CF5

arrayDiff

Compares two arrays and returns the difference between the two. | Requires: CF6

arrayExcludeNumeric

Excludes numeric items from an array. | Requires: CF6

arrayExcludeString

Excludes string items from an array. | Requires: CF6

ArrayFilter

Applies a filter to an array. | Requires: CF5

arrayFind

The arrayFind function uses the java.util.list indexOf function to find an element in an array. | Requires: CF6

ArrayFindByDimension

Search a multidimensional array for a value. | Requires: CF6

ArrayFindNoCase

Like listFindNoCase(), but for arrays. | Requires: CF5

arrayFindSorted

Locate a value in an already-sorted array. | Requires: CF5

arrayGroupsOf

Splits or iterates over the array in number of groups. | Requires: CF6

ArrayInsertArrayAt

Inserts an array at specified position in another array. | Requires: CF5

ArrayListCompareNoCase

Returns the index of the first item in an array that contains a list element. | Requires: CF5

arrayMap

arrayMap() for CF9/10 | Requires: CF9

arrayOfObjectsToQuery

Converts an array of objects to a CF Query Object. | Requires: CF6

arrayOfStructsFind

Returns the position of an element in an array of structures. | Requires: CF5

ArrayOfStructsSort

Sorts an array of structures based on a key in the structures. | Requires: CF5

arrayofStructsToList

Parses an array of consistent structs to return one key. | Requires: CF5

ArrayOfStructsToStructOfArrays

Changes a given array of structures to a structure of arrays. | Requires: CF5

arrayOfStructsToStructsOfStructs

Converts an array of structures to an structure of structures, | Requires: CF6

ArrayOfStructuresToQuery

Converts an array of structures to a CF Query Object. | Requires: CF5

ArrayReverse

Reverses the order of elements in a one-dimensional array. | Requires: CF5

arraySetEach

Variation of arraySet() which uses a callback to set each array element | Requires: CF10

ArrayShuffle

Shuffles the values in a one-dimensional array. | Requires: CF5

arraySlice

Slices an array. | Requires: CF5

arraySlice2

An arraySlice using Java 1.4 ArrayList built-in method. | Requires: CF6

ArraySort2D

Sorts a two dimensional array by the specified column in the second dimension. | Requires: CF5

arrayTrim

This method trims an array to the specified number of elements. | Requires: CF6

Assert

Complex variable checking with a single function call. | Requires: CF5

booleanize

Simply converts access yes/no or other boolean variables to 0/1 format, almost opposite of yesnoformat | Requires: CF7

cacheCreate

I create a new user defined cache region in Ehcache with customizable parameters. | Requires: CF9

cfquery

Mocks the CFQUERY tag. | Requires: CF5

clearStructureNested

This function recurse through a structure and makes all fields as empty string | Requires: CF6

ColumnLoop

Applies simple evaluations to every cell in a query column. | Requires: CF5

columnTotal

This UDF calculates the total of a column from a query. | Requires: CF5

component

Creates a CFC instance based upon a relative, absolute or dot notation path. | Requires: CF6

convertDotNetDataset

Takes a .Net dataset and converts it to a CF structure of queries. | Requires: CF7

convertQueryStringToStruct

Converts a URL query string to a struct | Requires: CF8

CounterMinusMinus

Simulate the c functionality of i--. | Requires: CF5

CounterPlusPlus

Simulate the c functionality of i++. | Requires: CF5

CSVFormat

CSVFormat accepts the name of an existing query and converts it to csv format. | Requires: CF5

CSVToQuery

Transform a CSV formatted string with header column into a query object. | Requires: CF5

DeepStructCount

Counts the number of keys in a structure of structures. | Requires: CF5

DumpVar

Displays contents of any data type except WDDX. | Requires: CF5

duplicateDB

Duplicates small to medium MySQL databases. | Requires: CF8

DynamicValueList

Returns a value list from a dynamic column of a query. | Requires: CF5

extend

Merge the contents of two or more structs together into the first struct. | Requires: CF9

FirstInFirstOut

Removes the element at index one and inserts a new element at the highest index plus one. | Requires: CF5

fixedWidthToQuery

Converts fixed width string to a ColdFusion query. | Requires: CF6

flattenStruct

Builds nested structs into a single struct. | Requires: CF6

Form2QS

Converts form variables to query string. | Requires: CF5

Get

Examine the contents of a BINARY file. | Requires: CF6

getComponentProps

Returns an array of all properties in cfc's metadata, inherited or not. | Requires: CF6

getQueryMetadata

Replicates the CF7 getMetadata(query) functionality for MX6.1+ | Requires: CF6

getRowFromQuery

Return a single row from a query. | Requires: CF5

GetXmlAttribute

Pass in an XML Node and attribute reference to receive the attribute's value. | Requires: CF6

GuidToString

Accepts a numeric GUID stored in a Byte Array and converts it to a string in the normal convention. | Requires: CF6

isArrayOfStructs

Tells you if a variable is an array of structs | Requires: CF9

isBit

Checks that a value is equal to 1 or 0. | Requires: CF5

isCachedQuery

Return true if the queryname passed was a cached query. | Requires: CF6

IsCFC

Returns a boolean for whether a CF variable is a CFC instance. | Requires: CF6

IsCFCType

Checks if a given variable is a specific CFC type | Requires: CF6

isDefinedValue

Checks that a variable is defined and that the variable is not an empty value. Optionally lets you check that the variable is a specific value. | Requires: CF5

isDefinedValueMX

Checks that a variable exists and has value. CFMX version. | Requires: CF6

IsEmpty

Check if a variable is set and has a value. | Requires: CF5

IsNull

Returns True if the value passed to it represents "NULL". | Requires: CF5

IsSafeArray

Returns true if all positions in an array are defined. | Requires: CF6

IsXML

Checks to see if a string is valid XML. | Requires: CF6

LenStruct

Computes the length of every key in the passed structure and returns a structure with unique key names of the lengths. | Requires: CF5

listEach

UDF to loop over a list | Requires: CF10

listToQuery

Converts a list to a single-column query. | Requires: CF6

ListToStruct

Converts a delimited list of key/value pairs to a structure. | Requires: CF5

ListToStructRepeatKeys

Based on ListToStruct() from Rob Brooks-Bilson, this one allows the structure key to be repeated and the value added to a list. | Requires: CF5

maketree

This function is a UDF for maketree custom tag developed by Michael Dinowitz. | Requires: CF5

MinusMinusCounter

Simulate the c functionality of --i. | Requires: CF5

nullQuery

Initialize an empty query with default values. | Requires: CF5

PlusPlusCounter

Simulate the c functionality of ++i. | Requires: CF5

Query2Excel

Converts a query to excel-ready format. | Requires: CF5

queryAddColumnWithValue

Adds a column filled with a value to a query object. | Requires: CF6

queryBeanToQuery

Converts a Java QueryBean object to a ColdFusion query object. | Requires: CF6

queryColumns

Returns query column list. | Requires: CF6

queryColumnsToStruct

Makes a struct for all values in a given column(s) of a query. | Requires: CF6

queryColumnToArray

Takes a selected column of data from a query and converts it into an array. | Requires: CF5

queryColumnTypes

Returns a list of query column data types. | Requires: CF6

queryCompare

This function will compare two queries and returns a struct which shows the difference between two queries if any. | Requires: CF6

queryConcat

Concatenate two queries together. | Requires: CF5

queryConvertForjqGrid

Creates a data structure that can be easily used by jqGrid. | Requires: CF9

queryDeDupe

Removes duplicate rows from a query based on a key column. | Requires: CF5

QueryDeleteRows

Removes rows from a query. | Requires: CF5

queryDiff

Returns information about the differences between 2 queries with the same columns. | Requires: CF5

QueryGetCellByKey

Provides direct access to query cells by knowing a key field value within the same row. | Requires: CF5

queryh

Returns a query with any string values sanitized by HTMLEditFormat. | Requires: CF7

queryMerge

Merge two queries. | Requires: CF5

QueryRandomRows

Returns specified number of random records. | Requires: CF5

queryRemoveColumns

Remove a list of columns from a specified query. | Requires: CF5

QueryReverse

Reverse the order of a query. | Requires: CF5

QueryRowFromKey

Returns the first query row number that contains the specified key value. | Requires: CF5

queryRowToArray

queryRowToArray | Requires: CF9

queryRowToList

Function to take a single row from a query and generate a list. | Requires: CF5

QueryRowToStruct

Makes a row of a query into a structure. | Requires: CF5

QuerySetCellByKey

Allows changing of a query cell by knowing a key field value within the same row. | Requires: CF5

querySetRow

Sets the values for one or more columns in the specified query row. | Requires: CF6

QuerySim

Accepts a specifically formatted chunk of text, and returns it as a query object. | Requires: CF5

QuerySlice

Returns specific number of records starting with a specific row. | Requires: CF6

QuerySort

Sorts a query using Query of Query. | Requires: CF6

QueryToArrayOfStructures

Converts a query object into an array of structures. | Requires: CF5

QueryToCsv

Transform a query result into a csv formatted variable. | Requires: CF5

QueryToStructOfArrays

Changes a query into a struct of arrays. | Requires: CF5

queryToStructOfStructsAutoRow

Converts a query to a structure of structures with the primary index of the main structure auto incremented. | Requires: CF5

QueryToStructOfStructures

Converts a query object into a structure of structures accessible by its primary key. | Requires: CF6

QueryToVars

Change a row in a query to variables in a scope. | Requires: CF5

QueryToXML

Generates an XMLDoc object from a basic CF Query. | Requires: CF6

QueryTranspose

Transpose a query. | Requires: CF6

queryTreeSort

QueryTreeSort takes a query and efficiently (O(n)) resorts it hierarchically (parent-child), adding a Depth column that can then be used when displaying the data. | Requires: CF7

quickSort2D

Sorts a two dimensional array by the specified column using quicksort. | Requires: CF5

randomWeightedSelection

Returns a number of random selections from a list based on their given weights. | Requires: CF5

rankScores

Takes a query and ranks the scores, including ties at the same rank. | Requires: CF9

ReGroupStructureBy

Pass an Array of structures and the name of a column that exists within each, and it will create a Grouped "Structure of Array of Structures". | Requires: CF5

RemoveEmptyStructureKeys

Removes any empty structure keys from within a structure. | Requires: CF5

REStructFindValue

Searches recursively through a substructure of nested arrays, structures, and other elements for structures with values that match the search. pattern in the reg_expression parameter. | Requires: CF7

REStructFindValueNoCase

Searches recursively through a substructure of nested arrays, structures, and other elements for structures with values that match the search .pattern in the reg_expression parameter. | Requires: CF7

RowsToColumns

Transforms queries for displaying as columns instead of rows. | Requires: CF5

saTOss

Converts a structure of arrays into a name/key style structure. | Requires: CF5

ScopeCoalesce

This UDF will find the first variable scope that exists for a variable in the list of variable scopes and return its value. | Requires: CF5

shiftArray

Returns a shifted array at the passed Shift On value. | Requires: CF5

sortArrayOfStructures

Sorts an array of structures on one or more keys. | Requires: CF5

SQLBatcher

Sends a SQL Batch script and reports results. | Requires: CF6

sqlXMLToCFXML

Converts a query of XML generated by MSSQL to readable XML string. | Requires: CF6

struct

This functions helps to quickly build structures, both simple and complex. | Requires: CF6

structBlend

Blends all nested structs, arrays, and variables in a struct to another. | Requires: CF5

structCompare

Recursive functions to compare structures and arrays. | Requires: CF5

structFindKeyMatch

Like structFindKey except it matches a pattern. | Requires: CF6

structGetKey

Returns a key value from the given struct, or a default value. | Requires: CF5

StructInvert

Takes a struct of simple values and returns the structure with the values and keys inverted. | Requires: CF5

structMerge

Merge two simple structures in one combining keys or creating new ones. | Requires: CF6

StructOfArraysToQuery

Converts a structure of arrays to a CF Query. | Requires: CF5

StructOfArraysToStructOfStructs

Converts a structure of arrays to a keyed structure of structs. | Requires: CF5

StructOfListsToArrayOfStructs

Converts a structure of Lists to an Array of structures. | Requires: CF5

StructOfStructuresToQuery

Converts a structure of structures to a CF Query. | Requires: CF5

StructRenameKey

Renames a specified key in the specified structure. | Requires: CF5

structToList

Converts struct into delimited key/value list. | Requires: CF5

structToQueryRow

Adds a row to a query object and populates it with the values of a structure. | Requires: CF6

StructToQueryString

Converts a structure to a URL query string. | Requires: CF5

structUpdateVals

Update one structure values with values from another structure for those keys that match. | Requires: CF6

structValueList

Converts a structure into a key/value pair list. | Requires: CF5

structWrite

Like structInsert() but does not throw an error if the key exists and you choose not to overwrite. | Requires: CF5

toXML

Convert Structures/Arrays (including embedded) to XML. | Requires: CF6

TranslateMacromediaResourceFeed

Function to translate Macromedia's XML Resource Feed into ColdFusion variables. | Requires: CF5

trimQuery

Trim spaces from all records in a query. | Requires: CF5

TrimStruct

Trims spaces from all keys in a structure. | Requires: CF5

typedQueryNew

Function to easily create query objects with data types. | Requires: CF7

TypeOf

Returns the type of the variable. | Requires: CF5

UniqueValueList

Returns a list of unique values from a query column. | Requires: CF5

validateXMLFile

Validate an XML file against a DTD. | Requires: CF6

validateXMLString

Validate a formatted XML string against a DTD. | Requires: CF6

VarToScript

Reverses a CF variable into CFScript. | Requires: CF5

vCal

Produces output used by the vCalendar standard for PIM's (such as Outlook). | Requires: CF5

xmlDoctoString

Converts an CF XML objects to string without the XML declaration. | Requires: CF6

xmlExtractList

Extracts the text of named XML elements and returns it in a list. | Requires: CF6

xmlMerge

Merges one xml document into another | Requires: CF7

xmlToJson

Converts valid xml and valid xhtml to json | Requires: CF8

xsdValidate

Validates an XML file against an XML Schema (XSD). | Requires: CF6

xslt

Provides CFMX native XSL transformations using Java, with support for parameter pass through and relative <xsl:import> tags. | Requires: CF6

XSLTCF5

Processes an XSL Template against an XML document and returns the transformed content. | Requires: CF5

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson