Parameter
Last updated on
Apr 27, 2021
Description
Returns part of a query object with only the rows you need.
Returns
The number of records from the query object starting from an offset index.
Category
Syntax
QuerySlice(Object query,offset,length)
Member function
queryObject.Slice(offset,length)
History
New in ColdFusion (2018 release) Update 5.
Parameters
|
Required/Optional |
Description |
---|---|---|
Query |
Required |
The query object that you want to slice. |
Offset |
Required |
Specifies the position from where to slice the query object. |
Length |
Optional |
The number of rows from the offset. If you do not specify the length, the function returns all the records until the end of the query object. |
See also
Example
<cfscript> myquery=QueryExecute("SELECT * FROM APP.ART",[],{datasource="cfartgallery"}) slice1=QuerySlice(myquery,2,3) // Returns rows 2,3, and 4 slice2=QuerySlice(myquery,50) // Returns all rows including and after row 50 writedump(slice1) writedump(slice2) </cfscript>
Output
Slice1
Slice2