在应用程序中查看报表时,当移动到下一页时,参数提示符重新显示 [英] When viewing a report inside an application, the parameter prompt redisplays when moving to the next page

查看:115
本文介绍了在应用程序中查看报表时,当移动到下一页时,参数提示符重新显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几乎是水晶报告的新手。我们有另一个团队制作我们的报告,我将它与应用程序集成。问题是分页和用户定义的参数。基本上,document.table。 setdatasource指向我们的查询结果集(在代码中设置)。该报告在打开时将提示用户输入参数,由于提示参数是记录选择公式的一部分,因此将进一步将显示结果减少给用户。

  AND 
{@Age}> = 20 and
{@Age}< 30 and
{Report; 1.Sector} = {?NewSector})

返回一个长度超过一页的表。然而,请求下一页将导致用户再次被提示用于扇区,并且一旦被提供,将再次使用户返回到结果的第1页。



如果我取出参数的引用,那么显然分页工作正常。



有一次从用户取一个参数,然后重用这个值在

解决方案

p>愚蠢我。我有报告刷新每个回邮。



编辑



稍微详细一些:



我有一个在RefreshReports过程中创建的报告,它设置报告如下:

  Dim objConnectionInfo As CrystalDecisions.Shared.ConnectionInfo 
Dim crConnectionInfo As CrystalDecisions.Shared.ConnectionInfo

Dim myconnection作为新的SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings(ApplicationConstants.MyDB).ConnectionString)
Dim myConnBuilder As New SqlConnectionStringBuilder(myconnection.ConnectionString)

'//从web.config登录凭据
objConnectionInfo =新的CrystalDecisions.Shared.ConnectionInfo
objConnectionInfo。 IntegratedSecurity = False
objConnectionInfo.ServerName = myconnection.DataSource
objConnectionInfo.UserID = myConnBuilder.UserID
objConnectionInfo.Password = myConnBuilder.Password

crConnectionInfo = objConnectionInfo


'//获取所需的报告细节
rep = Request.QueryString(Report)
crDoc.Load(Server.MapPath(rep))
crDoc.SetDatabaseLogon(myConnBuilder.UserID,myConnBuilder.Password)

Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database

Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
Dim aTable As CrystalDecisions.CrystalReports.Engine.Table

crDatabase = crDoc.Database
crTables = crDatabase.Tables

然后有一系列的其他ifs,如下所示:

  ElseIf rep =ExampleRep.rptthen 
对于每个aTable In crTables
如果aTable.Name =GetSectorRep; 1then
Dim NewSector As String =
NewSector = Session (NewSector)。ToString()
aTable.SetDataSource(DAL.GetSectorRepTable(NewSector))
如果
结束,则

在我的Page_Init我抓住我需要的查询字符串,并调用RefreshReports。我所遇到的问题是,我还要求在Postback的page_load的RefreshReports,这意味着每次报告发回(例如,新的页面)它请求参数,因为报告正在重新创建。 / p>

所以,傻我 - 到底是个明显的错误!


I'm pretty much a novice with crystal reports. We have another team making our reports, and I'm integrating it with the application. The problem is with paging and user defined parameters. Essentially, the document.table. setdatasource points at our query result set (set in code). The report, upon opening, will then prompt the user for the parameter, which will further reduce the displayed result to the user as the prompt parameter is part of the record selection formula.

AND
{@Age} >= 20 and
{@Age} < 30 and
{Report;1.Sector} = {?NewSector})

This will return a table of more than one page in length. However, requesting the next page will result in the user being prompted for the Sector again, and once provided, will take the user back to page 1 of the results again.

If I take out the reference to the parameter, then obviously the paging works fine.

Is there away to just take the parameter once from the user, and then reuse this value in the subsequent paging requests?

Appreciate your help...

解决方案

Stupid me. I had the report refreshing every postback.

EDit

A bit more elaboration:

I have the report being created in a RefreshReports procedure, which sets up the report as follows:

 Dim objConnectionInfo As CrystalDecisions.Shared.ConnectionInfo
    Dim crConnectionInfo As CrystalDecisions.Shared.ConnectionInfo

    Dim myconnection As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings(ApplicationConstants.MyDB).ConnectionString)
    Dim myConnBuilder As New SqlConnectionStringBuilder(myconnection.ConnectionString)

    '// Log on credentials from web.config
    objConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo
    objConnectionInfo.IntegratedSecurity = False
    objConnectionInfo.ServerName = myconnection.DataSource
    objConnectionInfo.UserID = myConnBuilder.UserID
    objConnectionInfo.Password = myConnBuilder.Password

    crConnectionInfo = objConnectionInfo


    '// Get the report details needed
    rep = Request.QueryString("Report")
    crDoc.Load(Server.MapPath(rep))
    crDoc.SetDatabaseLogon(myConnBuilder.UserID, myConnBuilder.Password)

    Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database

    Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
    Dim aTable As CrystalDecisions.CrystalReports.Engine.Table

    crDatabase = crDoc.Database
    crTables = crDatabase.Tables

There is then a series of else ifs like the following:

ElseIf rep = "ExampleRep.rpt" Then
        For Each aTable In crTables
            If aTable.Name = "GetSectorRep;1" Then
                Dim NewSector As String = ""
                    NewSector = Session("NewSector").ToString()
                aTable.SetDataSource(DAL.GetSectorRepTable(NewSector))
            End If
        Next

In my Page_Init I grab the query strings I need and call RefreshReports. The problem I was having was that I was also requesting RefreshReports in a If Postback on page_load, which meant that every time the report posted back (eg. new page) it was requesting the parameter again, as the report was being created afresh.

So, silly me - quite an obvious mistake in the end!

这篇关于在应用程序中查看报表时,当移动到下一页时,参数提示符重新显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆