Ssrs 2008 如何使用ssrs sort2方法
背景: 我使用ReportExecutionServiceSoap接口通过用C编写的ASP.NET应用程序呈现SSRS报告 我有一个正在工作的呈现服务,它已经实现了切换项和分页功能,所以我对代码非常有信心。 我试图提供交互式排序功能。查看非常有限的文档,实现应该非常类似于切换功能。 下面是我在渲染器中对排序方法的实现:Ssrs 2008 如何使用ssrs sort2方法,ssrs-2008,reportingservices-2005,Ssrs 2008,Reportingservices 2005,背景: 我使用ReportExecutionServiceSoap接口通过用C编写的ASP.NET应用程序呈现SSRS报告 我有一个正在工作的呈现服务,它已经实现了切换项和分页功能,所以我对代码非常有信心。 我试图提供交互式排序功能。查看非常有限的文档,实现应该非常类似于切换功能。 下面是我在渲染器中对排序方法的实现: using (var rsExec = new ReportExecutionService()) { // Config
using (var rsExec = new ReportExecutionService())
{
// Configure the service instance, specifiying the credentials and the sessionId
rsExec.Url = BuildSsrsServiceInvocationUri(m_reportServerUrl);
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
rsExec.UseDefaultCredentials = true;
// Reload the execution context of the previous session
rsExec.ExecutionHeaderValue = new ExecutionHeader();
rsExec.ExecutionHeaderValue.ExecutionID = sessionId;
// Sort
string reportItemResult; // don't know what to do with this
ExecutionInfo2 execInfoResult; // don't know what to do with this
rsExec.Sort2(sortItem,
SortDirectionEnum.Ascending, // TODO: get this from method arg
clearExistingSorts,
PageCountMode.Estimate,
out reportItemResult,
out execInfoResult);
}
从我的控制器中,我这样调用上面的方法。sessionId是以前呈现的报表的ExecutionId,id对应于用户单击的报表项:
// Sort the report
m_ReportRenderer.Sort(sessionId, id, clear);
// Render the report with the new sort order
var renderResult = m_ReportRenderer.RenderReport(sessionId, ImageRoot, actionScript);
最后,我调用渲染器的RenderReport方法,希望获得按用户单击的列排序的报告输出:
// Sort the report
m_ReportRenderer.Sort(sessionId, id, clear);
// Render the report with the new sort order
var renderResult = m_ReportRenderer.RenderReport(sessionId, ImageRoot, actionScript);
问题是:
我对API的理解正确吗?
如果没有,我做错了什么?
如果是,我做错了什么?
是的,您对API的理解是正确的。
-
您没有说,出了什么问题,但我猜调用RenderReport会产生与以前相同的未排序报告。您是否再次尝试调用Sort方法?我还不知道为什么,但它需要一个渲染报告和第二个排序调用才能正常工作。对Sort方法的所有后续调用在第一次调用时都按预期工作。