Hi Andy,
if you want to change dynamically the datasource, you just need to put on the Pre Exec the following code:
function (){
var d = this;
//Get query name
var qry = getFirstPart(p_runcsv, '|');
d.queryDefinition.dataSource = qry;
}
qry needs to be the name of the query that is defined on the datasources panel.
Thanks,
Joana