QueryInsertAt

Description

Inserts an element into a query. Query elements whose indexes are equal to or greater than the new position are incremented by one. 

Returns

Returns the updated query with the specified element inserted.

Category

Syntax

QueryInsertAt(query,value,position)

Member functions

queryObject.InsertAt(value,position)

See also

History

ColdFusion (2018 release) Update 5: Added the function.

Parameters

Parameter

Required/Optional

Description

query

Required

The query object where another query object is to be inserted.

value

Required

The query object to insert.

position

Required

Index position at which to insert the query object.

Example

<cfscript> 
 myQuery=queryNew("empid,depid,name", "integer,integer,varchar",[ 
    [10, 101, "John"], 
    [20, 120, "James"], 
    [30, 205, "Peter"] 
    ]); 
    writeOutput("Original query object is:" & "<br/>") 
    writeDump(myQuery) 
    // new query object 
    queryOneToBeInserted=queryNew("empid,depid,name", "integer,integer,varchar",[ 
     [15,110,"Alan"], 
     [16,115,"Jack"] 
    ]) 
    QueryInsertAt(myQuery,queryOneToBeInserted,2) 
    writeOutput("Query after insertion:" & "<br/>") 
    writeDump(myQuery) 
</cfscript>

Output

Query inserted

Member function

<cfscript> 
 myQuery=queryNew("empid,depid,name", "integer,integer,varchar",[ 
    [10, 101, "John"], 
    [20, 120, "James"], 
    [30, 205, "Peter"] 
    ]); 
    writeOutput("Original query object is:" & "<br/>") 
    writeDump(myQuery) 
    // new query object 
    queryOneToBeInserted=queryNew("empid,depid,name", "integer,integer,varchar",[ 
     [15,110,"Alan"], 
     [16,115,"Jack"] 
    ]) 
    myQuery.InsertAt(queryOneToBeInserted,2) 
    writeOutput("Query after insertion:" & "<br/>") 
    writeDump(myQuery) 
</cfscript>

 Adobe

Get help faster and easier

New user?