Find the following steps to change the file based on parameter values in Report.
Create the file exporting file name using the parameters in onRenderingComplete event and store it in local variable.
function onRenderingComplete(event) {
var parameters = event.reportParameters;
if(parameters){
for (var i = 0; i < parameters.length; i++) {
if(parameters[i].Name == "Department"){
this.exportFileName = "Sales for " + parameters[i].Value;
}
}
Use the file Name property with export, click event to change the file using the value stored in local variable used for having the file using the parameters.
function onExportItemClick(event) {
event.fileName = this. exportFileName ;
}