Question

I am creating a query inside a function. Everything works fine until this line:

ulist = new query();

Then I get the error:

Could not find the ColdFusion component or interface query.

Code:

//GET USERS LISTS
remote query function getUserLists(userid) {
    //CONFIGURE twitter4j
    init();
    //DEFINE USER LIST QUERY
    var userLists = querynew("id, name, member_count", "Integer, VarChar, Integer");
    //GET THE USER LISTS
    getLists =  t4j.getUserLists(#arguments.userid#);
    //BUILD THE USER LIST QUERY
    for (i=1;i LTE ArrayLen(getLists);i=i+1) {
       newRecord = queryAddRow(userLists);
       newRecord = querySetCell(userLists, "id", getLists[i].getId());
       newRecord = querySetCell(userLists, "name", getLists[i].getName());
       newRecord = querySetCell(userLists, "member_count",    getLists[i].getMemberCount());
    }
    //SORT THE USER LIST BY NAME
    ulist = new query();
    ulist.setDBType("query");
    ulist.setAttributes(sourceQuery=userLists);
    ulist.setSQL("select * from sourceQuery order by name");
    userListsSorted = ulist.execute().getresult();
    //RETURN THE SORTED USER LIST QUERY
    return userListsSorted;
}
Was it helpful?

Solution

As per Twitter, make sure you have a custom tag path pointing to [instance]/customtags - which should be there by default. You could use a mapping, pointing to one of the subdirectories within that [instance]/customtags directory, eg: /coldfusion pointing to [instance]\CustomTags\com\adobe\coldfusion, then use:

ulist = new coldfusion.query();
// etc

I'd just use the custom tag directory approach though.

OTHER TIPS

Try using the full path:

ulist = new com.adobe.coldfusion.query()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top