0

У меня есть отчет в SSRS, в котором есть параметр. Для каждой возможности в параметре мне нужен файл Excel. Это сводится к 50 файлам Excel. единственный способ, которым я знаю запланировать отчет, - перейти на домашнюю страницу служб отчетов, перейти к моему отчету, щелкнуть мышью, выбрать подписки> Новая подписка и ввести имя файла, путь, имя пользователя, пароль, расписание, параметр и в конечном счете нажмите ОК.Отчет о расписании 1 с несколькими значениями параметров

Есть ли более быстрый способ сделать это, или есть способ, который позволяет мне создавать 50 отчетов быстрее, например, копирование подписки или что-то в этом роде?

+0

взгляд в управляемых данных подписки – KrazzyNefarious

+0

Я думаю, что вам нужно определенное издание, которое мы не имеем. У меня есть только выбор «Удалить» и «Новая подписка» – user1261104

ответ

0

попробуйте создать пакет ssis и запустить отчет для всех значений параметра. я видел, как кто-то делает это в моей предыдущей компании.

Подписки, основанные на данных, доступны только в корпоративных изданиях и разработчиках - ваш может быть стандартным.

-1

Вы также можете написать сценарий в PowerShell или написать приложение на C#/VB. Here - пример, сделанный в PowerShell. Here - пример, сделанный на C#. Используя любой из этих подходов, вы можете программно отображать отчеты по своему усмотрению. Вы также можете использовать create subscriptions.

решение PowerShell для ОП:

# Create a proxy to the SSRS server and give it the namespace of 'RS' to use for 
# instantiating objects later. This class will also be used to create a report 
# object. 
$reportServerURI = "http://<SERVER>/ReportServer/ReportExecution2005.asmx?WSDL" 
$RS = New-WebServiceProxy -Class 'RS' -NameSpace 'RS' -Uri $reportServerURI -UseDefaultCredential 
$RS.Url = $reportServerURI 

# Set up some variables to hold referenced results from Render 
$deviceInfo = "<DeviceInfo><NoHeader>True</NoHeader></DeviceInfo>" 
$extension = "" 
$mimeType = "" 
$encoding = "" 
$warnings = $null 
$streamIDs = $null 

# Next we need to load the report. Since Powershell cannot pass a null string 
# (it instead just passes ""), we have to use GetMethod/Invoke to call the 
# function that returns the report object. This will load the report in the 
# report server object, as well as create a report object that can be used to 
# discover information about the report. It's not used in this code, but it can 
# be used to discover information about what parameters are needed to execute 
# the report. 
$reportPath = "/PathTo/Report" 
$Report = $RS.GetType().GetMethod("LoadReport").Invoke($RS, @($reportPath, $null)) 

# Report parameters are handled by creating an array of ParameterValue objects. 
# $excelInput: either pass in as a parameter and run 50 times, or reset 
# this value and run it each time with the updated excel file 
$excelInput = "<ExcelFile>"; 
$parameters = @() 

$parameters += New-Object RS.ParameterValue 
$parameters[0].Name = "Excel Input File" 
$parameters[0].Value = $excelInput 

# Add the parameter array to the service. Note that this returns some 
# information about the report that is about to be executed. 
$RS.SetExecutionParameters($parameters, "en-us") > $null 

# Render the report to a byte array. The first argument is the report format. 
# The formats I've tested are: PDF, XML, CSV, WORD (.doc), EXCEL (.xls), 
# IMAGE (.tif), MHTML (.mhtml). 
$RenderOutput = $RS.Render('PDF', 
    $deviceInfo, 
    [ref] $extension, 
    [ref] $mimeType, 
    [ref] $encoding, 
    [ref] $warnings, 
    [ref] $streamIDs 
) 

# Convert array bytes to file and write 
$OutputFile = $excelInput + ".pdf" 
$Stream = New-Object System.IO.FileStream($OutputFile), Create, Write 
$Stream.Write($RenderOutput, 0, $RenderOutput.Length) 
$Stream.Close() 
+0

У кого-нибудь была возможность проверить вышеупомянутый сценарий оболочки? Будет ли пример в другом формате работать лучше? –

Смежные вопросы