How using CFScript can you do a get in value list. below works if I pass in one id but what do you do to pass in multiple id’s?
// Get Modules By IDs
function getModulesByIDs(string dsn,required numeric pIDS) {
// Setup a variable for the Query Result
var qResult = '';
// Setup the Query variable
var q= new query();
// Add Parameter
q.addParam(name="ID", value=arguments.pIDS, cfsqltype="CF_SQL_INTEGER");
// Create the SQL String
var sqlString="
SELECT ROLEID,
ROLENAME,
NAME,
MODULENAME
FROM MODULEROLE
WHERE
MODULEIDS IN :ID
";
q.setdatasource(arguments.pDsn);
q.setsql(sqlString);
qResult=q.execute().getresult();
return qResult;
}
Use the
listattribute to indicate thevaluecontains multiple id’s and add parenthesis to construct a proper IN (..) clause.