I came across a situation to where I wanted to do something like an StructFind(), but for a query and I didnt want to loop through it. We know that a Query is returned as a ResultSet, but did you know it was an Array? Knowing this, you can do something very easy to find a value of a record within a resultset.
QueryName["ColumnName"].indexOf("StringToFind") + 1
Since this returns the indexOf, you need to add 1 to it. If its not found, it will return 0 An example of how this would be used is (you would not want query each time you needed this info):
<CFQUERY datasource="myDSN" name="myQuery">
SELECT ROLE_NAME
FROM tbl_users_to_roles
WHERE ......
</CFQUERY>
<CFSCRIPT>
if (myQuery["ROLE_NAME"].indexOf("Administrator") + 1){
do something...
}
</CFSCRIPT>