Hi Anupam,
I found this somewhere and hope it helps you for exporting data to excel based on filter values selected. Make sure to change this part to whatever the script name is for your table/visual you are exporting data from. parameterValue.values = [ ExportTable.id ];
// Get the export service.
var exportService = this.getService(‘ExportService’);
// Get the view service.
var viewService = this.getService(‘ViewService’);
// Create the export request.
var exportRequest =
new dundas.export.ExportRequest(
{
isLegacyExport: true,
// Export Excel
providerId: dundas.constants.STANDARD_EXCEL_EXPORT_PROVIDER_ID,
viewData: this.getService(“CanvasService”).canvas.viewModel.businessObject.control
});
// Create parameter value to pass to the request.
var parameterValue = new dundas.data.CollectionStringValue();
parameterValue.parameterId = dundas.constants.EXCEL_ADAPTERS_ID;
parameterValue.values = [ ExportTable.id ];
exportRequest.parameterValues.push(parameterValue);
//Multiple select
var parameterValue = new dundas.data.SingleNumberValue();
parameterValue.parameterId = dundas.constants.EXCEL_EXPORT_SELECTION_ID;
parameterValue.value = 3 ;
exportRequest.parameterValues.push(parameterValue);
//Include parameters
var parameterValue = new dundas.data.SingleBooleanValue;
parameterValue.parameterId = dundas.constants.EXCEL_INCLUDE_PARAMETERS_ID;
parameterValue.value = true;
exportRequest.parameterValues.push(parameterValue);
//On the left
var parameterValue = new dundas.data.SingleNumberValue();
parameterValue.parameterId = dundas.constants.EXCEL_PARAMETER_VALUES_LOCATION_ID;
parameterValue.value = 2;
exportRequest.parameterValues.push(parameterValue);
//Append date to file name
var parameterValue = new dundas.data.SingleBooleanValue;
parameterValue.parameterId = dundas.constants.APPEND_DATE_TO_FILE_NAME_ID;
parameterValue.value = true;
exportRequest.parameterValues.push(parameterValue);
// Get the perform export promise.
var exportPromise =
exportService.performExport(exportRequest);
// Setup a loading dialog.
viewService.showLoadingRestCall(exportPromise);
exportPromise.done(
function(exportId)
{
// Get the Url for the export file.
var exportFileUrl =
exportService.getExportResultUrl(exportId);
// Force the browser to download the file.
window.location.replace(exportFileUrl);
}
);