queryInsertAt

Inserts an element into a query at the indicate position. Elements with equal or greater positions are incremented by one.
Returns the updated query with the element inserted.

queryInsertAt(query,value,position) → returns query

Member Function Syntax

query.InsertAt(value,position)

This function requires Adobe ColdFusion 2018 and up.  Not supported on Lucee, etc.

Argument Reference

query query
Required

The original query object.

value query
Required

The query object to insert.

position numeric
Required

Index position at which to insert the query object.

Compatibility

ColdFusion:

Version 2018+ Added in CF2018 Update 5

Examples
Sample code invoking the queryInsertAt function

This is Example1

qry=queryNew("rowid,name", "integer,varchar",[ [1, "Jay"],[2, "Bob"],[3, "Theodore"],[4, "William"] ]);
rufus=QueryNew("rowid,name","integer,varchar",[[42,"Rufus"]]);
queryInsertAt(qry,rufus,3);
WriteDump(qry);

Using the member function.

qry=queryNew("rowid,name", "integer,varchar",[ [1, "Jay"],[2, "Bob"],[3, "Theodore"],[4, "William"] ]);
rufus=QueryNew("rowid,name","integer,varchar",[[42,"Rufus"]]);
qry.InsertAt(rufus,3);
WriteDump(qry);

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub